Jump to content

Custom draw possible issue


Fabien Comte

Recommended Posts

Hello,

When i draw my images, it looks like x and y are expected values + 2

This is the code

void gwinMyButtonCustomDraw(GWidgetObject *gw, void *param) 
{
	const GColorSet *	pcol;
	coord_t				sy = 0;

	if (gw->g.vmt != (gwinVMT *)&buttonVMT)	return;
	

	gdispImage * temp_images = (gdispImage *)param;
	gdispImage * temp_image = NULL;
		
	if (!(gw->g.flags & GWIN_FLG_SYSENABLED)) 
	{
		temp_image = &(temp_images[BUTTON_DISABLED]);
	} 
	else if ((gw->g.flags & GBUTTON_FLG_PRESSED)) 
	{
		temp_image = &(temp_images[BUTTON_ACTIVE]);
	} 
	else 
	{
		temp_image = &(temp_images[BUTTON_IDLE]);
	}
	
	gdispGImageDraw(gw->g.display, temp_image, gw->g.x, gw->g.y, gw->g.width, gw->g.height, 0, sy);
	
	if (gw->text[0] != '\0')
	{
		pcol = getButtonColors(gw);
		gdispGDrawStringBox(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->text, gw->g.font, pcol->text, justifyCenter);
	}
}

 

And a schematic (i noticed that because my button image was a prolongation of the background)

draw_problem.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...