diff --git a/Makefile b/Makefile index d47a1a2..cf425b8 100644 --- a/Makefile +++ b/Makefile @@ -39,9 +39,9 @@ include $(DEVKITPRO)/libnx/switch_rules #--------------------------------------------------------------------------------- TARGET := $(notdir $(CURDIR)) BUILD := build -SOURCES := source source/menus/book source/menus/book-chooser +SOURCES := source source/menus/book source/menus/book-chooser source/helpers DATA := data -INCLUDES := include include/menus/book include/menus/book-chooser +INCLUDES := include include/menus/book include/menus/book-chooser include/helpers ROMFS := romfs VERSION_MAJOR := 0 @@ -67,11 +67,7 @@ CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions ASFLAGS := -g $(ARCH) LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) -#LIBS := `sdl2-config --libs` -lSDL2_ttf -lSDL2_image -#LIBS := `aarch64-none-elf-pkg-config --libs sdl2 SDL2_ttf SDL2_mixer` -#LIBS := `sdl2-config --libs` -lSDL2_ttf -lSDL2_image -lfreetype -lz -lnx LIBS := -lstdc++fs `sdl2-config --libs` -lSDL2_ttf -lSDL2_image -lfreetype -lpng -ljpeg -lwebp -lz -lbz2 -ltwili -lnx -lmupdf -lmupdf-third -#LIBS := `aarch64-none-elf-pkg-config --libs sdl2` -lSDL2_ttf #-lSDL2_image -lmupdf -lmupdf-third #--------------------------------------------------------------------------------- # list of directories containing libraries, this must be the top level containing @@ -79,7 +75,6 @@ LIBS := -lstdc++fs `sdl2-config --libs` -lSDL2_ttf -lSDL2_image -lfreetype - #--------------------------------------------------------------------------------- LIBDIRS := $(PORTLIBS) $(LIBNX) - #--------------------------------------------------------------------------------- # no real need to edit anything past this point unless you need to add additional # rules for different file extensions @@ -231,4 +226,4 @@ $(OFILES_SRC) : $(HFILES_BIN) #--------------------------------------------------------------------------------------- endif -#--------------------------------------------------------------------------------------- +#--------------------------------------------------------------------------------------- \ No newline at end of file diff --git a/include/common.h b/include/common.h index a93be0d..bb34aa4 100644 --- a/include/common.h +++ b/include/common.h @@ -3,7 +3,7 @@ #include #include -#include "SDL_helper.h" +//#include "SDL_helper.h" extern SDL_Window *WINDOW; extern SDL_Surface *WINDOW_SURFACE; diff --git a/include/SDL_helper.h b/include/helpers/SDL_helper.h similarity index 84% rename from include/SDL_helper.h rename to include/helpers/SDL_helper.h index a831844..579298d 100644 --- a/include/SDL_helper.h +++ b/include/helpers/SDL_helper.h @@ -4,27 +4,25 @@ #include #include -static inline SDL_Color SDL_MakeColour(Uint8 r, Uint8 g, Uint8 b, Uint8 a) -{ +static inline SDL_Color SDL_MakeColour(Uint8 r, Uint8 g, Uint8 b, Uint8 a) { SDL_Color colour = {r, g, b, a}; return colour; } #define WHITE SDL_MakeColour(255, 255, 255, 255) -#define VERY_LIGHT_GRAY SDL_MakeColour(222, 222, 222, 255) +#define BLACK SDL_MakeColour(0, 0, 0, 255) #define LIGHT_GRAY SDL_MakeColour(181, 181, 181, 255) #define DARK_GRAY SDL_MakeColour(148, 148, 148, 255) #define BLACK_BG SDL_MakeColour(48, 48, 48, 255) -#define STATUS_BAR_LIGHT SDL_MakeColour(37, 79, 174, 255) -#define STATUS_BAR_DARK SDL_MakeColour(38, 50, 56, 255) -#define MENU_BAR_LIGHT SDL_MakeColour(51, 103, 214, 255) -#define MENU_BAR_DARK SDL_MakeColour(55, 71, 79, 255) -#define BLACK SDL_MakeColour(0, 0, 0, 255) +#define STATUS_BAR_LIGHT SDL_MakeColour(240, 43, 43, 255) +#define STATUS_BAR_DARK SDL_MakeColour(163, 20, 20, 255) +#define MENU_BAR_LIGHT SDL_MakeColour(240, 43, 43, 255) +#define MENU_BAR_DARK SDL_MakeColour(163, 20, 20, 255) +#define TEXT_MIN_COLOUR_LIGHT SDL_MakeColour(32, 32, 32, 255) #define SELECTOR_COLOUR_LIGHT SDL_MakeColour(241, 241, 241, 255) #define SELECTOR_COLOUR_DARK SDL_MakeColour(76, 76, 76, 255) #define TITLE_COLOUR SDL_MakeColour(30, 136, 229, 255) #define TITLE_COLOUR_DARK SDL_MakeColour(0, 150, 136, 255) -#define TEXT_MIN_COLOUR_LIGHT SDL_MakeColour(32, 32, 32, 255) #define TEXT_MIN_COLOUR_DARK SDL_MakeColour(185, 185, 185, 255) #define BAR_COLOUR SDL_MakeColour(200, 200, 200, 255) diff --git a/include/textures.h b/include/textures.h index 90f4206..dc54758 100644 --- a/include/textures.h +++ b/include/textures.h @@ -1,5 +1,5 @@ -#ifndef NX_SHELL_TEXTURES_H -#define NX_SHELL_TEXTURES_H +#ifndef EBOOK_READER_TEXTURES_H +#define EBOOK_READER_TEXTURES_H #include diff --git a/romfs/arial.ttf b/romfs/resources/font/arial.ttf similarity index 100% rename from romfs/arial.ttf rename to romfs/resources/font/arial.ttf diff --git a/romfs/battery_20.png b/romfs/resources/images/battery_20.png similarity index 100% rename from romfs/battery_20.png rename to romfs/resources/images/battery_20.png diff --git a/romfs/battery_20_charging.png b/romfs/resources/images/battery_20_charging.png similarity index 100% rename from romfs/battery_20_charging.png rename to romfs/resources/images/battery_20_charging.png diff --git a/romfs/battery_30.png b/romfs/resources/images/battery_30.png similarity index 100% rename from romfs/battery_30.png rename to romfs/resources/images/battery_30.png diff --git a/romfs/battery_30_charging.png b/romfs/resources/images/battery_30_charging.png similarity index 100% rename from romfs/battery_30_charging.png rename to romfs/resources/images/battery_30_charging.png diff --git a/romfs/battery_50.png b/romfs/resources/images/battery_50.png similarity index 100% rename from romfs/battery_50.png rename to romfs/resources/images/battery_50.png diff --git a/romfs/battery_50_charging.png b/romfs/resources/images/battery_50_charging.png similarity index 100% rename from romfs/battery_50_charging.png rename to romfs/resources/images/battery_50_charging.png diff --git a/romfs/battery_60.png b/romfs/resources/images/battery_60.png similarity index 100% rename from romfs/battery_60.png rename to romfs/resources/images/battery_60.png diff --git a/romfs/battery_60_charging.png b/romfs/resources/images/battery_60_charging.png similarity index 100% rename from romfs/battery_60_charging.png rename to romfs/resources/images/battery_60_charging.png diff --git a/romfs/battery_80.png b/romfs/resources/images/battery_80.png similarity index 100% rename from romfs/battery_80.png rename to romfs/resources/images/battery_80.png diff --git a/romfs/battery_80_charging.png b/romfs/resources/images/battery_80_charging.png similarity index 100% rename from romfs/battery_80_charging.png rename to romfs/resources/images/battery_80_charging.png diff --git a/romfs/battery_90.png b/romfs/resources/images/battery_90.png similarity index 100% rename from romfs/battery_90.png rename to romfs/resources/images/battery_90.png diff --git a/romfs/battery_90_charging.png b/romfs/resources/images/battery_90_charging.png similarity index 100% rename from romfs/battery_90_charging.png rename to romfs/resources/images/battery_90_charging.png diff --git a/romfs/battery_full.png b/romfs/resources/images/battery_full.png similarity index 100% rename from romfs/battery_full.png rename to romfs/resources/images/battery_full.png diff --git a/romfs/battery_full_charging.png b/romfs/resources/images/battery_full_charging.png similarity index 100% rename from romfs/battery_full_charging.png rename to romfs/resources/images/battery_full_charging.png diff --git a/romfs/battery_low.png b/romfs/resources/images/battery_low.png similarity index 100% rename from romfs/battery_low.png rename to romfs/resources/images/battery_low.png diff --git a/romfs/battery_unknown.png b/romfs/resources/images/battery_unknown.png similarity index 100% rename from romfs/battery_unknown.png rename to romfs/resources/images/battery_unknown.png diff --git a/source/SDL_helper.c b/source/helpers/SDL_helper.c similarity index 99% rename from source/SDL_helper.c rename to source/helpers/SDL_helper.c index ba847da..ca859fa 100644 --- a/source/SDL_helper.c +++ b/source/helpers/SDL_helper.c @@ -1,5 +1,5 @@ -#include "SDL_helper.h" #include "common.h" +#include "SDL_helper.h" void SDL_ClearScreen(SDL_Renderer *renderer, SDL_Color colour) { SDL_SetRenderDrawColor(renderer, colour.r, colour.g, colour.b, colour.a); @@ -65,4 +65,4 @@ void SDL_DrawImageScale(SDL_Renderer *renderer, SDL_Texture *texture, int x, int SDL_Rect position; position.x = x; position.y = y; position.w = w; position.h = h; SDL_RenderCopy(renderer, texture, NULL, &position); -} +} \ No newline at end of file diff --git a/source/main.cpp b/source/main.cpp index a5cacfe..376e60e 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -84,7 +84,7 @@ void Init_Services() { Textures_Load(); std::cout << "Loaded Textures" << std::endl;*/ - ARIAL = TTF_OpenFont("romfs:/arial.ttf", 35); + ARIAL = TTF_OpenFont("romfs:/resources/images/arial.ttf", 35); if (!ARIAL) { Term_Services(); } diff --git a/source/menus/book-chooser/MenuChooser.cpp b/source/menus/book-chooser/MenuChooser.cpp index 815d3ca..90cb7ad 100644 --- a/source/menus/book-chooser/MenuChooser.cpp +++ b/source/menus/book-chooser/MenuChooser.cpp @@ -71,7 +71,7 @@ void Menu_StartChoosing() { string extention = filename.substr(filename.length() - 3); if (extention == "pdf") { if (choosenIndex == space_index) { - SDL_DrawRect(RENDERER, 15, 20 + (40 * space_index), 1265, 40, VERY_LIGHT_GRAY); + SDL_DrawRect(RENDERER, 15, 20 + (40 * space_index), 1265, 40, SELECTOR_COLOUR_LIGHT); } SDL_DrawText(RENDERER, ARIAL, 20, 20 + (40 * space_index), BLACK, entry.path().filename().c_str()); diff --git a/source/menus/book/BookReader.cpp b/source/menus/book/BookReader.cpp index c429393..ea98af5 100644 --- a/source/menus/book/BookReader.cpp +++ b/source/menus/book/BookReader.cpp @@ -5,11 +5,11 @@ #include //#include -extern "C" { +//extern "C" { #include "SDL_helper.h" #include "status_bar.h" //#include "config.h" -} +//} fz_context *ctx = NULL; /*config_t *config = NULL; @@ -131,7 +131,7 @@ void BookReader::draw() { /*if (config_dark_theme == true) SDL_ClearScreen(RENDERER, SDL_MakeColour(33, 39, 43, 255)); else */ - SDL_ClearScreen(RENDERER, SDL_MakeColour(255, 255, 255, 255)); + SDL_ClearScreen(RENDERER, WHITE); SDL_RenderClear(RENDERER); diff --git a/source/textures.c b/source/textures.c index 9aa2364..00c80e1 100644 --- a/source/textures.c +++ b/source/textures.c @@ -3,22 +3,22 @@ #include "SDL_helper.h" void Textures_Load(void) { - SDL_LoadImage(RENDERER, &battery_20, "romfs:/battery_20.png"); - SDL_LoadImage(RENDERER, &battery_20_charging, "romfs:/battery_20_charging.png"); - SDL_LoadImage(RENDERER, &battery_30, "romfs:/battery_30.png"); - SDL_LoadImage(RENDERER, &battery_30_charging, "romfs:/battery_30_charging.png"); - SDL_LoadImage(RENDERER, &battery_50, "romfs:/battery_50.png"); - SDL_LoadImage(RENDERER, &battery_50_charging, "romfs:/battery_50_charging.png"); - SDL_LoadImage(RENDERER, &battery_60, "romfs:/battery_60.png"); - SDL_LoadImage(RENDERER, &battery_60_charging, "romfs:/battery_60_charging.png"); - SDL_LoadImage(RENDERER, &battery_80, "romfs:/battery_80.png"); - SDL_LoadImage(RENDERER, &battery_80_charging, "romfs:/battery_80_charging.png"); - SDL_LoadImage(RENDERER, &battery_90, "romfs:/battery_90.png"); - SDL_LoadImage(RENDERER, &battery_90_charging, "romfs:/battery_90_charging.png"); - SDL_LoadImage(RENDERER, &battery_full, "romfs:/battery_full.png"); - SDL_LoadImage(RENDERER, &battery_full_charging, "romfs:/battery_full_charging.png"); - SDL_LoadImage(RENDERER, &battery_low, "romfs:/battery_low.png"); - SDL_LoadImage(RENDERER, &battery_unknown, "romfs:/battery_unknown.png"); + SDL_LoadImage(RENDERER, &battery_20, "romfs:/resources/images/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"); } void Textures_Free(void) {