135 lines
1.8 KiB
C++
135 lines
1.8 KiB
C++
#include "vkvm.h"
|
|
#include "internal.h"
|
|
#include <unistd.h>
|
|
#include <csignal>
|
|
|
|
void initialize(int pid) {
|
|
impl.sharedMemoryPid = pid;
|
|
impl.sharedMemoryKey = 12345;
|
|
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<void()> handler) {
|
|
int signum = SIGUSR1 + impl.eventTable.size();
|
|
|
|
auto ivt = getInterrupTable();
|
|
ivt[type].pid = getpid();
|
|
ivt[type].signum = signum;
|
|
|
|
impl.eventTable.push_back(handler);
|
|
|
|
onSignal(signum, [](int sig){
|
|
if(sig >= SIGUSR1){
|
|
if((sig - SIGUSR1) < impl.eventTable.size()){
|
|
impl.eventTable[sig - SIGUSR1]();
|
|
}
|
|
}
|
|
});
|
|
|
|
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<int, int> getMousePosition() {
|
|
return {10, 50};
|
|
}
|
|
|
|
KeyCode getLastPressedKey() {
|
|
return KeyCode(50);
|
|
}
|