Save book pages, add icon img
This commit is contained in:
parent
bb89a481a4
commit
48f0aedfcb
7
Makefile
7
Makefile
|
@ -46,11 +46,12 @@ ROMFS := romfs
|
||||||
|
|
||||||
VERSION_MAJOR := 0
|
VERSION_MAJOR := 0
|
||||||
VERSION_MINOR := 2
|
VERSION_MINOR := 2
|
||||||
VERSION_MICRO := 0
|
VERSION_MICRO := 1
|
||||||
|
|
||||||
APP_TITLE := eBookReader
|
APP_TITLE := eBookReader
|
||||||
APP_AUTHOR := SeanOMik
|
APP_AUTHOR := SeanOMik
|
||||||
APP_VERSION := ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_MICRO}-beta
|
APP_VERSION := ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_MICRO}-beta
|
||||||
|
ICON := icon.jpg
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# options for code generation
|
# options for code generation
|
||||||
|
@ -62,12 +63,12 @@ CFLAGS := -g -std=c++17 -Wall -O2 -ffunction-sections \
|
||||||
|
|
||||||
CFLAGS += -D__SWITCH__ $(INCLUDE) `sdl2-config --cflags`
|
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)
|
ASFLAGS := -g $(ARCH)
|
||||||
LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||||
|
|
||||||
LIBS := -lstdc++fs -lSDL2_ttf -lSDL2_image -lpng -ljpeg `sdl2-config --libs` -lfreetype -lwebp -lz -lbz2 -ltwili -lnx -lmupdf -lmupdf-third
|
LIBS := -lstdc++fs -lSDL2_ttf -lSDL2_image -lpng -ljpeg `sdl2-config --libs` -lfreetype -lwebp -lz -lbz2 -ltwili -lconfig -lnx -lmupdf -lmupdf-third #-lmupdf_core -lmupdf_thirdparty
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# list of directories containing libraries, this must be the top level containing
|
# list of directories containing libraries, this must be the top level containing
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 5.9 KiB |
|
@ -3,4 +3,6 @@
|
||||||
|
|
||||||
extern bool configDarkMode;
|
extern bool configDarkMode;
|
||||||
|
|
||||||
|
extern char* configFile;
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -129,7 +129,7 @@ void Menu_StartChoosing() {
|
||||||
configDarkMode = !configDarkMode;
|
configDarkMode = !configDarkMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_DrawText(RENDERER, ARIAL_25, windowX - 123, windowY - 35, textColor, "\"B\" - Exit");
|
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 - 35 * 2, textColor, "\"-\" - Switch theme");
|
||||||
|
|
||||||
int choosingIndex = 0;
|
int choosingIndex = 0;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
//#include <libconfig.h>
|
#include <libconfig.h>
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "SDL_helper.h"
|
#include "SDL_helper.h"
|
||||||
|
@ -14,13 +14,14 @@ extern "C" {
|
||||||
|
|
||||||
fz_context *ctx = NULL;
|
fz_context *ctx = NULL;
|
||||||
int windowX, windowY;
|
int windowX, windowY;
|
||||||
/*config_t *config = NULL;
|
config_t *config = NULL;
|
||||||
|
char* configFile = "/switch/eBookReader/saved_pages.cfg";
|
||||||
|
|
||||||
static int load_last_page(const char *book_name) {
|
static int load_last_page(const char *book_name) {
|
||||||
if (!config) {
|
if (!config) {
|
||||||
config = (config_t *)malloc(sizeof(config_t));
|
config = (config_t *)malloc(sizeof(config_t));
|
||||||
config_init(config);
|
config_init(config);
|
||||||
config_read_file(config, "/switch/NX-Shell/last_book_pages.cfg");
|
config_read_file(config, configFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
config_setting_t *setting = config_setting_get_member(config_root_setting(config), book_name);
|
config_setting_t *setting = config_setting_get_member(config_root_setting(config), book_name);
|
||||||
|
@ -41,9 +42,9 @@ static void save_last_page(const char *book_name, int current_page) {
|
||||||
|
|
||||||
if (setting) {
|
if (setting) {
|
||||||
config_setting_set_int(setting, current_page);
|
config_setting_set_int(setting, current_page);
|
||||||
config_write_file(config, "/switch/NX-Shell/last_book_pages.cfg");
|
config_write_file(config, configFile);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}*/
|
|
||||||
|
|
||||||
BookReader::BookReader(const char *path) {
|
BookReader::BookReader(const char *path) {
|
||||||
if (ctx == NULL) {
|
if (ctx == NULL) {
|
||||||
|
@ -60,10 +61,11 @@ BookReader::BookReader(const char *path) {
|
||||||
book_name.erase(std::remove(book_name.begin(), book_name.end(), c), book_name.end());
|
book_name.erase(std::remove(book_name.begin(), book_name.end(), c), book_name.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::cout << "fz_open_document" << std::endl;
|
||||||
doc = fz_open_document(ctx, path);
|
doc = fz_open_document(ctx, path);
|
||||||
|
|
||||||
//int current_page = load_last_page(book_name.c_str());
|
int current_page = load_last_page(book_name.c_str());
|
||||||
int current_page = 0;
|
//int current_page = 0;
|
||||||
switch_current_page_layout(_currentPageLayout, current_page);
|
switch_current_page_layout(_currentPageLayout, current_page);
|
||||||
|
|
||||||
if (current_page > 0) {
|
if (current_page > 0) {
|
||||||
|
@ -80,13 +82,13 @@ BookReader::~BookReader() {
|
||||||
void BookReader::previous_page(int n) {
|
void BookReader::previous_page(int n) {
|
||||||
layout->previous_page(n);
|
layout->previous_page(n);
|
||||||
show_status_bar();
|
show_status_bar();
|
||||||
//save_last_page(book_name.c_str(), layout->current_page());
|
save_last_page(book_name.c_str(), layout->current_page());
|
||||||
}
|
}
|
||||||
|
|
||||||
void BookReader::next_page(int n) {
|
void BookReader::next_page(int n) {
|
||||||
layout->next_page(n);
|
layout->next_page(n);
|
||||||
show_status_bar();
|
show_status_bar();
|
||||||
//save_last_page(book_name.c_str(), layout->current_page());
|
save_last_page(book_name.c_str(), layout->current_page());
|
||||||
}
|
}
|
||||||
|
|
||||||
void BookReader::zoom_in() {
|
void BookReader::zoom_in() {
|
||||||
|
|
|
@ -17,7 +17,6 @@ void Menu_OpenBook(char *path) {
|
||||||
|
|
||||||
bool helpMenu = false;
|
bool helpMenu = false;
|
||||||
|
|
||||||
|
|
||||||
while(appletMainLoop()) {
|
while(appletMainLoop()) {
|
||||||
reader->draw(helpMenu);
|
reader->draw(helpMenu);
|
||||||
|
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 45 KiB |
Loading…
Reference in New Issue