void GuiElement_t::defaultDrawCallback(GuiElement_t * elem, bool pressed, int x, int y) { SDL_Rect r; Uint32 color = SDL_MapRGB(SDL_GetVideoSurface()->format, elem->toggled ? 192 : 128, elem->toggled ? 192 : 128, elem->toggled ? 192 : 128); SDL_FillRect(SDL_GetVideoSurface(), &elem->rect, color); color = SDL_MapRGB(SDL_GetVideoSurface()->format, 255, 255, 255); r = elem->rect; r.w = 1; SDL_FillRect(SDL_GetVideoSurface(), &r, color); r.x = elem->rect.x + elem->rect.w - 1; SDL_FillRect(SDL_GetVideoSurface(), &r, color); r = elem->rect; r.h = 1; SDL_FillRect(SDL_GetVideoSurface(), &r, color); r.y = elem->rect.y + elem->rect.h - 1; SDL_FillRect(SDL_GetVideoSurface(), &r, color); renderStringColor(elem->text.c_str(), elem->rect.x + elem->rect.w / 2, elem->rect.y + elem->rect.h / 2, elem->toggled ? 0 : 255, elem->toggled ? 0 : 255, elem->toggled ? 0 : 255); }
static void dialogDrawTextCallback(GuiElement_t * elem, bool pressed, int x, int y) { SDL_Rect r; Uint32 color = SDL_MapRGB(SDL_GetVideoSurface()->format, 255, 255, 255); r = elem->rect; r.w = 1; SDL_FillRect(SDL_GetVideoSurface(), &r, color); r.x = elem->rect.x + elem->rect.w - 1; SDL_FillRect(SDL_GetVideoSurface(), &r, color); r = elem->rect; r.h = 1; SDL_FillRect(SDL_GetVideoSurface(), &r, color); r.y = elem->rect.y + elem->rect.h - 1; SDL_FillRect(SDL_GetVideoSurface(), &r, color); for( int i = 0; i < DIALOG_MESSAGE_LINES; i++ ) { renderStringColor(dialogMessage[i], elem->rect.x + elem->rect.w / 2, elem->rect.y + i * VID_Y * 0.1 + VID_Y * 0.04, 255, 255, 255); } }
void renderString(const char *c, int x, int y) { renderStringColor(c, x, y, 255, 255, 255, SDL_GetVideoSurface()); }