#pragma once #include #include #include #include #include #include "Screen.h" class EpubReaderChapterSelectionScreen final : public Screen { std::shared_ptr epub; TaskHandle_t displayTaskHandle = nullptr; SemaphoreHandle_t renderingMutex = nullptr; int currentSpineIndex = 0; int selectorIndex = 0; bool updateRequired = false; const std::function onGoBack; const std::function onSelectSpineIndex; static void taskTrampoline(void* param); [[noreturn]] void displayTaskLoop(); void renderScreen(); public: explicit EpubReaderChapterSelectionScreen(GfxRenderer& renderer, InputManager& inputManager, const std::shared_ptr& epub, const int currentSpineIndex, const std::function& onGoBack, const std::function& onSelectSpineIndex) : Screen(renderer, inputManager), epub(epub), currentSpineIndex(currentSpineIndex), onGoBack(onGoBack), onSelectSpineIndex(onSelectSpineIndex) {} void onEnter() override; void onExit() override; void handleInput() override; };