diff --git a/src/toolkit.c b/src/toolkit.c index 790bafa..eacbd6e 100644 --- a/src/toolkit.c +++ b/src/toolkit.c @@ -218,6 +218,11 @@ void window_modifyText(const unsigned int wid, char* name, char* newstring) { wgt->dat.txt.text = strdup(newstring); } +void window_modifyImage(const unsigned int wid, char* name, glTexture* image) { + Widget* wgt = window_getwgt(wid, name); + wgt->dat.img.image = image; +} + // Check if a window exists. int window_exists(const char* wdwname) { int i; @@ -668,7 +673,10 @@ static void toolkit_renderText(Widget* txt, double bx, double by) { static void toolkit_renderImage(Widget* img, double bx, double by) { glColour* lc, *c, *oc; double x, y; - x = bx + img->x; + + if(img->dat.img.image == NULL) return; + + x = bx + img->x; y = by + img->y; lc = &cGrey90; diff --git a/src/toolkit.h b/src/toolkit.h index 1c576ff..8690d70 100644 --- a/src/toolkit.h +++ b/src/toolkit.h @@ -21,6 +21,7 @@ void window_addImage(const unsigned int wid, const int x, const int y, // Modification void window_modifyText(const unsigned int wid, char* name, char* newstring); +void window_modifyImage(const unsigned int wid, char* name, glTexture* image); // Get the window by name. int window_exists(const char* wdwname);