From b3847817f4af87c1e8c1cda2444dc7eb43276e91 Mon Sep 17 00:00:00 2001 From: Question Date: Thu, 29 Jul 2021 09:03:36 -0500 Subject: [PATCH] Some tweaks on the touch controls --- Makefile | 2 +- README.md | 2 +- source/menus/book/menu_book_reader.cpp | 13 +++++++------ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 98d26e6..3016e9e 100644 --- a/Makefile +++ b/Makefile @@ -45,7 +45,7 @@ INCLUDES := include include/menus/book include/menus/book-chooser include/he ROMFS := romfs VERSION_MAJOR := 0 -VERSION_MINOR := 3 +VERSION_MINOR := 4 VERSION_MICRO := 0 APP_TITLE := eBookReader diff --git a/README.md b/README.md index e9af6c7..47a8d04 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ Light Mode Landscape Reading: * NX-Shell Team - A good amount of the code is from an old version of their application. ### Building -* Release built with [libnx release v2.4.0](https://github.com/switchbrew/libnx). +* Release built with [libnx release v4.1.3](https://github.com/switchbrew/libnx). * Uses `freetype` and other libs which comes with `switch-portlibs` via `devkitPro pacman`: ``` pacman -S libnx switch-portlibs diff --git a/source/menus/book/menu_book_reader.cpp b/source/menus/book/menu_book_reader.cpp index 5a80c32..1947a26 100644 --- a/source/menus/book/menu_book_reader.cpp +++ b/source/menus/book/menu_book_reader.cpp @@ -47,29 +47,29 @@ void Menu_OpenBook(char *path) { if(hidGetTouchScreenStates(&state, 1)) { if(state.count != prev_touchcount) { prev_touchcount = state.count; - } + } } for(s32 i=0; i 1000) + if (state.touches[i].x > 1000 && (state.touches[i].y > 200 && state.touches[i].y < 500)) if (reader->currentPageLayout() == BookPageLayoutPortrait) reader->next_page(1); else if (reader->currentPageLayout() == BookPageLayoutLandscape) reader->zoom_in(); - if (state.touches[i].x < 280) + if (state.touches[i].x < 280 && (state.touches[i].y > 200 && state.touches[i].y < 500)) if (reader->currentPageLayout() == BookPageLayoutPortrait) reader->previous_page(1); else if (reader->currentPageLayout() == BookPageLayoutLandscape) reader->zoom_out(); - if (state.touches[i].y < 200 && (state.touches[i].x > 280 || state.touches[i].x < 1000)) + if (state.touches[i].y < 200) if (reader->currentPageLayout() == BookPageLayoutPortrait) reader->zoom_in(); else if (reader->currentPageLayout() == BookPageLayoutLandscape) reader->previous_page(1); - if (state.touches[i].y > 500 && (state.touches[i].x > 280 || state.touches[i].x < 1000)) + if (state.touches[i].y > 500) if (reader->currentPageLayout() == BookPageLayoutPortrait) reader->zoom_out(); else if (reader->currentPageLayout() == BookPageLayoutLandscape) @@ -137,7 +137,7 @@ void Menu_OpenBook(char *path) { else if (!helpMenu && kDown & HidNpadButton_LeftSL) reader->previous_page(10); - if (kDown & HidNpadButton_B) { + if (kUp & HidNpadButton_B) { if (helpMenu) { helpMenu = !helpMenu; } else { @@ -191,4 +191,5 @@ void Menu_OpenBook(char *path) { std::cout << "Opening chooser" << std::endl; Menu_StartChoosing(); delete reader; + // consoleExit(NULL); }