This commit is contained in:
BernardoGiordano 2018-12-14 19:20:14 +01:00
parent 2a40325bcb
commit b0634ce987
2 changed files with 6 additions and 3 deletions

View file

@ -9,6 +9,7 @@
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
#include "SDL_FontCache.h" #include "SDL_FontCache.h"
#include "colors.hpp"
bool SDLH_Init(void); bool SDLH_Init(void);
void SDLH_Exit(void); void SDLH_Exit(void);
@ -17,10 +18,10 @@ void SDLH_ClearScreen(SDL_Color color);
void SDLH_DrawRect(int x, int y, int w, int h, SDL_Color color); void SDLH_DrawRect(int x, int y, int w, int h, SDL_Color color);
void SDLH_DrawCircle(int x, int y, int r, SDL_Color color); void SDLH_DrawCircle(int x, int y, int r, SDL_Color color);
void SDLH_DrawText(int size, int x, int y, SDL_Color color, const char *text); void SDLH_DrawText(int size, int x, int y, SDL_Color color, const char *text);
void SDLH_LoadImage(SDL_Texture **texture, char *path); void SDLH_LoadImage(SDL_Texture** texture, char* path);
void SDLH_LoadImage(SDL_Texture** texture, u8* buff, size_t size); void SDLH_LoadImage(SDL_Texture** texture, u8* buff, size_t size);
void SDLH_DrawImage(SDL_Texture *texture, int x, int y); void SDLH_DrawImage(SDL_Texture* texture, int x, int y);
void SDLH_DrawImageScale(SDL_Texture *texture, int x, int y, int w, int h); void SDLH_DrawImageScale(SDL_Texture* texture, int x, int y, int w, int h);
void SDLH_DrawIcon(std::string icon, int x, int y); void SDLH_DrawIcon(std::string icon, int x, int y);
void SDLH_GetTextDimensions(int size, const char* text, u32* w, u32* h); void SDLH_GetTextDimensions(int size, const char* text, u32* w, u32* h);
void SDLH_DrawTextBox(int size, int x, int y, SDL_Color color, int max, const char* text); void SDLH_DrawTextBox(int size, int x, int y, SDL_Color color, int max, const char* text);

View file

@ -54,6 +54,7 @@ bool SDLH_Init(void)
SDLH_LoadImage(&s_flag, "romfs:/flag.png"); SDLH_LoadImage(&s_flag, "romfs:/flag.png");
SDLH_LoadImage(&s_star, "romfs:/star.png"); SDLH_LoadImage(&s_star, "romfs:/star.png");
SDLH_LoadImage(&s_checkbox, "romfs:/checkbox.png"); SDLH_LoadImage(&s_checkbox, "romfs:/checkbox.png");
SDL_SetTextureColorMod(s_checkbox, COLOR_GREY_BG.r, COLOR_GREY_BG.g, COLOR_GREY_BG.b);
// const int mix_flags = MIX_INIT_OGG; // const int mix_flags = MIX_INIT_OGG;
// if ((Mix_Init(mix_flags) & mix_flags) != mix_flags) // if ((Mix_Init(mix_flags) & mix_flags) != mix_flags)
@ -186,6 +187,7 @@ void SDLH_DrawIcon(std::string icon, int x, int y)
t = s_flag; t = s_flag;
} else if (icon.compare("checkbox") == 0) { } else if (icon.compare("checkbox") == 0) {
t = s_checkbox; t = s_checkbox;
SDLH_DrawRect(x + 8, y + 8, 24, 24, COLOR_WHITE);
} else if (icon.compare("star") == 0) { } else if (icon.compare("star") == 0) {
t = s_star; t = s_star;
} }