Interactive menu shown when reaching the end of a book with options: Archive Book, Delete Book, Back to Beginning, Close Book, Close Menu. Wired into EpubReaderActivity, XtcReaderActivity, and TxtReaderActivity (TXT shows menu when user tries to advance past the last page). Co-authored-by: Cursor <cursoragent@cursor.com>
40 lines
1.1 KiB
C++
40 lines
1.1 KiB
C++
/**
|
|
* XtcReaderActivity.h
|
|
*
|
|
* XTC ebook reader activity for CrossPoint Reader
|
|
* Displays pre-rendered XTC pages on e-ink display
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <Xtc.h>
|
|
|
|
#include "activities/ActivityWithSubactivity.h"
|
|
|
|
class XtcReaderActivity final : public ActivityWithSubactivity {
|
|
std::shared_ptr<Xtc> xtc;
|
|
|
|
uint32_t currentPage = 0;
|
|
int pagesUntilFullRefresh = 0;
|
|
|
|
bool endOfBookMenuOpened = false;
|
|
const std::function<void()> onGoBack;
|
|
const std::function<void()> onGoHome;
|
|
|
|
void renderPage();
|
|
void saveProgress() const;
|
|
void loadProgress();
|
|
|
|
public:
|
|
explicit XtcReaderActivity(GfxRenderer& renderer, MappedInputManager& mappedInput, std::unique_ptr<Xtc> xtc,
|
|
const std::function<void()>& onGoBack, const std::function<void()>& onGoHome)
|
|
: ActivityWithSubactivity("XtcReader", renderer, mappedInput),
|
|
xtc(std::move(xtc)),
|
|
onGoBack(onGoBack),
|
|
onGoHome(onGoHome) {}
|
|
void onEnter() override;
|
|
void onExit() override;
|
|
void loop() override;
|
|
void render(Activity::RenderLock&&) override;
|
|
};
|