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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#ifndef BASE_LINUX_H
#define BASE_LINUX_H
#define X11 1
typedef struct LinuxWindowHandle LinuxWindowHandle;
struct LinuxWindowHandle
{
Display *display;
Window window;
};
#if X11
internal LinuxWindowHandle x11_create_window(MemArena *arena, u32 window_height, u32 window_width, u32 disp_x, u32 disp_y);
internal void x11_draw(LinuxWindowHandle *s, s32 start_x, s32 end_x, s32 start_y, s32 end_y);
internal s32 x11_cleanup(LinuxWindowHandle *s);
internal s32 x11_read_input();
#define LinuxCreateWindow(arena, height, width, x, y) x11_create_window(arena, height, width, x, y)
// NOTE: DisplayWidth and DisplayHeight are internal x11 functions
#define LinuxGetDisplayWidth(display, screen) DisplayWidth(display, screen)
#define LinuxGetDisplayHeight(display, screen) DisplayHeight(display, screen)
#define LinuxLoadBitMapFromFile(display, window, path, width, height, out, hotspot_x, hotspot_y) XReadBitmapFile(display, window)
typedef struct Library Library;
struct Library
{
u64 data;
};
#elif WAYLAND
#else
#error compositor not defined
#endif
internal Library unix_library_load(MemArena *arena, String8 path);
internal void *unix_library_get_proc(Library *library, String8 proc_name);
internal int unix_library_close(Library *library);
internal b32 unix_file_exists(String8 path);
internal String8 unix_file_load(MemArena *arena, String8 path);
internal String8 unix_file_write(String8 data, String8 path);
internal void unix_log_with_args(const char *format, ...);
internal b32 unix_os_exit();
#endif // BASE_LINUX_H
|