+ init implementation

+ Color and KeyType constructor
+ Registers struct
This commit is contained in:
Julian Hinxlage 2019-10-29 15:24:57 +01:00
parent 4fb770bf69
commit bc28f2819b
9 changed files with 88 additions and 19 deletions

8
src/Color.cpp Normal file
View File

@ -0,0 +1,8 @@
#include "Color.h"
Color::Color(unsigned char red, unsigned char green, unsigned char blue)
: red(red), green(green), blue(blue){
}

View File

@ -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

9
src/KeyCode.cpp Normal file
View File

@ -0,0 +1,9 @@
#include "KeyCode.h"
KeyCode::KeyCode(int value) : value(value) {}
int KeyCode::getValue() {
return value;
}

View File

@ -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

View File

@ -2,7 +2,7 @@
#define LIBRARY_LAYOUTVERSION_H
enum LayoutVersion {
V1 = 1;
V1 = 1
};
#endif

5
src/internal.cpp Normal file
View File

@ -0,0 +1,5 @@
#include "internal.h"
Internal internal;

View File

@ -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

6
src/vkvm.cpp Normal file
View File

@ -0,0 +1,6 @@
#include "vkvm.h"
#include "internal.h"
void initialize(int pid) {
internal.sharedMemoryPid = pid;
}

View File

@ -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.