From 038e15a19cb06c1113e6ff5c52647ba8338f14f0 Mon Sep 17 00:00:00 2001 From: Julian Hinxlage Date: Tue, 19 Nov 2019 12:41:56 +0100 Subject: [PATCH 1/2] updated to new library version --- src/Block.cpp | 6 +++--- src/Block.h | 8 ++++---- src/Config.h | 10 +++++----- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Block.cpp b/src/Block.cpp index ee07787..08dcfe3 100644 --- a/src/Block.cpp +++ b/src/Block.cpp @@ -20,15 +20,15 @@ void Block::newLine() { } -void Block::setBackgroundWithSingleColor(Color color) { +void Block::setBackgroundWithSingleColor(vkvm::Color color) { } -void Block::setBackground(Color *) { +void Block::setBackground(vkvm::Color *) { } -void Block::setBackgroundWithSlowChangedColor(Color color1, Color color2, int modul) { +void Block::setBackgroundWithSlowChangedColor(vkvm::Color color1, vkvm::Color color2, int modul) { } diff --git a/src/Block.h b/src/Block.h index c0c9fc3..94a130d 100644 --- a/src/Block.h +++ b/src/Block.h @@ -6,7 +6,7 @@ #define TRE_BLOCK_H #include -#include +#include "Color.hpp" #include "Font.h" class Block { @@ -19,9 +19,9 @@ public: virtual unsigned char * getDisplayColor(); - virtual void setBackgroundWithSingleColor(Color color); - virtual void setBackground(Color[]); - virtual void setBackgroundWithSlowChangedColor(Color color1, Color color2, int modul); + virtual void setBackgroundWithSingleColor(vkvm::Color color); + virtual void setBackground(vkvm::Color[]); + virtual void setBackgroundWithSlowChangedColor(vkvm::Color color1, vkvm::Color color2, int modul); virtual void setNowX(); diff --git a/src/Config.h b/src/Config.h index a890ae4..e4f9920 100644 --- a/src/Config.h +++ b/src/Config.h @@ -8,7 +8,7 @@ #include #include #include -#include "Color.h" +#include "Color.hpp" #define CONFIG_FILE_PATH "../res/font4.config" #define BORDER_COLOR_STARTPOSITION 13 @@ -21,9 +21,9 @@ class Config { public: - Color border_color = Color(0, 0, 0); - Color background_color = Color(0, 0, 0); - Color font_color = Color(0, 0, 0); + vkvm::Color border_color = vkvm::Color(0, 0, 0); + vkvm::Color background_color = vkvm::Color(0, 0, 0); + vkvm::Color font_color = vkvm::Color(0, 0, 0); int border_width; int row; int column; @@ -34,7 +34,7 @@ public: private: void init(); - Color readColor(std::string line); + vkvm::Color readColor(std::string line); int readInteger(std::string line); }; From eeff5a45dc263d3098c242c57852d4752fe5bad1 Mon Sep 17 00:00:00 2001 From: Julian Hinxlage Date: Tue, 19 Nov 2019 12:49:04 +0100 Subject: [PATCH 2/2] added toml --- src/Config.cpp | 4 ++-- src/DritteFont.cpp | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Config.cpp b/src/Config.cpp index adfbc26..98dc0ec 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -53,7 +53,7 @@ int Config::readInteger(std::string line) { return value; } -Color Config::readColor(std::string line) { +vkvm::Color Config::readColor(std::string line) { int red, green, blue; std::istringstream iss(line); @@ -61,6 +61,6 @@ Color Config::readColor(std::string line) { std::cout << "failed when read color from config" << std::endl; } - Color color(red, green, blue); + vkvm::Color color(red, green, blue); return color; } diff --git a/src/DritteFont.cpp b/src/DritteFont.cpp index 5b2466b..db6e8e6 100644 --- a/src/DritteFont.cpp +++ b/src/DritteFont.cpp @@ -46,7 +46,7 @@ void DritteFont::readFont() { for(i = 0; i < characterHeight; i++) { for(j = 0; j < characterWidth; j++) { characters[row * config.column + column][i][j] = - data[offset + (i * width + j) * PIXEL_SIZE] != (char)config.background_color.red; + data[offset + (i * width + j) * PIXEL_SIZE] != (char)config.background_color.getRed(); } } offset = findNextStartOffset(data, offset, config); @@ -59,7 +59,7 @@ void DritteFont::readFont() { for(i = 0; i < characterHeight; i++) { for(j = 0; j < characterWidth; j++) { characters[config.row * config.column + column][i][j] = - data[offset + (i * width + j) * PIXEL_SIZE] != (char)config.background_color.red; + data[offset + (i * width + j) * PIXEL_SIZE] != (char)config.background_color.getRed(); } } offset = findNextStartOffset(data, offset, config); @@ -113,17 +113,17 @@ int DritteFont::getCharacterSize(std::vector data, Config config, int widt // the method must be modified for(; offset < data.size(); offset++) { - if(((unsigned int)data[offset] & 0xff) == config.border_color.red) // only use red value because the red, green and blue values are equal. + if(((unsigned int)data[offset] & 0xff) == config.border_color.getRed()) // only use red value because the red, green and blue values are equal. counter++; - if(((unsigned int)data[offset] & 0xff) != config.border_color.red) { + if(((unsigned int)data[offset] & 0xff) != config.border_color.getRed()) { if(counter > 0 && counter < config.border_width * 3 + DEVIATION_NUMBER) { // mal 3 because color has 3 values, red, green and blue values. tempOffset = offset; - while (((unsigned int)data[tempOffset++] & 0xff) != config.border_color.red) { + while (((unsigned int)data[tempOffset++] & 0xff) != config.border_color.getRed()) { characterWidth++; } tempOffset = offset; - while (((unsigned int)data[tempOffset] & 0xff) != config.border_color.red) { + while (((unsigned int)data[tempOffset] & 0xff) != config.border_color.getRed()) { characterHeight++; tempOffset += width * PIXEL_SIZE; } @@ -146,10 +146,10 @@ int DritteFont::findNextStartOffset(std::vector data, int offset, Config c for(; offset < data.size(); offset += PIXEL_SIZE) { - if(((unsigned int)data[offset] & 0xff) == config.border_color.red) // only use red value because the red, green and blue values are equal. + if(((unsigned int)data[offset] & 0xff) == config.border_color.getRed()) // only use red value because the red, green and blue values are equal. counter++; - if(((unsigned int)data[offset] & 0xff) != config.border_color.red) { + if(((unsigned int)data[offset] & 0xff) != config.border_color.getRed()) { if(counter > 0 && counter < config.border_width + DEVIATION_NUMBER) { // mal 3 because color has 3 values, red, green and blue values. return offset; }