// window.h #pragma once #ifndef WINDOW_H #define WINDOW_H #include typedef struct window_t window_t; #define KEY_RETURN 40 #define KEY_SPACE 44 #define KEY_ESCAPE 41 #define KEY_LSHIFT 42 #define KEY_RSHIFT 43 #define KEY_LCTRL 29 #define KEY_RCTRL 157 #define MOUSE_BUTTON_LEFT 1 #define MOUSE_BUTTON_MIDDLE 2 #define MOUSE_BUTTON_RIGHT 3 #define KEY_UP 82 #define KEY_DOWN 81 #define KEY_LEFT 80 #define KEY_RIGHT 79 #define KEY_BACKSPACE 42 #define KEY_F1 58 #define KEY_F2 59 #define KEY_A 4 #define KEY_D 7 #define KEY_W 26 #define KEY_S 22 #define KEY_1 30 #define KEY_0 39 extern "C" { // creates a window with given width, height and title, title can be utf8 window_t* window_create(int width, int height, const char* title); // destroys the window void window_destroy(window_t* s); // polls window events, returns true if the window should close bool window_pollevent(window_t* s); // blits the given framebuffer to the window. must be the same size as the window and ARGB8888 format void window_blit(window_t* s, const uint32_t* framebuffer); // returns true if the given key is currently held down bool window_is_key_down(window_t* s, int key_scancode); // returns true if the given mouse button is currently held down bool window_is_mouse_button_down(window_t* s, int button_index); // gets the current mouse position in window coordinates void window_get_mouse_position(window_t* s, int* x, int* y); } #endif // WINDOW_H