From f0f0d4ae634bafdaaee188b700e42c3a743d72f6 Mon Sep 17 00:00:00 2001 From: Johannes Theiner Date: Mon, 21 Oct 2019 18:39:55 +0200 Subject: [PATCH 1/9] + first version of header file --- src/vkvm.h | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 src/vkvm.h diff --git a/src/vkvm.h b/src/vkvm.h new file mode 100644 index 0000000..a7b9788 --- /dev/null +++ b/src/vkvm.h @@ -0,0 +1,74 @@ +#ifndef LIBRARY_VKVM_H +#define LIBRARY_VKVM_H + +typedef int type_todo; + +private struct interruptVector { + int pid; + int signal; +}; + +//enum config file defaults { +const int max_width_pixels = 800; +const int max_height_pixels = 600; +const int max_textMode_width; +const int max_textMode_height; +// TODO: add ControlRegisters members here +//TODO: add get/set methods +//}; + + +enum GraphicMode { + Text, + BlackWhite, + Gray_256, + TrueColor; +}; + +private struct controlRegisters { + int layout_version + int trigger_reset; + int width_pixels; + int height_pixels; + GraphicMode graphicMode; + int autoRedrawInterval; + int timerInterruptInterval; + type_todo bw_background_color; + type_todo bw_foreground_color; + int textMode_width; + int textMode_height; + int textMode_font; + int textMode_font_width; + int textMode_font_height; + int mouse_pos_x; + int mouse_pos_y; + char keyboardBuffer[16]; + int keyboardBuffer_index_w; + int keyboardBuffer_index_r; +}; + +//TODO: add init +//TODO: add methods for a event handling approach +//TODO: add methods for a pooling approach + +// interrupts +/* +1 timer +2 mouse move + mouse button + key down + key up + reread ControlRegisters + redraw GUI // opposite direction (i.e. client to GUI)! + render Text // text mode client -> text rendering process -> redraw GUI + */ + +// Shared Memory Layout +// -------------------------------------------------------------------- +// struct ControlRegisters +// char reserved[1024] +// Interrupt Vector Table [64] +// text area [max_textMode_width * max_textMode_height] +// pixel area [max_height_pixels * max_height_pixels * sizeof(uint_32)] + +#endif \ No newline at end of file From d4e75845bf16db40222080e53a226f06fe894bce Mon Sep 17 00:00:00 2001 From: ziyue Date: Wed, 23 Oct 2019 12:58:11 +0200 Subject: [PATCH 2/9] nur fuer test --- src/vkvm.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/vkvm.h b/src/vkvm.h index a7b9788..e1a004c 100644 --- a/src/vkvm.h +++ b/src/vkvm.h @@ -6,6 +6,7 @@ typedef int type_todo; private struct interruptVector { int pid; int signal; + int test; }; //enum config file defaults { From 002cb9e768dde628c29531246ad4c2a68fa2cd10 Mon Sep 17 00:00:00 2001 From: ziyue Date: Wed, 23 Oct 2019 12:59:55 +0200 Subject: [PATCH 3/9] loeschen test --- src/vkvm.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/vkvm.h b/src/vkvm.h index e1a004c..a7b9788 100644 --- a/src/vkvm.h +++ b/src/vkvm.h @@ -6,7 +6,6 @@ typedef int type_todo; private struct interruptVector { int pid; int signal; - int test; }; //enum config file defaults { From 7b092585be42ac32965b204f82ac40ccd0074ba1 Mon Sep 17 00:00:00 2001 From: ziyue Date: Wed, 23 Oct 2019 16:11:16 +0200 Subject: [PATCH 4/9] background --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 086aedc..3511ba1 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,12 @@ # vKVM Library +#Background + +THis Library was created to make it easier for developers to understand the overall project framework, +and to make the code of each department uniform and standardized. +It can provide names for many variables and methods that people can easily call and implement. +It can provided font changes, event handling, pixel color, button control, ect. + # Installation Use the installation script provided in the Scripts repository @@ -11,7 +18,7 @@ Installing a single component is currently not supported. Include this library with -``` +```sh set(LIB_PATH "${CMAKE_SOURCE_DIR}/../library") include_directories(${LIB_PATH}/include) From 29dac2230fbae3a9c1f7cacf544c795cc38f3b78 Mon Sep 17 00:00:00 2001 From: Johannes Theiner Date: Wed, 23 Oct 2019 17:12:04 +0200 Subject: [PATCH 5/9] + public header fully documented. + internal header --- CHANGELOG.md | 2 +- README.md | 6 +- src/Color.h | 20 ++++ src/EventType.h | 19 ++++ src/Font.h | 17 +++ src/GraphicMode.h | 11 ++ src/KeyCode.h | 17 +++ src/LayoutVersion.h | 8 ++ src/internal.h | 37 +++++++ src/notes.txt | 12 +++ src/vkvm.h | 249 +++++++++++++++++++++++++++++++++----------- 11 files changed, 334 insertions(+), 64 deletions(-) create mode 100644 src/Color.h create mode 100644 src/EventType.h create mode 100644 src/Font.h create mode 100644 src/GraphicMode.h create mode 100644 src/KeyCode.h create mode 100644 src/LayoutVersion.h create mode 100644 src/internal.h create mode 100644 src/notes.txt diff --git a/CHANGELOG.md b/CHANGELOG.md index 101bcbe..9214fad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Continuous Integration -## [0.0.1] - 2019-10-24 +## [0.1.0] - 2019-10-24 ### Added diff --git a/README.md b/README.md index 086aedc..b3ad77e 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,15 @@ # vKVM Library -# Installation + + +## Installation Use the installation script provided in the Scripts repository to install the full package. Installing a single component is currently not supported. -# Usage +## Usage Include this library with diff --git a/src/Color.h b/src/Color.h new file mode 100644 index 0000000..54b6e88 --- /dev/null +++ b/src/Color.h @@ -0,0 +1,20 @@ +#ifndef LIBRARY_COLOR_H +#define LIBRARY_COLOR_H + +static const Color black = Color(0, 0, 0); +static const Color white = Color(255, 255, 255); + +class Color { + +private: + unsigned char red; + unsigned char green; + unsigned char blue; + +public: + Color(red, green, blue); + +}; + + +#endif diff --git a/src/EventType.h b/src/EventType.h new file mode 100644 index 0000000..52e07e0 --- /dev/null +++ b/src/EventType.h @@ -0,0 +1,19 @@ +#ifndef LIBRARY_EVENTTYPE_H +#define LIBRARY_EVENTTYPE_H + +/** + * @since 0.1.0 + * @uthor Johannes Theiner + */ +enum EventType { + Timer = 1, + MouseMove = 2, + MouseButton = 3, + KeyDown = 4, + KeyUp = 5, + UpdateControlRegisters = 6, + Redraw = 7, + RenderText = 8 +}; + +#endif diff --git a/src/Font.h b/src/Font.h new file mode 100644 index 0000000..308dbc8 --- /dev/null +++ b/src/Font.h @@ -0,0 +1,17 @@ +#ifndef LIBRARY_FONT_H +#define LIBRARY_FONT_H + + +class Font { +private: + Font(); + +public: + std::string getName(); + int getHeight(); + int getWidth(); + +}; + + +#endif diff --git a/src/GraphicMode.h b/src/GraphicMode.h new file mode 100644 index 0000000..77f82c1 --- /dev/null +++ b/src/GraphicMode.h @@ -0,0 +1,11 @@ +#ifndef LIBRARY_GRAPHICMODE_H +#define LIBRARY_GRAPHICMODE_H + +enum GraphicMode { + Text = 1, + TwoColors = 2, + Gray_256 = 3, + TrueColor = 4, +}; + +#endif diff --git a/src/KeyCode.h b/src/KeyCode.h new file mode 100644 index 0000000..cb9d2a5 --- /dev/null +++ b/src/KeyCode.h @@ -0,0 +1,17 @@ +#ifndef LIBRARY_KEYCODE_H +#define LIBRARY_KEYCODE_H + + +const KeyCode Backspace = KeyCode(8); +const KeyCode tabulator = KeyCode(9); + +class KeyCode { + +private: + KeyCode(int value); +public: + int getValue(); +}; + + +#endif diff --git a/src/LayoutVersion.h b/src/LayoutVersion.h new file mode 100644 index 0000000..3d0dd54 --- /dev/null +++ b/src/LayoutVersion.h @@ -0,0 +1,8 @@ +#ifndef LIBRARY_LAYOUTVERSION_H +#define LIBRARY_LAYOUTVERSION_H + +enum LayoutVersion { + V1 = 1; +}; + +#endif diff --git a/src/internal.h b/src/internal.h new file mode 100644 index 0000000..5e3b072 --- /dev/null +++ b/src/internal.h @@ -0,0 +1,37 @@ +#ifndef LIBRARY_INTERNAL_H +#define LIBRARY_INTERNAL_H + +#include "EventType.h" +#include "KeyCode.h" +#include "LayoutVersion.h" + +//TODO: documentation + +void setLayoutVersion(LayoutVersion newValue); + +void setTriggerReset(int newValue); + +void setCharactersPerLine(int newValue); + +void setCharactersPerRow(int newValue); + +/** + * call a specific event. + * @param type + * @return true if there is a handler registere + */ +bool callEvent(EventType type); + +void setMousePosition(int x, int y); + +void buttonPressed(KeyCode keyCode); + +// Shared Memory Layout +// -------------------------------------------------------------------- +// struct ControlRegisters +// char reserved[1024] +// Interrupt Vector Table [64] +// text area [max_textMode_width * max_textMode_height] +// pixel area [max_height_pixels * max_height_pixels * sizeof(uint_32)] + +#endif \ No newline at end of file diff --git a/src/notes.txt b/src/notes.txt new file mode 100644 index 0000000..355056c --- /dev/null +++ b/src/notes.txt @@ -0,0 +1,12 @@ +//enum config file defaults { +const int max_width_pixels = 800; +const int max_height_pixels = 600; +const int max_textMode_width = 800; +const int max_textMode_height = 600; +//}; + + +struct interruptVector { + int pid; + int signal; +}; diff --git a/src/vkvm.h b/src/vkvm.h index a7b9788..1a6e959 100644 --- a/src/vkvm.h +++ b/src/vkvm.h @@ -1,74 +1,201 @@ #ifndef LIBRARY_VKVM_H #define LIBRARY_VKVM_H -typedef int type_todo; +#include +#include +#include "Color.h" +#include "EventType.h" +#include "GraphicMode.h" +#include "Font.h" +#include "KeyCode.h" +#include "LayoutVersion.h" -private struct interruptVector { - int pid; - int signal; -}; +/** + * @since 0.1.0 + * @author Johannes Theiner + */ -//enum config file defaults { -const int max_width_pixels = 800; -const int max_height_pixels = 600; -const int max_textMode_width; -const int max_textMode_height; -// TODO: add ControlRegisters members here -//TODO: add get/set methods -//}; +//TODO: better documentation +/** + * initialize the connection with the shared-memory application + * @param pid pip of shared-memory application + */ +void initialize(int pid); -enum GraphicMode { - Text, - BlackWhite, - Gray_256, - TrueColor; -}; +/** + * set pixel at a x,y position to a certain color. + * @param x x coordinate of pixel + * @param y y coordinate of pixel + * @param color color of pixel + * @return true if operation succeeded, false if it failed. + */ +bool setPixel(int x, int y, Color color); -private struct controlRegisters { - int layout_version - int trigger_reset; - int width_pixels; - int height_pixels; - GraphicMode graphicMode; - int autoRedrawInterval; - int timerInterruptInterval; - type_todo bw_background_color; - type_todo bw_foreground_color; - int textMode_width; - int textMode_height; - int textMode_font; - int textMode_font_width; - int textMode_font_height; - int mouse_pos_x; - int mouse_pos_y; - char keyboardBuffer[16]; - int keyboardBuffer_index_w; - int keyboardBuffer_index_r; -}; +/** + * get color of pixel at x,y position + * @param x x coordinate of pixel + * @param y y coordinate of pixel + * @return color of pixel + */ +Color getPixel(int x, int y); -//TODO: add init -//TODO: add methods for a event handling approach -//TODO: add methods for a pooling approach +/** + * register handler for event. + * @param type type of event. + * @param handler function to call. + * @return true if handler could be registered, false if it failed. + */ +bool registerEvent(EventType type, std::function handler); -// interrupts -/* -1 timer -2 mouse move - mouse button - key down - key up - reread ControlRegisters - redraw GUI // opposite direction (i.e. client to GUI)! - render Text // text mode client -> text rendering process -> redraw GUI - */ +/** + * set displayed text in Text mode + * @param text text to display + * @return if text could be set, false if it could not be set. + */ +bool setText(std::string text); -// Shared Memory Layout -// -------------------------------------------------------------------- -// struct ControlRegisters -// char reserved[1024] -// Interrupt Vector Table [64] -// text area [max_textMode_width * max_textMode_height] -// pixel area [max_height_pixels * max_height_pixels * sizeof(uint_32)] +/** + * get currently saved/displayed text. + */ +std::string getText(); + +//Control registers start here + +//all modes + +/** + * get version of the used layout + * @return layout version + */ +LayoutVersion getLayoutVersion(); + +/** + * reset all values to default. + */ +void reset(); + +/** + * get width of window. + * @return width of window. + */ +int getWidth(); + +/** + * set width of window. + * @param newValue new width for window. + */ +void setWidth(int newValue); + +/** + * get height for window. + * @return height of window. + */ +int getHeight(); + +/** + * set height of window. + * @param newValue new height for window. + */ +void setHeight(int newValue); + +/** + * get graphics display mode. + * @return GraphicMode. + */ +GraphicMode getMode(); + +/** + * set new graphics display mode. + * @param newValue new graphics display mode. + */ +void setMode(GraphicMode newValue); + +/** + * get interval between redraws in milliseconds. + */ +int getRedrawInterval(); + +/** + * set interval between redraws. + * @param newValue new interval in milliseconds. + */ +void setRedrawInterval(int newValue); + +/** + * get time between timer interrupts. + * @return time between interrupts in milliseconds. + */ +int getTimerInterruptInterval(); + +/** + * set time between timer interrupts. + * @param newValue new time between interrupts in milliseconds. + */ +void setTimerInterruptInterval(int newValue); + +//black/white mode + +/** + * get background color in two color mode. + * @return background color. + */ +Color getBackgroundColor(); + +/** + * set background color in two color mode. + * @param newValue new background color. + */ +void setBackgroundColor(Color newValue); + +/** + * get foreground color in two color mode. + * @return foreground color. + */ +Color getForegroundColor(); + +/** + * set foreground color in two color mode. + * @param newValue new foreground color. + */ +void setForegroundColor(Color newValue); + +//text mode + +/** + * get characters per line in text mode. + * @return characters per line. + */ +int getCharactersPerLine(); + +/** + * get characters per row in text mode. + * @return characters per row. + */ +int getCharactersPerRow(); + +/** + * get currently used font in text mode. + * @return currently used font. + */ +Font getFont(); + +/** + * set text mode font. + * @param newValue new text mode font. + */ +void setFont(Font newValue); + +/** + * get current mouse position + * @return mouse position as x,y pair + */ +std::pair getMousePosition(); + +/** + * get key code of last key press. + * @return KeyCode of last key press. + */ +KeyCode getLastPressedKey(); #endif \ No newline at end of file From fab983151f2c2219bccac7d29667918e2429177b Mon Sep 17 00:00:00 2001 From: ziyue Date: Wed, 23 Oct 2019 17:38:27 +0200 Subject: [PATCH 6/9] verbessern Background --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3e7e357..62f3375 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ # vKVM Library -#Background +# Background -THis Library was created to make it easier for developers to understand the overall project framework, +This Library was created to make it easier for developers to understand the overall project framework, and to make the code of each department uniform and standardized. It can provide names for many variables and methods that people can easily call and implement. -It can provided font changes, event handling, pixel color, button control, ect. +It can provided font changes, event handling, pixel color, button control, keyboard response ect. ## Installation @@ -18,7 +18,7 @@ Installing a single component is currently not supported. Include this library with -``` +```sh set(LIB_PATH "${CMAKE_SOURCE_DIR}/../library") include_directories(${LIB_PATH}/include) From 90231fce36b5694f782031ead15c8b69199ec3db Mon Sep 17 00:00:00 2001 From: Johannes Theiner Date: Thu, 24 Oct 2019 09:38:58 +0200 Subject: [PATCH 7/9] + internal header documentation. --- src/Color.h | 5 +++++ src/EventType.h | 1 + src/GraphicMode.h | 5 +++++ src/internal.h | 27 ++++++++++++++++++++++----- 4 files changed, 33 insertions(+), 5 deletions(-) diff --git a/src/Color.h b/src/Color.h index 54b6e88..93172d7 100644 --- a/src/Color.h +++ b/src/Color.h @@ -4,6 +4,11 @@ static const Color black = Color(0, 0, 0); static const Color white = Color(255, 255, 255); +/** + * color values represented as rgb values. + * @author Johannes Theiner + * @since 0.1.0 + */ class Color { private: diff --git a/src/EventType.h b/src/EventType.h index 52e07e0..6daa1ea 100644 --- a/src/EventType.h +++ b/src/EventType.h @@ -2,6 +2,7 @@ #define LIBRARY_EVENTTYPE_H /** + * types of events. * @since 0.1.0 * @uthor Johannes Theiner */ diff --git a/src/GraphicMode.h b/src/GraphicMode.h index 77f82c1..d447ee8 100644 --- a/src/GraphicMode.h +++ b/src/GraphicMode.h @@ -1,6 +1,11 @@ #ifndef LIBRARY_GRAPHICMODE_H #define LIBRARY_GRAPHICMODE_H +/** + * all possible graphics modes. + * @author Johannes Theiner + * @since 0.1.0 + */ enum GraphicMode { Text = 1, TwoColors = 2, diff --git a/src/internal.h b/src/internal.h index 5e3b072..e67ce89 100644 --- a/src/internal.h +++ b/src/internal.h @@ -5,25 +5,42 @@ #include "KeyCode.h" #include "LayoutVersion.h" -//TODO: documentation - +/** + * set layout version. + * @param newValue new layout version number. + */ void setLayoutVersion(LayoutVersion newValue); -void setTriggerReset(int newValue); - +/** + * set characters per line for current font. + * @param newValue characters per line. + */ void setCharactersPerLine(int newValue); +/** + * set characters per row for current font. + * @param newValue + */ void setCharactersPerRow(int newValue); /** * call a specific event. * @param type - * @return true if there is a handler registere + * @return true if there is a handler registered. */ bool callEvent(EventType type); +/** + * set mouse position to x,y value. + * @param x x coordinate + * @param y y coordinate + */ void setMousePosition(int x, int y); +/** + * register pressed button. + * @param keyCode pressed key. + */ void buttonPressed(KeyCode keyCode); // Shared Memory Layout From 4fb770bf69a24b7591b919433c090bc6aee6432b Mon Sep 17 00:00:00 2001 From: Johannes Theiner Date: Mon, 28 Oct 2019 18:41:41 +0000 Subject: [PATCH 8/9] better README --- README.md | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 62f3375..6124b42 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,13 @@ # vKVM Library -# Background +This library allows for easy interaction with the graphical user interface of the vKVM project. -This Library was created to make it easier for developers to understand the overall project framework, -and to make the code of each department uniform and standardized. -It can provide names for many variables and methods that people can easily call and implement. -It can provided font changes, event handling, pixel color, button control, keyboard response ect. + +## Features + +- set pixel color +- respond to keyboard/mouse events +- get/set text to be drawn ## Installation @@ -14,18 +16,32 @@ to install the full package. Installing a single component is currently not supported. -## Usage +## Include Include this library with -```sh -set(LIB_PATH "${CMAKE_SOURCE_DIR}/../library") +``` +set(LIB_PATH "${CMAKE_SOURCE_DIR}/../relative_path_to_library_folder") include_directories(${LIB_PATH}/include) add_executable(your_client ${SOURCES} ${HEADERS}) target_link_libraries(your_client ${LIB_PATH}/lib/liblibrary.a) ``` -in your CMakeLists. +in your CMakeList. -More documentation coming soon. +## Usage + +```cpp +#include + +int main(int argc, char* argv[]) { + if(argc != 1) return -1; + int pid = std::stoi(argv[0]); + initialize(pid); + + setPixel(10, 10, Color::black); + setPixel(10, 20, Color::red); +} + +``` \ No newline at end of file From bc28f2819bd0d32a739e4b3aab760ac007eba196 Mon Sep 17 00:00:00 2001 From: Julian Hinxlage Date: Tue, 29 Oct 2019 15:24:57 +0100 Subject: [PATCH 9/9] + init implementation + Color and KeyType constructor + Registers struct --- src/Color.cpp | 8 ++++++++ src/Color.h | 6 +++--- src/KeyCode.cpp | 9 +++++++++ src/KeyCode.h | 16 +++++++--------- src/LayoutVersion.h | 2 +- src/internal.cpp | 5 +++++ src/internal.h | 43 +++++++++++++++++++++++++++++++++++++++++++ src/vkvm.cpp | 6 ++++++ src/vkvm.h | 12 ++++++------ 9 files changed, 88 insertions(+), 19 deletions(-) create mode 100644 src/Color.cpp create mode 100644 src/KeyCode.cpp create mode 100644 src/internal.cpp create mode 100644 src/vkvm.cpp diff --git a/src/Color.cpp b/src/Color.cpp new file mode 100644 index 0000000..3daac50 --- /dev/null +++ b/src/Color.cpp @@ -0,0 +1,8 @@ + +#include "Color.h" + +Color::Color(unsigned char red, unsigned char green, unsigned char blue) + : red(red), green(green), blue(blue){ + +} + diff --git a/src/Color.h b/src/Color.h index 93172d7..3d75e99 100644 --- a/src/Color.h +++ b/src/Color.h @@ -1,8 +1,6 @@ #ifndef LIBRARY_COLOR_H #define LIBRARY_COLOR_H -static const Color black = Color(0, 0, 0); -static const Color white = Color(255, 255, 255); /** * color values represented as rgb values. @@ -17,9 +15,11 @@ private: unsigned char blue; public: - Color(red, green, blue); + Color(unsigned char red, unsigned char green, unsigned char blue); }; +const Color black = Color(0, 0, 0); +const Color white = Color(255, 255, 255); #endif diff --git a/src/KeyCode.cpp b/src/KeyCode.cpp new file mode 100644 index 0000000..6e7e2c7 --- /dev/null +++ b/src/KeyCode.cpp @@ -0,0 +1,9 @@ + +#include "KeyCode.h" + +KeyCode::KeyCode(int value) : value(value) {} + +int KeyCode::getValue() { + return value; +} + diff --git a/src/KeyCode.h b/src/KeyCode.h index cb9d2a5..65ab74d 100644 --- a/src/KeyCode.h +++ b/src/KeyCode.h @@ -1,17 +1,15 @@ #ifndef LIBRARY_KEYCODE_H #define LIBRARY_KEYCODE_H +class KeyCode { +private: + int value; +public: + explicit KeyCode(int value); + int getValue(); +}; const KeyCode Backspace = KeyCode(8); const KeyCode tabulator = KeyCode(9); -class KeyCode { - -private: - KeyCode(int value); -public: - int getValue(); -}; - - #endif diff --git a/src/LayoutVersion.h b/src/LayoutVersion.h index 3d0dd54..ce24e93 100644 --- a/src/LayoutVersion.h +++ b/src/LayoutVersion.h @@ -2,7 +2,7 @@ #define LIBRARY_LAYOUTVERSION_H enum LayoutVersion { - V1 = 1; + V1 = 1 }; #endif diff --git a/src/internal.cpp b/src/internal.cpp new file mode 100644 index 0000000..d9575d2 --- /dev/null +++ b/src/internal.cpp @@ -0,0 +1,5 @@ +#include "internal.h" + +Internal internal; + + diff --git a/src/internal.h b/src/internal.h index e67ce89..65baee5 100644 --- a/src/internal.h +++ b/src/internal.h @@ -4,6 +4,48 @@ #include "EventType.h" #include "KeyCode.h" #include "LayoutVersion.h" +#include "GraphicMode.h" +#include "Color.h" + +/** + * the Control Registers + * @author Julian Hinxlage + * @since 0.1.0 + */ +struct Registers{ + int layout_version; + int trigger_reset; + int width_pixels; + int height_pixels; + GraphicMode graphicMode; + int autoRedrawInterval; + int timerInterruptInterval; + Color background_color; + Color foreground_color; + int characters_per_row; + int characters_per_column; + int textMode_font; + int textMode_font_width; + int textMode_font_height; + int mouse_pos_x; + int mouse_pos_y; + char keyboardBuffer[16]; + int keyboardBuffer_index_w; + int keyboardBuffer_index_r; +}; + +struct InterruptEntry{ + int pid; + int signum; +}; + +/** + * internal values for the library. + */ +struct Internal{ + int sharedMemoryPid; +}; +extern Internal internal; /** * set layout version. @@ -51,4 +93,5 @@ void buttonPressed(KeyCode keyCode); // text area [max_textMode_width * max_textMode_height] // pixel area [max_height_pixels * max_height_pixels * sizeof(uint_32)] + #endif \ No newline at end of file diff --git a/src/vkvm.cpp b/src/vkvm.cpp new file mode 100644 index 0000000..45218e4 --- /dev/null +++ b/src/vkvm.cpp @@ -0,0 +1,6 @@ +#include "vkvm.h" +#include "internal.h" + +void initialize(int pid) { + internal.sharedMemoryPid = pid; +} diff --git a/src/vkvm.h b/src/vkvm.h index 1a6e959..a95731f 100644 --- a/src/vkvm.h +++ b/src/vkvm.h @@ -162,18 +162,18 @@ void setForegroundColor(Color newValue); //text mode -/** - * get characters per line in text mode. - * @return characters per line. - */ -int getCharactersPerLine(); - /** * get characters per row in text mode. * @return characters per row. */ int getCharactersPerRow(); +/** + * get characters per column in text mode. + * @return characters per column. + */ +int getCharactersPerColumn(); + /** * get currently used font in text mode. * @return currently used font.