#ifndef LIBRARY_VKVM_HPP #define LIBRARY_VKVM_HPP #include "Color.hpp" #include "EventType.hpp" #include "FontType.hpp" #include "GraphicMode.hpp" #include "KeyCode.hpp" #include "LayoutVersion.hpp" #include "log.hpp" #include #include namespace vkvm { /** * @since 0.1.0 * @author Johannes Theiner */ struct Coordinates { int x; int y; }; /** * initialize the connection with the shared-memory application * @param pid pip of shared-memory application */ auto initialize(int pid) -> void; auto setDefaultValues() -> void; /** * 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. */ auto setPixel(int x, int y, Color color) -> bool; /** * get color of pixel at x,y position * @param x x coordinate of pixel * @param y y coordinate of pixel * @return color of pixel */ auto getPixel(int x, int y) -> Color; /** * 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. */ auto registerEvent(EventType type, const std::function &handler) -> bool; /** * set displayed text in Text mode * @param text text to display * @return if text could be set, false if it could not be set. */ auto setText(std::string text) -> bool; /** * get currently saved/displayed text. */ auto getText() -> std::string; //Control registers start here //all modes /** * get version of the used layout * @return layout version */ auto getLayoutVersion() -> LayoutVersion; /** * reset all values to default. */ auto reset() -> void; /** * get width of window. * @return width of window. */ auto getWidth() -> int; /** * set width of window. * @param newValue new width for window. */ auto setWidth(int newValue) -> void; /** * get height for window. * @return height of window. */ auto getHeight() -> int; /** * set height of window. * @param newValue new height for window. */ auto setHeight(int newValue) -> void; /** * get graphics display mode. * @return GraphicMode. */ auto getMode() -> GraphicMode; /** * set new graphics display mode. * @param newValue new graphics display mode. */ auto setMode(GraphicMode newValue) -> void; /** * get interval between redraws in milliseconds. */ auto getRedrawInterval() -> int; /** * set interval between redraws. * @param newValue new interval in milliseconds. */ auto setRedrawInterval(int newValue) -> void; /** * get time between timer interrupts. * @return time between interrupts in milliseconds. */ auto getTimerInterruptInterval() -> int; /** * set time between timer interrupts. * @param newValue new time between interrupts in milliseconds. */ auto setTimerInterruptInterval(int newValue) -> void; //black/white mode /** * get background color in two color mode. * @return background color. */ auto getBackgroundColor() -> Color; /** * set background color in two color mode. * @param newValue new background color. */ auto setBackgroundColor(Color newValue) -> void; /** * get foreground color in two color mode. * @return foreground color. */ auto getForegroundColor() -> Color; /** * set foreground color in two color mode. * @param newValue new foreground color. */ auto setForegroundColor(Color newValue) -> void; //text mode /** * get characters per row in text mode. * @return characters per row. */ auto getCharactersPerRow() -> int; /** * get characters per column in text mode. * @return characters per column. */ auto getCharactersPerColumn() -> int; /** * get currently used font in text mode. * @return currently used font. */ auto getFont() -> FontType; /** * set text mode font. * @param newValue new text mode font. */ auto setFont(const FontType &newValue) -> void; /** * get current mouse position * @return mouse position as x,y pair */ auto getMousePosition() -> Coordinates; /** * get key code of last key press. * @return KeyCode of last key press. */ auto getLastPressedKey() -> KeyCode; } #endif