summaryrefslogtreecommitdiff
path: root/userland/libgui/libgui.h
blob: d58c23c876f70fd060e074902589a2ea3ae3c2c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef LIBGUI_H
#define LIBGUI_H
#include <stddef.h>
#include <stdint.h>

typedef struct {
  int ws_socket;
  int bitmap_fd;
  uint32_t *bitmap_ptr;
  int x;
  int y;
  int sx;
  int sy;
} GUI_Window;

// Taken from drivers/keyboard.c
struct KEY_EVENT {
  char c;
  uint8_t mode;    // (shift (0 bit)) (alt (1 bit))
  uint8_t release; // 0 pressed, 1 released
};

typedef struct {
  int type;
  struct KEY_EVENT ev;
} WS_EVENT;

GUI_Window *GUI_CreateWindow(uint32_t x, uint32_t y, uint32_t sx, uint32_t sy);
void GUI_DrawFont(GUI_Window *w, uint32_t px, uint32_t py, const uint32_t c);
void GUI_UpdateWindow(GUI_Window *w);
void GUI_OverwriteFont(GUI_Window *w, uint32_t px, uint32_t py,
                       const uint32_t color);
void GUI_ClearScreen(GUI_Window *w, uint32_t color);
#endif