diff --git a/Makefile b/Makefile index 575a284..30a0762 100644 --- a/Makefile +++ b/Makefile @@ -63,7 +63,7 @@ CFLAGS := -g -std=c++17 -Wall -O2 -ffunction-sections \ CFLAGS += -D__SWITCH__ $(INCLUDE) `sdl2-config --cflags` -CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -DDEBUG=1 #-DEXPERIMENTAL=1 +CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -DDEBUG=1 -DEXPERIMENTAL=1 ASFLAGS := -g $(ARCH) LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) diff --git a/include/helpers/SDL_helper.h b/include/helpers/SDL_helper.h index b63de6e..5844200 100644 --- a/include/helpers/SDL_helper.h +++ b/include/helpers/SDL_helper.h @@ -36,7 +36,8 @@ void SDL_DrawCircle(SDL_Renderer *renderer, int x, int y, int r, SDL_Color colou void SDL_DrawText(SDL_Renderer *renderer, TTF_Font *font, int x, int y, SDL_Color colour, const char *text); void SDL_DrawRotatedText(SDL_Renderer *renderer, TTF_Font *font, double rotation, int x, int y, SDL_Color colour, const char *text); void SDL_DrawTextf(SDL_Renderer *renderer, TTF_Font *font, int x, int y, SDL_Color colour, const char* text, ...); -void SDL_LoadImage(SDL_Renderer *renderer, SDL_Texture **texture, char *path); +//void SDL_LoadImage(SDL_Renderer *renderer, SDL_Texture **texture, char *path); +void SDL_LoadImage(SDL_Texture **texture, char *path); void SDL_LoadImageBuf(SDL_Renderer *renderer, SDL_Texture **texture, void *mem, int size); void SDL_DrawImage(SDL_Renderer *renderer, SDL_Texture *texture, int x, int y); void SDL_DrawImageScale(SDL_Renderer *renderer, SDL_Texture *texture, int x, int y, int w, int h); diff --git a/include/textures.h b/include/textures.h index bb40f4e..a4debe2 100644 --- a/include/textures.h +++ b/include/textures.h @@ -5,7 +5,9 @@ extern SDL_Texture *battery_20, *battery_20_charging, *battery_30, *battery_30_charging, *battery_50, *battery_50_charging, \ *battery_60, *battery_60_charging, *battery_80, *battery_80_charging, *battery_90, *battery_90_charging, \ - *battery_full, *battery_full_charging, *battery_low, *battery_unknown, *error, *warning; + *battery_full, *battery_full_charging, *battery_low, *battery_unknown, *error, *warning, *button_a, *button_b, \ + *button_x, *button_y, *button_down, *button_up, *button_left, *button_right, *button_lb, *button_rb, *button_lt, \ + *button_rt, *button_minus, *button_plus, *button_capture, *button_home; void Textures_Load(void); void Textures_Free(void); diff --git a/romfs/resources/images/battery_20.png b/romfs/resources/images/battery/battery_20.png similarity index 100% rename from romfs/resources/images/battery_20.png rename to romfs/resources/images/battery/battery_20.png diff --git a/romfs/resources/images/battery_20_charging.png b/romfs/resources/images/battery/battery_20_charging.png similarity index 100% rename from romfs/resources/images/battery_20_charging.png rename to romfs/resources/images/battery/battery_20_charging.png diff --git a/romfs/resources/images/battery_30.png b/romfs/resources/images/battery/battery_30.png similarity index 100% rename from romfs/resources/images/battery_30.png rename to romfs/resources/images/battery/battery_30.png diff --git a/romfs/resources/images/battery_30_charging.png b/romfs/resources/images/battery/battery_30_charging.png similarity index 100% rename from romfs/resources/images/battery_30_charging.png rename to romfs/resources/images/battery/battery_30_charging.png diff --git a/romfs/resources/images/battery_50.png b/romfs/resources/images/battery/battery_50.png similarity index 100% rename from romfs/resources/images/battery_50.png rename to romfs/resources/images/battery/battery_50.png diff --git a/romfs/resources/images/battery_50_charging.png b/romfs/resources/images/battery/battery_50_charging.png similarity index 100% rename from romfs/resources/images/battery_50_charging.png rename to romfs/resources/images/battery/battery_50_charging.png diff --git a/romfs/resources/images/battery_60.png b/romfs/resources/images/battery/battery_60.png similarity index 100% rename from romfs/resources/images/battery_60.png rename to romfs/resources/images/battery/battery_60.png diff --git a/romfs/resources/images/battery_60_charging.png b/romfs/resources/images/battery/battery_60_charging.png similarity index 100% rename from romfs/resources/images/battery_60_charging.png rename to romfs/resources/images/battery/battery_60_charging.png diff --git a/romfs/resources/images/battery_80.png b/romfs/resources/images/battery/battery_80.png similarity index 100% rename from romfs/resources/images/battery_80.png rename to romfs/resources/images/battery/battery_80.png diff --git a/romfs/resources/images/battery_80_charging.png b/romfs/resources/images/battery/battery_80_charging.png similarity index 100% rename from romfs/resources/images/battery_80_charging.png rename to romfs/resources/images/battery/battery_80_charging.png diff --git a/romfs/resources/images/battery_90.png b/romfs/resources/images/battery/battery_90.png similarity index 100% rename from romfs/resources/images/battery_90.png rename to romfs/resources/images/battery/battery_90.png diff --git a/romfs/resources/images/battery_90_charging.png b/romfs/resources/images/battery/battery_90_charging.png similarity index 100% rename from romfs/resources/images/battery_90_charging.png rename to romfs/resources/images/battery/battery_90_charging.png diff --git a/romfs/resources/images/battery_full.png b/romfs/resources/images/battery/battery_full.png similarity index 100% rename from romfs/resources/images/battery_full.png rename to romfs/resources/images/battery/battery_full.png diff --git a/romfs/resources/images/battery_full_charging.png b/romfs/resources/images/battery/battery_full_charging.png similarity index 100% rename from romfs/resources/images/battery_full_charging.png rename to romfs/resources/images/battery/battery_full_charging.png diff --git a/romfs/resources/images/battery_low.png b/romfs/resources/images/battery/battery_low.png similarity index 100% rename from romfs/resources/images/battery_low.png rename to romfs/resources/images/battery/battery_low.png diff --git a/romfs/resources/images/battery_unknown.png b/romfs/resources/images/battery/battery_unknown.png similarity index 100% rename from romfs/resources/images/battery_unknown.png rename to romfs/resources/images/battery/battery_unknown.png diff --git a/romfs/resources/images/control/Switch_A.png b/romfs/resources/images/control/Switch_A.png new file mode 100644 index 0000000..df756ef Binary files /dev/null and b/romfs/resources/images/control/Switch_A.png differ diff --git a/romfs/resources/images/control/Switch_B.png b/romfs/resources/images/control/Switch_B.png new file mode 100644 index 0000000..ea7e743 Binary files /dev/null and b/romfs/resources/images/control/Switch_B.png differ diff --git a/romfs/resources/images/control/Switch_Controller_Left.png b/romfs/resources/images/control/Switch_Controller_Left.png new file mode 100644 index 0000000..f90a244 Binary files /dev/null and b/romfs/resources/images/control/Switch_Controller_Left.png differ diff --git a/romfs/resources/images/control/Switch_Controller_Right.png b/romfs/resources/images/control/Switch_Controller_Right.png new file mode 100644 index 0000000..873da7e Binary files /dev/null and b/romfs/resources/images/control/Switch_Controller_Right.png differ diff --git a/romfs/resources/images/control/Switch_Controllers.png b/romfs/resources/images/control/Switch_Controllers.png new file mode 100644 index 0000000..b6ee54d Binary files /dev/null and b/romfs/resources/images/control/Switch_Controllers.png differ diff --git a/romfs/resources/images/control/Switch_Controllers_Separate.png b/romfs/resources/images/control/Switch_Controllers_Separate.png new file mode 100644 index 0000000..0c019da Binary files /dev/null and b/romfs/resources/images/control/Switch_Controllers_Separate.png differ diff --git a/romfs/resources/images/control/Switch_Down.png b/romfs/resources/images/control/Switch_Down.png new file mode 100644 index 0000000..7b7b2b2 Binary files /dev/null and b/romfs/resources/images/control/Switch_Down.png differ diff --git a/romfs/resources/images/control/Switch_Dpad.png b/romfs/resources/images/control/Switch_Dpad.png new file mode 100644 index 0000000..12f01eb Binary files /dev/null and b/romfs/resources/images/control/Switch_Dpad.png differ diff --git a/romfs/resources/images/control/Switch_Dpad_Down.png b/romfs/resources/images/control/Switch_Dpad_Down.png new file mode 100644 index 0000000..37f6d5b Binary files /dev/null and b/romfs/resources/images/control/Switch_Dpad_Down.png differ diff --git a/romfs/resources/images/control/Switch_Dpad_Left.png b/romfs/resources/images/control/Switch_Dpad_Left.png new file mode 100644 index 0000000..8efd7a4 Binary files /dev/null and b/romfs/resources/images/control/Switch_Dpad_Left.png differ diff --git a/romfs/resources/images/control/Switch_Dpad_Right.png b/romfs/resources/images/control/Switch_Dpad_Right.png new file mode 100644 index 0000000..8b5411d Binary files /dev/null and b/romfs/resources/images/control/Switch_Dpad_Right.png differ diff --git a/romfs/resources/images/control/Switch_Dpad_Up.png b/romfs/resources/images/control/Switch_Dpad_Up.png new file mode 100644 index 0000000..700a8ba Binary files /dev/null and b/romfs/resources/images/control/Switch_Dpad_Up.png differ diff --git a/romfs/resources/images/control/Switch_Home.png b/romfs/resources/images/control/Switch_Home.png new file mode 100644 index 0000000..9b6733c Binary files /dev/null and b/romfs/resources/images/control/Switch_Home.png differ diff --git a/romfs/resources/images/control/Switch_LB.png b/romfs/resources/images/control/Switch_LB.png new file mode 100644 index 0000000..ddfa3b9 Binary files /dev/null and b/romfs/resources/images/control/Switch_LB.png differ diff --git a/romfs/resources/images/control/Switch_LT.png b/romfs/resources/images/control/Switch_LT.png new file mode 100644 index 0000000..6942e1f Binary files /dev/null and b/romfs/resources/images/control/Switch_LT.png differ diff --git a/romfs/resources/images/control/Switch_Left.png b/romfs/resources/images/control/Switch_Left.png new file mode 100644 index 0000000..fd58439 Binary files /dev/null and b/romfs/resources/images/control/Switch_Left.png differ diff --git a/romfs/resources/images/control/Switch_Left_Stick.png b/romfs/resources/images/control/Switch_Left_Stick.png new file mode 100644 index 0000000..d861ca5 Binary files /dev/null and b/romfs/resources/images/control/Switch_Left_Stick.png differ diff --git a/romfs/resources/images/control/Switch_Minus.png b/romfs/resources/images/control/Switch_Minus.png new file mode 100644 index 0000000..d32608e Binary files /dev/null and b/romfs/resources/images/control/Switch_Minus.png differ diff --git a/romfs/resources/images/control/Switch_Plus.png b/romfs/resources/images/control/Switch_Plus.png new file mode 100644 index 0000000..f1b0dc4 Binary files /dev/null and b/romfs/resources/images/control/Switch_Plus.png differ diff --git a/romfs/resources/images/control/Switch_RB.png b/romfs/resources/images/control/Switch_RB.png new file mode 100644 index 0000000..01f137a Binary files /dev/null and b/romfs/resources/images/control/Switch_RB.png differ diff --git a/romfs/resources/images/control/Switch_RT.png b/romfs/resources/images/control/Switch_RT.png new file mode 100644 index 0000000..6aef3cb Binary files /dev/null and b/romfs/resources/images/control/Switch_RT.png differ diff --git a/romfs/resources/images/control/Switch_Right.png b/romfs/resources/images/control/Switch_Right.png new file mode 100644 index 0000000..f524c6c Binary files /dev/null and b/romfs/resources/images/control/Switch_Right.png differ diff --git a/romfs/resources/images/control/Switch_Right_Stick.png b/romfs/resources/images/control/Switch_Right_Stick.png new file mode 100644 index 0000000..f2c605b Binary files /dev/null and b/romfs/resources/images/control/Switch_Right_Stick.png differ diff --git a/romfs/resources/images/control/Switch_Square.png b/romfs/resources/images/control/Switch_Square.png new file mode 100644 index 0000000..d0fd432 Binary files /dev/null and b/romfs/resources/images/control/Switch_Square.png differ diff --git a/romfs/resources/images/control/Switch_Up.png b/romfs/resources/images/control/Switch_Up.png new file mode 100644 index 0000000..352f890 Binary files /dev/null and b/romfs/resources/images/control/Switch_Up.png differ diff --git a/romfs/resources/images/control/Switch_X.png b/romfs/resources/images/control/Switch_X.png new file mode 100644 index 0000000..bdf86ba Binary files /dev/null and b/romfs/resources/images/control/Switch_X.png differ diff --git a/romfs/resources/images/control/Switch_Y.png b/romfs/resources/images/control/Switch_Y.png new file mode 100644 index 0000000..46ac216 Binary files /dev/null and b/romfs/resources/images/control/Switch_Y.png differ diff --git a/romfs/resources/images/error.png b/romfs/resources/images/info/error.png similarity index 100% rename from romfs/resources/images/error.png rename to romfs/resources/images/info/error.png diff --git a/romfs/resources/images/warning.png b/romfs/resources/images/info/warning.png similarity index 100% rename from romfs/resources/images/warning.png rename to romfs/resources/images/info/warning.png diff --git a/source/helpers/SDL_helper.c b/source/helpers/SDL_helper.c index 4b83d45..b7cec5d 100644 --- a/source/helpers/SDL_helper.c +++ b/source/helpers/SDL_helper.c @@ -1,5 +1,6 @@ #include "common.h" #include "SDL_helper.h" +#include void SDL_ClearScreen(SDL_Renderer *renderer, SDL_Color colour) { SDL_SetRenderDrawColor(renderer, colour.r, colour.g, colour.b, colour.a); @@ -41,14 +42,11 @@ void SDL_DrawRotatedText(SDL_Renderer *renderer, TTF_Font *font, double rotation position.x = x; position.y = y; SDL_QueryTexture(texture, NULL, NULL, &position.w, &position.h); SDL_Point center = {position.w / 2, position.h / 2}; - SDL_Rect crop = {0, 0, &position.w, &position.h}; // the crop is what part of the image we want to display. + SDL_Rect crop = {0, 0, &position.w, &position.h}; SDL_SetRenderTarget(renderer, texture); - //SDL_RenderCopyEx(RENDERER, texture, &crop, &position, rotation, ¢er, SDL_FLIP_NONE); SDL_RenderCopyEx(RENDERER, texture, NULL, &position, rotation, NULL, SDL_FLIP_NONE); SDL_SetRenderTarget(renderer, NULL); - /*SDL_QueryTexture(texture, NULL, NULL, &position.w, &position.h); - SDL_RenderCopy(renderer, texture, NULL, &position);*/ SDL_DestroyTexture(texture); } @@ -61,18 +59,21 @@ void SDL_DrawTextf(SDL_Renderer *renderer, TTF_Font *font, int x, int y, SDL_Col va_end(args); } -void SDL_LoadImage(SDL_Renderer *renderer, SDL_Texture **texture, char *path) { - SDL_Surface *imageSurface = IMG_Load(path); +void SDL_LoadImage(SDL_Texture **texture, char *path) { + SDL_Surface *image = NULL; - if (imageSurface) { - Uint32 colorkey = SDL_MapRGB(imageSurface->format, 0, 0, 0); - SDL_SetColorKey(imageSurface, SDL_TRUE, colorkey); - *texture = SDL_CreateTextureFromSurface(renderer, imageSurface); - } else { - printf("Failed to load image: %s", path); + image = IMG_Load(path); + if (!image) { + //DEBUG_LOG("IMG_Load failed: %s\n", IMG_GetError()); + printf("IMG_Load failed: %s\n", IMG_GetError()); + + return; } - - SDL_FreeSurface(imageSurface); + + SDL_ConvertSurfaceFormat(image, SDL_PIXELFORMAT_RGBA8888, 0); + *texture = SDL_CreateTextureFromSurface(RENDERER, image); + SDL_FreeSurface(image); + image = NULL; } void SDL_DrawImage(SDL_Renderer *renderer, SDL_Texture *texture, int x, int y) { diff --git a/source/main.cpp b/source/main.cpp index a2c791d..36096de 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -22,7 +22,6 @@ extern "C" { SDL_Renderer* RENDERER; SDL_Window* WINDOW; -//SDL_Surface* WINDOW_SURFACE; SDL_Event EVENT; TTF_Font *ARIAL, *ARIAL_35, *ARIAL_30, *ARIAL_27, *ARIAL_25, *ARIAL_20, *ARIAL_15; bool configDarkMode; diff --git a/source/menus/book-chooser/MenuChooser.cpp b/source/menus/book-chooser/MenuChooser.cpp index aecd3b9..a702b88 100644 --- a/source/menus/book-chooser/MenuChooser.cpp +++ b/source/menus/book-chooser/MenuChooser.cpp @@ -17,8 +17,8 @@ extern "C" { using namespace std; namespace fs = filesystem; -template bool contains(std::list & listOfElements, const T & element) { - auto it = std::find(listOfElements.begin(), listOfElements.end(), element); +template bool contains(list & listOfElements, const T & element) { + auto it = find(listOfElements.begin(), listOfElements.end(), element); return it != listOfElements.end(); } @@ -130,7 +130,7 @@ void Menu_StartChoosing() { } SDL_DrawText(RENDERER, ARIAL_25, windowX - 123, windowY - 45, textColor, "\"B\" - Exit"); - SDL_DrawText(RENDERER, ARIAL_25, windowX - 200, windowY - 35 * 2, textColor, "\"-\" - Switch theme"); + SDL_DrawText(RENDERER, ARIAL_25, windowX - 200, windowY - 80, textColor, "\"-\" - Switch theme"); int choosingIndex = 0; for (const auto & entry : fs::directory_iterator(path)) { @@ -144,11 +144,11 @@ void Menu_StartChoosing() { #ifdef EXPERIMENTAL if (contains(warnedExtentions, extention)) { - //SDL_DrawImage(RENDERER, warning, 5, 10 + (40 * choosingIndex)); + SDL_DrawImage(RENDERER, warning, 25, 18 + (40 * choosingIndex)); } #endif - SDL_DrawText(RENDERER, ARIAL_25, 50, 20 + (40 * choosingIndex), textColor, entry.path().filename().c_str()); + SDL_DrawText(RENDERER, ARIAL_25, 70, 20 + (40 * choosingIndex), textColor, entry.path().filename().c_str()); if (isWarningOnScreen) { if (!configDarkMode) { // Display a dimmed background if on light mode diff --git a/source/status_bar.c b/source/status_bar.c index 6d07133..e5fa8fc 100644 --- a/source/status_bar.c +++ b/source/status_bar.c @@ -88,12 +88,12 @@ static void StatusBar_GetBatteryStatus(int x, int y) { } snprintf(buf, 5, "%d%%", percent); - TTF_SizeText(ARIAL_15, buf, &width, NULL); - SDL_DrawText(RENDERER, ARIAL_15, (x - width - 10), y, WHITE, buf); + TTF_SizeText(ARIAL_20, buf, &width, NULL); + SDL_DrawText(RENDERER, ARIAL_20, (x + width + 5), y, WHITE, buf); } else { snprintf(buf, 5, "%d%%", percent); - TTF_SizeText(ARIAL_15, buf, &width, NULL); - SDL_DrawText(RENDERER, ARIAL_15, (x - width - 10), y, WHITE, buf); + TTF_SizeText(ARIAL_20, buf, &width, NULL); + SDL_DrawText(RENDERER, ARIAL_20, (x + width + 5), y, WHITE, buf); SDL_DrawImage(RENDERER, battery_unknown, x, 1); } } @@ -104,9 +104,6 @@ void StatusBar_DisplayTime(bool portriat) { int helpWidth, helpHeight; TTF_SizeText(ARIAL_20, "\"+\" - Help", &helpWidth, &helpHeight); - #ifdef EXPERIMENTAL - //StatusBar_GetBatteryStatus(1260 - width - 44, (40 - height) / 2); - #endif if (portriat) { int timeX = (1280 - timeWidth) + timeHeight; int timeY = (720 - timeWidth) + 15; @@ -121,5 +118,11 @@ void StatusBar_DisplayTime(bool portriat) { SDL_DrawText(RENDERER, ARIAL_25, 1260 - timeWidth, (40 - timeHeight) / 2, WHITE, Clock_GetCurrentTime()); SDL_DrawText(RENDERER, ARIAL_20, 1260 - helpWidth - timeWidth - 25, (40 - helpHeight) / 2, WHITE, "\"+\" - Help"); - } + + StatusBar_GetBatteryStatus(1260 - (timeWidth + helpWidth) - 110, (40 - timeHeight) / 2 + 15); // 34 is height of battery img + } + + #ifdef EXPERIMENTAL + + #endif } \ No newline at end of file diff --git a/source/textures.c b/source/textures.c index d5392c1..7a3a402 100644 --- a/source/textures.c +++ b/source/textures.c @@ -4,71 +4,35 @@ SDL_Texture *battery_20, *battery_20_charging, *battery_30, *battery_30_charging, *battery_50, *battery_50_charging, \ *battery_60, *battery_60_charging, *battery_80, *battery_80_charging, *battery_90, *battery_90_charging, \ - *battery_full, *battery_full_charging, *battery_low, *battery_unknown, *error, *warning; + *battery_full, *battery_full_charging, *battery_low, *battery_unknown, *error, *warning, *button_a, *button_b, \ + *button_x, *button_y, *button_down, *button_up, *button_left, *button_right, *button_lb, *button_rb, *button_lt, \ + *button_rt, *button_minus, *button_plus, *button_capture, *button_home; void Textures_Load(void) { - /*SDL_LoadImage(RENDERER, &battery_20, "romfs:/resources/images/battery_20.png"); - SDL_LoadImage(RENDERER, &battery_20_charging, "romfs:/resources/images/battery_20_charging.png"); - SDL_LoadImage(RENDERER, &battery_30, "romfs:/resources/images/battery_30.png"); - SDL_LoadImage(RENDERER, &battery_30_charging, "romfs:/resources/images/battery_30_charging.png"); - SDL_LoadImage(RENDERER, &battery_50, "romfs:/resources/images/battery_50.png"); - SDL_LoadImage(RENDERER, &battery_50_charging, "romfs:/resources/images/battery_50_charging.png"); - SDL_LoadImage(RENDERER, &battery_60, "romfs:/resources/images/battery_60.png"); - SDL_LoadImage(RENDERER, &battery_60_charging, "romfs:/resources/images/battery_60_charging.png"); - SDL_LoadImage(RENDERER, &battery_80, "romfs:/resources/images/battery_80.png"); - SDL_LoadImage(RENDERER, &battery_80_charging, "romfs:/resources/images/battery_80_charging.png"); - SDL_LoadImage(RENDERER, &battery_90, "romfs:/resources/images/battery_90.png"); - SDL_LoadImage(RENDERER, &battery_90_charging, "romfs:/resources/images/battery_90_charging.png"); - SDL_LoadImage(RENDERER, &battery_full, "romfs:/resources/images/battery_full.png"); - SDL_LoadImage(RENDERER, &battery_full_charging, "romfs:/resources/images/battery_full_charging.png"); - SDL_LoadImage(RENDERER, &battery_low, "romfs:/resources/images/battery_low.png"); - SDL_LoadImage(RENDERER, &battery_unknown, "romfs:/resources/images/battery_unknown.png");*/ - //SDL_LoadImage(RENDERER, &error, "romfs:/resources/images/error.png"); - - fprintf(stderr, "LOADING WARNING\n"); - SDL_Surface *imageSurface = IMG_Load("romfs:/resources/images/warning.png"); - fprintf(stderr, "LOADED WARNING\n"); - - if (RENDERER) { - if (imageSurface) { - fprintf(stderr, "CREATING TEXTURE\n"); - warning = SDL_CreateTextureFromSurface(RENDERER, imageSurface); - fprintf(stderr, "CREATED TEXTURE\n"); - - if (warning == NULL) { - fprintf(stderr, "CreateTextureFromSurface failed: %s\n", SDL_GetError()); - exit(1); - } else { - fprintf(stderr, "Loaded \"romfs:/resources/images/warning.png\"\n"); - } - } else { - fprintf(stderr, "Failed to load image: \"romfs:/resources/images/warning.png\"\n"); - exit(1); - } - } else { - fprintf(stderr, "Something wrong with RENDERER"); - exit(1); - } - - SDL_FreeSurface(imageSurface); - - - /*if (imageSurface) { - Uint32 colorkey = SDL_MapRGB(imageSurface->format, 0, 0, 0); - SDL_SetColorKey(imageSurface, SDL_TRUE, colorkey); - warning = SDL_CreateTextureFromSurface(RENDERER, imageSurface); - } else { - printf("Failed to load image: %c", "romfs:/resources/images/warning.png"); - } - - SDL_FreeSurface(imageSurface);*/ - //SDL_LoadImage(RENDERER, &warning, "romfs:/resources/images/warning.png"); + SDL_LoadImage(&battery_20, "romfs:/resources/images/battery/battery_20.png"); + SDL_LoadImage(&battery_20_charging, "romfs:/resources/images/battery/battery_20_charging.png"); + SDL_LoadImage(&battery_30, "romfs:/resources/images/battery/battery_30.png"); + SDL_LoadImage(&battery_30_charging, "romfs:/resources/images/battery/battery/battery_30_charging.png"); + SDL_LoadImage(&battery_50, "romfs:/resources/images/battery/battery_50.png"); + SDL_LoadImage(&battery_50_charging, "romfs:/resources/images/battery/battery_50_charging.png"); + SDL_LoadImage(&battery_60, "romfs:/resources/images/battery/battery_60.png"); + SDL_LoadImage(&battery_60_charging, "romfs:/resources/images/battery/battery_60_charging.png"); + SDL_LoadImage(&battery_80, "romfs:/resources/images/battery/battery_80.png"); + SDL_LoadImage(&battery_80_charging, "romfs:/resources/images/battery/battery_80_charging.png"); + SDL_LoadImage(&battery_90, "romfs:/resources/images/battery/battery_90.png"); + SDL_LoadImage(&battery_90_charging, "romfs:/resources/images/battery/battery_90_charging.png"); + SDL_LoadImage(&battery_full, "romfs:/resources/images/battery/battery_full.png"); + SDL_LoadImage(&battery_full_charging, "romfs:/resources/images/battery/battery_full_charging.png"); + SDL_LoadImage(&battery_low, "romfs:/resources/images/battery/battery_low.png"); + SDL_LoadImage(&battery_unknown, "romfs:/resources/images/battery/battery_unknown.png"); + SDL_LoadImage(&error, "romfs:/resources/images/info/error.png"); + SDL_LoadImage(&warning, "romfs:/resources/images/info/warning.png"); } void Textures_Free(void) { SDL_DestroyTexture(warning); - //SDL_DestroyTexture(error); - /*SDL_DestroyTexture(battery_unknown); + SDL_DestroyTexture(error); + SDL_DestroyTexture(battery_unknown); SDL_DestroyTexture(battery_low); SDL_DestroyTexture(battery_full_charging); SDL_DestroyTexture(battery_full); @@ -82,5 +46,5 @@ void Textures_Free(void) { SDL_DestroyTexture(battery_30_charging); SDL_DestroyTexture(battery_30); SDL_DestroyTexture(battery_20_charging); - SDL_DestroyTexture(battery_20);*/ + SDL_DestroyTexture(battery_20); } \ No newline at end of file