mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2025-12-16 22:27:42 +03:00
Bump page file version
This commit is contained in:
parent
7c852cf7d1
commit
492c6fd23e
@ -28,7 +28,7 @@ class EpubHtmlParserSlim {
|
||||
int partWordBufferIndex = 0;
|
||||
std::unique_ptr<ParsedText> currentTextBlock = nullptr;
|
||||
std::unique_ptr<Page> currentPage = nullptr;
|
||||
int currentPageNextY = 0;
|
||||
int16_t currentPageNextY = 0;
|
||||
int fontId;
|
||||
float lineCompression;
|
||||
int marginTop;
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
#include <HardwareSerial.h>
|
||||
#include <Serialization.h>
|
||||
|
||||
constexpr uint8_t PAGE_FILE_VERSION = 2;
|
||||
constexpr uint8_t PAGE_FILE_VERSION = 3;
|
||||
|
||||
void PageLine::render(GfxRenderer& renderer, const int fontId) { block->render(renderer, fontId, xPos, yPos); }
|
||||
|
||||
@ -16,8 +16,8 @@ void PageLine::serialize(std::ostream& os) {
|
||||
}
|
||||
|
||||
std::unique_ptr<PageLine> PageLine::deserialize(std::istream& is) {
|
||||
int32_t xPos;
|
||||
int32_t yPos;
|
||||
int16_t xPos;
|
||||
int16_t yPos;
|
||||
serialization::readPod(is, xPos);
|
||||
serialization::readPod(is, yPos);
|
||||
|
||||
@ -26,7 +26,7 @@ std::unique_ptr<PageLine> PageLine::deserialize(std::istream& is) {
|
||||
}
|
||||
|
||||
void Page::render(GfxRenderer& renderer, const int fontId) const {
|
||||
for (const auto element : elements) {
|
||||
for (auto& element : elements) {
|
||||
element->render(renderer, fontId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,9 +11,9 @@ enum PageElementTag : uint8_t {
|
||||
// represents something that has been added to a page
|
||||
class PageElement {
|
||||
public:
|
||||
int xPos;
|
||||
int yPos;
|
||||
explicit PageElement(const int xPos, const int yPos) : xPos(xPos), yPos(yPos) {}
|
||||
int16_t xPos;
|
||||
int16_t yPos;
|
||||
explicit PageElement(const int16_t xPos, const int16_t yPos) : xPos(xPos), yPos(yPos) {}
|
||||
virtual ~PageElement() = default;
|
||||
virtual void render(GfxRenderer& renderer, int fontId) = 0;
|
||||
virtual void serialize(std::ostream& os) = 0;
|
||||
@ -24,7 +24,7 @@ class PageLine final : public PageElement {
|
||||
std::shared_ptr<TextBlock> block;
|
||||
|
||||
public:
|
||||
PageLine(std::shared_ptr<TextBlock> block, const int xPos, const int yPos)
|
||||
PageLine(std::shared_ptr<TextBlock> block, const int16_t xPos, const int16_t yPos)
|
||||
: PageElement(xPos, yPos), block(std::move(block)) {}
|
||||
void render(GfxRenderer& renderer, int fontId) override;
|
||||
void serialize(std::ostream& os) override;
|
||||
|
||||
@ -171,11 +171,7 @@ void onGoHome() {
|
||||
}
|
||||
|
||||
void setup() {
|
||||
// Begin serial only if USB connected
|
||||
pinMode(UART0_RXD, INPUT);
|
||||
if (digitalRead(UART0_RXD) == HIGH) {
|
||||
Serial.begin(115200);
|
||||
}
|
||||
Serial.begin(115200);
|
||||
|
||||
Serial.printf("[%lu] [ ] Starting CrossPoint version " CROSSPOINT_VERSION "\n", millis());
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user