library/src/internal.h

97 lines
2.0 KiB
C

#ifndef LIBRARY_INTERNAL_H
#define LIBRARY_INTERNAL_H
#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.
* @param newValue new layout version number.
*/
void setLayoutVersion(LayoutVersion 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 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
// --------------------------------------------------------------------
// 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