51 lines
1.4 KiB
C++
51 lines
1.4 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 <string>
|
|
#include <utility>
|
|
|
|
#include "EndOfBookOptions.h"
|
|
#include "activities/Activity.h"
|
|
|
|
class XtcReaderActivity final : public Activity {
|
|
std::shared_ptr<Xtc> xtc;
|
|
|
|
uint32_t currentPage = 0;
|
|
int pagesUntilFullRefresh = 0;
|
|
// Next-book suggestion menu for the End-of-Book screen
|
|
EndOfBookOptions endOfBookOptions;
|
|
|
|
enum class StatusBarOverlayPosition { Bottom, Top };
|
|
struct StatusBarInfo {
|
|
int currentPage;
|
|
int pageCount;
|
|
std::string title;
|
|
};
|
|
|
|
void renderPage();
|
|
// Opens chapter selection when the book has chapters (short-press Confirm); no-op otherwise
|
|
void openChapterSelection();
|
|
void renderStatusBarOverlay(StatusBarOverlayPosition position) const;
|
|
StatusBarInfo getStatusBarInfo() const;
|
|
void saveProgress() const;
|
|
void loadProgress();
|
|
|
|
public:
|
|
explicit XtcReaderActivity(GfxRenderer& renderer, MappedInputManager& mappedInput, std::unique_ptr<Xtc> xtc)
|
|
: Activity("XtcReader", renderer, mappedInput), xtc(std::move(xtc)) {}
|
|
void onEnter() override;
|
|
void onExit() override;
|
|
void loop() override;
|
|
void render(RenderLock&&) override;
|
|
bool isReaderActivity() const override { return true; }
|
|
ScreenshotInfo getScreenshotInfo() const override;
|
|
};
|