From c9914b78272095edc8f631c711c9dfcbb6dab804 Mon Sep 17 00:00:00 2001 From: Ivar Fatland Date: Sat, 18 Jul 2026 00:10:14 +0200 Subject: [PATCH] changes in API design --- cmenu/platform.h | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/cmenu/platform.h b/cmenu/platform.h index 89adcb5..b27eaf0 100644 --- a/cmenu/platform.h +++ b/cmenu/platform.h @@ -22,30 +22,25 @@ typedef enum Key { Count_Key } Key; -bool KeyIsDown(Key key); -bool KeyIsUp(Key key); -bool KeyIsJustPressedOrRepeat(Key key); -bool KeyIsJustPressed(Key key); -bool KeyIsJustReleased(Key key); -bool InputGetNextPrintable(char const *out_key); +typedef uint32_t CodePoint; -typedef struct Screen { - void *handle; -} Screen; +bool KeyPressed(Key key); +bool InputGetNextPrintable(CodePoint const *out_key); typedef struct Window { - int width; - int height; - void *handle; - Screen screen; + int const width; + int const height; + CodePoint *characters; + Color *foreground; + Color *background; } Window; -Screen ScreenGetFocused(); -int ScreenGetWidth(Screen screen); -int ScreenGetHeight(Screen screen); -// Make a window specifically suitable for tools like launchers. -// Always on top, not resizable, closes on lost focus. -Window ScreenMakeStaticWindow(int x, int y, int pixel_width, int pixel_height); -void WindowClear(Color color); +Window *WindowCreate(); +void WindowClear(Window *window, Color color); +void WindowFlip(Window *window); + +// TODO: the platform layer would really update the keys being pressed, and +// receive a diff in the form of actions. print this line from here and change +// colors at these points. #endif /* PLATFORM */