changes in API design

This commit is contained in:
Ivar Fatland
2026-07-18 00:10:14 +02:00
parent 3ec40ce451
commit c9914b7827
+15 -20
View File
@@ -22,30 +22,25 @@ typedef enum Key {
Count_Key Count_Key
} Key; } Key;
bool KeyIsDown(Key key); typedef uint32_t CodePoint;
bool KeyIsUp(Key key);
bool KeyIsJustPressedOrRepeat(Key key);
bool KeyIsJustPressed(Key key);
bool KeyIsJustReleased(Key key);
bool InputGetNextPrintable(char const *out_key);
typedef struct Screen { bool KeyPressed(Key key);
void *handle; bool InputGetNextPrintable(CodePoint const *out_key);
} Screen;
typedef struct Window { typedef struct Window {
int width; int const width;
int height; int const height;
void *handle; CodePoint *characters;
Screen screen; Color *foreground;
Color *background;
} Window; } Window;
Screen ScreenGetFocused(); Window *WindowCreate();
int ScreenGetWidth(Screen screen); void WindowClear(Window *window, Color color);
int ScreenGetHeight(Screen screen); void WindowFlip(Window *window);
// Make a window specifically suitable for tools like launchers.
// Always on top, not resizable, closes on lost focus. // TODO: the platform layer would really update the keys being pressed, and
Window ScreenMakeStaticWindow(int x, int y, int pixel_width, int pixel_height); // receive a diff in the form of actions. print this line from here and change
void WindowClear(Color color); // colors at these points.
#endif /* PLATFORM */ #endif /* PLATFORM */