Files
dotfiles/cmenu/platform.h
T
2026-07-18 00:10:14 +02:00

47 lines
862 B
C

#ifndef PLATFORM
#define PLATFORM
#include <stdint.h>
#include <stdbool.h>
typedef struct Color {
uint8_t r, g, b;
} Color;
#define WHITE ((Color){255,255,255})
#define BLACK ((Color){0,0,0})
typedef enum Key {
Key_backspace,
Key_ctrl,
Key_enter,
Key_h,
Key_n,
Key_p,
Key_y,
Count_Key
} Key;
typedef uint32_t CodePoint;
bool KeyPressed(Key key);
bool InputGetNextPrintable(CodePoint const *out_key);
typedef struct Window {
int const width;
int const height;
CodePoint *characters;
Color *foreground;
Color *background;
} Window;
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 */