ID:119022
 
Applies to:DM Language
Status: Open

Issue hasn't been assigned a status value.
When working with bounding box sizes, and specifically with positioning them on a mob or object, I'd very much like to be able to SEE the box. Would be very useful when using obscure sprites and sprite sizes. Trying to just test and eye it is very tedious.
Been having the same issues when dealing with side-scrollers a feature like this would be nice.
Try this for now:
This image is used for the bounds outline, just include it with the code:
obj/VisibleBounds
layer=FLOAT_LAYER

var/outlineOpacity=5
//Increasing outlineOpacity will make the outline more visible, but decrease performance
atom/movable/proc/ShowVisualBounds()
//Create properly sized bounds outline icon
var/icon/I=new('VisibleBounds.png')
I.Scale(src.bound_width,src.bound_height)
for(var/i=1; i<=outlineOpacity; i++) I.Blend(I,ICON_OVERLAY) //Corrects transparency caused by Scaling

//Create an obj, adjust offsets, assign scaled icon, add to overlays
var/obj/VisibleBounds/visBoundsObj=new
visBoundsObj.pixel_x=src.bound_x
visBoundsObj.pixel_y=src.bound_y
visBoundsObj.icon=I
src.overlays+=visBoundsObj

atom/movable/proc/HideVisualBounds()
//Remove any overlays created from VisualBounds
for(var/I in src.overlays) if(I && I:name=="VisibleBounds") src.overlays-=I

atom/movable/proc/UpdateVisibleBounds()
//Refresh the bounds outline, by calling the above procs, useful if you change bound vars
src.HideVisualBounds()
src.ShowVisualBounds()
Ah thanks. It destroys the frame rate when called rapidly, but it'll work. I can use it to help write a function to recenter a bounding box when you change the width on the fly.

It would still be nice to simply have a variable to toggle it though. Probably less CPU intensive.
I agree this would be a useful/necessary feature to have built in.
Try disabling the for(var/i=1; i<=10; i++) I.Blend(I,ICON_OVERLAY) line, those 10 extra operations make the outline a lot easier to see, but they're going to waste a lot of CPU in the process. Could also just try lowering how many times it blends on top of itself.
EDIT: Turning that loop down from 10 to 5 yields acceptably opaque results, I've gone ahead and edited the posted code for anyone else who might come along, should ~double performance.