From 145c7f4695a369c6955b1065fcdef6d52e21f91b Mon Sep 17 00:00:00 2001 From: Johannes Theiner Date: Thu, 7 Nov 2019 17:02:00 +0100 Subject: [PATCH] + dummy getters --- src/Color.cpp | 1 - src/Font.cpp | 22 +++++++++ src/Font.h | 10 ++++- src/add.cpp | 5 --- src/add.h | 6 --- src/internal.cpp | 20 +++++++++ src/vkvm.cpp | 104 +++++++++++++++++++++++++++++++++++++++++++ test/add_test.cpp | 11 ----- test/public_test.cpp | 8 ++++ 9 files changed, 162 insertions(+), 25 deletions(-) create mode 100644 src/Font.cpp delete mode 100644 src/add.cpp delete mode 100644 src/add.h delete mode 100644 test/add_test.cpp create mode 100644 test/public_test.cpp diff --git a/src/Color.cpp b/src/Color.cpp index 3daac50..b4bdb15 100644 --- a/src/Color.cpp +++ b/src/Color.cpp @@ -5,4 +5,3 @@ Color::Color(unsigned char red, unsigned char green, unsigned char blue) : red(red), green(green), blue(blue){ } - diff --git a/src/Font.cpp b/src/Font.cpp new file mode 100644 index 0000000..fa42d3b --- /dev/null +++ b/src/Font.cpp @@ -0,0 +1,22 @@ + +#include +#include +#include "Font.h" + +Font::Font(std::string name, int height, int width) { + this->name = std::move(name); + this->height = height; + this->width = width; +} + +std::string Font::getName() { + return name; +} + +int Font::getHeight() { + return height; +} + +int Font::getWidth() { + return width; +} diff --git a/src/Font.h b/src/Font.h index 308dbc8..041c3c9 100644 --- a/src/Font.h +++ b/src/Font.h @@ -1,12 +1,16 @@ +#include + #ifndef LIBRARY_FONT_H #define LIBRARY_FONT_H - class Font { private: - Font(); + std::string name; + int height; + int width; public: + Font(std::string name, int height, int width); std::string getName(); int getHeight(); int getWidth(); @@ -14,4 +18,6 @@ public: }; +const static Font font_1 = Font("DummyFont", 10, 5); + #endif diff --git a/src/add.cpp b/src/add.cpp deleted file mode 100644 index c3f4e9f..0000000 --- a/src/add.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include "add.h" - -int add(int a, int b){ - return a + b; -} diff --git a/src/add.h b/src/add.h deleted file mode 100644 index c950a3c..0000000 --- a/src/add.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef LIBRARY_ADD_H -#define LIBRARY_ADD_H - -int add(int a, int b); - -#endif diff --git a/src/internal.cpp b/src/internal.cpp index 287d561..feba66a 100644 --- a/src/internal.cpp +++ b/src/internal.cpp @@ -25,3 +25,23 @@ bool callEvent(EventType type) { } return true; } + +void setLayoutVersion(LayoutVersion newValue) { + +} + +void setCharactersPerLine(int newValue) { + +} + +void setCharactersPerRow(int newValue) { + +} + +void setMousePosition(int x, int y) { + +} + +void buttonPressed(KeyCode keyCode) { + +} diff --git a/src/vkvm.cpp b/src/vkvm.cpp index c2e66c6..72d999b 100644 --- a/src/vkvm.cpp +++ b/src/vkvm.cpp @@ -9,6 +9,14 @@ void initialize(int pid) { impl.sharedMemorySize = 0; } +bool setPixel(int x, int y, Color color) { + return true; +} + +Color getPixel(int x, int y) { + return {255, 0, 0}; +} + bool registerEvent(EventType type, std::function handler) { int signum = SIGUSR1 + impl.eventTable.size(); @@ -28,3 +36,99 @@ bool registerEvent(EventType type, std::function handler) { return true; } + +bool setText(std::string text) { + return false; +} + +std::string getText() { + return "Hallo Welt"; +} + +LayoutVersion getLayoutVersion() { + return V1; +} + +void reset() { + +} + +int getWidth() { + return 360; +} + +void setWidth(int newValue) { + +} + +int getHeight() { + return 360; +} + +void setHeight(int newValue) { + +} + +GraphicMode getMode() { + return TrueColor; +} + +void setMode(GraphicMode newValue) { + +} + +int getRedrawInterval() { + return 10; +} + +void setRedrawInterval(int newValue) { + +} + +int getTimerInterruptInterval() { + return 5; +} + +void setTimerInterruptInterval(int newValue) { + +} + +Color getBackgroundColor() { + return black; +} + +void setBackgroundColor(Color newValue) { + +} + +Color getForegroundColor() { + return white; +} + +void setForegroundColor(Color newValue) { + +} + +int getCharactersPerRow() { + return 5; +} + +int getCharactersPerColumn() { + return 5; +} + +Font getFont() { + return font_1; +} + +void setFont(Font newValue) { + +} + +std::pair getMousePosition() { + return {10, 50}; +} + +KeyCode getLastPressedKey() { + return KeyCode(50); +} diff --git a/test/add_test.cpp b/test/add_test.cpp deleted file mode 100644 index 0b30d42..0000000 --- a/test/add_test.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include "../src/add.h" - -TEST_CASE("add works") { - SECTION("equals") { - REQUIRE(add(2, 2) == 4); - } - SECTION("not equals") { - REQUIRE(add(2, 2) != 5); - } -} \ No newline at end of file diff --git a/test/public_test.cpp b/test/public_test.cpp new file mode 100644 index 0000000..6ee3b23 --- /dev/null +++ b/test/public_test.cpp @@ -0,0 +1,8 @@ +#include +#include "../src/vkvm.h" + +TEST_CASE("add works") { + SECTION("equals") { + REQUIRE(getText() == "Hallo Welt"); + } +} \ No newline at end of file