I want eModeUseinv to have one cursor graphic as default and another graphic when hovering over certain hotspots or objects. This works just fine (thanks everyone for help with the coding in another thread). As it is, my cursor graphic is the default at whatever position on the screen, however when hovering over a hotspot, another cursor graphic makes the inventory item seem highlighted in some way (still playing around with designs).
But I use a lot of sprite slots and its tedious work to make two graphic sprites for every inventory item (one default and one highlighted). Is there a function in AGS that can make a graphic seem different in some way? Of course I can tint the graphic sprite using dynamic sprites, but I'm not reaaly satisfied with tinting. I want something like creating an outline around the object or changing a graphic sprite to grey shades.
Is there a solution that might do something like that?
It may be that you need to go into editor settings and set display gui's as normal...otherwise they grey out by default..
You need to iterate over the sprite pixel by pixel and create a copy, then store that in a global array of DynamicSprites. Now use that as cursor images.
Adding an outline means checking each pixel's neighbors for transparency. Turning to black and white is done using a conversion formula of the RGB values to a single lightness value and using that for R, B and G.
It's all doable, using DynamicSprite and DrawingSurface commands, plus loops.
You can do a really quick outline with:
DynamicSprite *outlinespr;
function OutlineSprite (int slot,int color)
{
DynamicSprite *sprol = DynamicSprite.CreateFromExistingSprite (slot);
DrawingSurface *surf = sprol.GetDrawingSurface ();
surf.Clear (color);
surf.Release ();
sprol.CopyTransparencyMask (slot);
outlinespr = DynamicSprite.CreateFromExistingSprite (slot);
surf = outlinespr.GetDrawingSurface ();
surf.Clear (COLOR_TRANSPARENT);
surf.DrawImage (sprol.Graphic,-1, 0);
surf.DrawImage (sprol.Graphic, 1, 0);
surf.DrawImage (sprol.Graphic, 0,-1);
surf.DrawImage (sprol.Graphic, 0, 1);
surf.DrawImage (slot,0,0);
surf.Release ();
}
It's probably the easiest thing you can do without going into Get/DrawPixel, which are ungodly slow.
Thank you very much for the info Khris and for the solution Scavenger. I'm very excited to try it out. Thanks.