diff options
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/main.cpp b/src/main.cpp index 5a495f3..6e79ff1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -42,6 +42,9 @@ SDL_Renderer* renderer = nullptr; SDL_Event event; TTF_Font* globalFont = nullptr; +// Colors +SDL_Color veryDarkGrey = {30, 30, 47, 255}; + struct QueuedTexture { SDL_Texture* texture; int x; @@ -268,15 +271,7 @@ int main() { for (const auto& button: buttonList) { if (x > button.rect.x && x < button.rect.x + button.rect.w && y > button.rect.y && y < button.rect.y + button.rect.h) { - lua_getglobal(L, button.callback.c_str()); - if (lua_isfunction(L, -1)) { - if (lua_pcall(L, 0, 0, 0) != LUA_OK) { - std::cerr << "Lua Error in button callback: " << lua_tostring(L, -1) << std::endl; - lua_pop(L, 1); - } - } else { - lua_pop(L, 1); - } + call_lua_function(L, button.callback.c_str()); } } } @@ -314,8 +309,7 @@ int main() { SDL_SetRenderDrawColor(renderer, 252, 210, 77, 255); SDL_RenderFillRect(renderer, &button.rect); if (globalFont) { - SDL_Color white = {255, 255, 255, 255}; - SDL_Surface* textSurface = TTF_RenderText_Blended(globalFont, button.text.c_str(), white); + SDL_Surface* textSurface = TTF_RenderText_Blended(globalFont, button.text.c_str(), veryDarkGrey); if (textSurface) { SDL_Texture* textTexture = SDL_CreateTextureFromSurface(renderer, textSurface); SDL_Rect textRect; @@ -333,7 +327,7 @@ int main() { } } } - + buttonList.clear(); SDL_RenderPresent(renderer); SDL_Delay(10); |
