#ifndef LIBRARY_VKVM_H #define LIBRARY_VKVM_H #include #include #include "Color.h" #include "EventType.h" #include "GraphicMode.h" #include "FontType.h" #include "KeyCode.h" #include "LayoutVersion.h" /** * @since 0.1.0 * @author Johannes Theiner */ //TODO: better documentation /** * initialize the connection with the shared-memory application * @param pid pip of shared-memory application */ void initialize(int pid); /** * 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); /** * 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); /** * 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); /** * 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); /** * 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 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. */ FontType getFont(); /** * set text mode font. * @param newValue new text mode font. */ void setFont(FontType 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