Files
Crosspoint/src/activities/reader/XtcReaderActivity.h
T
Chun Ming LeeandZach Nelson 29fd29f537 feat: Status bar for XTC files (#1849)
## Summary
Add ability to show a status bar for 1-bit XTC files  (closes #1848) 

Overlays a status bar (similar style to that for epubs) over the image.
Defaults to hidden, users can set to show and either top or bottom of
the screen within "Customize Status Bar" reader settings.

I've leaned toward a simple overlay approach rather than trying anything
clever e.g. resizing the original image or allowing for shifting the
image around. I think it's more straight forward for the user to create
a buffer zone when generating the XTC files.

For 2-bit image files, it'd require more work to handle the multiple
render passes so I'm holding off on that.

Sample from a Japanese text XTC
<img width="400" height="600" alt="image"
src="https://github.com/user-attachments/assets/03ac67cf-acec-4b49-969f-73e3656760ce"
/>

### AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing,
please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? _**< YES | PARTIALLY | NO
>**_
YES - Codex

---------

Co-authored-by: Zach Nelson <zach@zdnelson.com>
2026-05-08 14:34:42 -05:00

46 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 <string>
#include <utility>
#include "activities/Activity.h"
class XtcReaderActivity final : public Activity {
std::shared_ptr<Xtc> xtc;
uint32_t currentPage = 0;
int pagesUntilFullRefresh = 0;
enum class StatusBarOverlayPosition { Bottom, Top };
struct StatusBarInfo {
int currentPage;
int pageCount;
std::string title;
};
void renderPage();
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;
};