commit ccea9fd2943607fe164d9fd4d65eebb3ca2baf86
Author: Jon Bell <jondbell@protonmail.com>
AuthorDate: Sat Apr 18 11:35:23 2020 -0600
Commit: Jon Bell <jondbell@protonmail.com>
CommitDate: Sat Apr 18 11:35:23 2020 -0600
Fix uninitialized graphics state
---
source/graphics.cpp | 4 ++++
source/graphics.h | 8 ++++----
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/source/graphics.cpp b/source/graphics.cpp
index 8a0c7e4..ff1802e 100644
--- a/source/graphics.cpp
+++ b/source/graphics.cpp
@@ -51,6 +51,10 @@ void copy_data_to_sprites(uint8_t sprite_data[128 * 128], std::string data) {
//call initialize to make sure defaults are correct
Graphics::Graphics(std::string fontdata) {
+ GraphicsState graphicsState = {};
+ graphicsState.color = 7;
+ _graphicsState = & graphicsState;
+
Logger::Write("Copying data to font spritesheet\n");
copy_data_to_sprites(fontSpriteData, fontdata);
}
diff --git a/source/graphics.h b/source/graphics.h
index 3d54452..db2fd8d 100644
--- a/source/graphics.h
+++ b/source/graphics.h
@@ -30,11 +30,11 @@ struct Color {
};
struct GraphicsState{
- uint8_t color = 7;
- uint8_t bgColor = 0;
+ uint8_t color;
+ uint8_t bgColor;
- short text_x = 0;
- short text_y = 0;
+ short text_x;
+ short text_y;
};
class Graphics {