diff options
Diffstat (limited to 'source/platform')
| -rw-r--r-- | source/platform/platform.c | 12 | ||||
| -rw-r--r-- | source/platform/platform.h | 56 | ||||
| -rw-r--r-- | source/platform/platform_include.h | 7 |
3 files changed, 75 insertions, 0 deletions
diff --git a/source/platform/platform.c b/source/platform/platform.c new file mode 100644 index 0000000..2e7bbad --- /dev/null +++ b/source/platform/platform.c | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | internal inline void | ||
| 2 | sleep_ms(long ms) | ||
| 3 | { | ||
| 4 | struct timespec ts; | ||
| 5 | ts.tv_sec = ms / 1000; | ||
| 6 | ts.tv_nsec = (ms % 1000) * 1000000L; | ||
| 7 | |||
| 8 | while (nanosleep(&ts, &ts)) | ||
| 9 | { | ||
| 10 | NULL; | ||
| 11 | } | ||
| 12 | } | ||
diff --git a/source/platform/platform.h b/source/platform/platform.h new file mode 100644 index 0000000..da8e065 --- /dev/null +++ b/source/platform/platform.h | |||
| @@ -0,0 +1,56 @@ | |||
| 1 | #ifndef PLATFORM_H | ||
| 2 | #define PLATFORM_H | ||
| 3 | |||
| 4 | #define NIL 0 | ||
| 5 | |||
| 6 | #include <X11/X.h> | ||
| 7 | #include <X11/Xlib.h> | ||
| 8 | #include <X11/keysym.h> | ||
| 9 | #include <time.h> | ||
| 10 | #include <unistd.h> | ||
| 11 | |||
| 12 | typedef struct WindowProperties WindowProperties; | ||
| 13 | struct WindowProperties | ||
| 14 | { | ||
| 15 | i32 x; | ||
| 16 | i32 y; | ||
| 17 | u32 height; | ||
| 18 | u32 width; | ||
| 19 | u32 border_width; | ||
| 20 | i32 window_depth; | ||
| 21 | u32 window_class; | ||
| 22 | u64 value_mask; | ||
| 23 | |||
| 24 | }; | ||
| 25 | |||
| 26 | typedef struct vertex vertex; | ||
| 27 | |||
| 28 | struct vertex | ||
| 29 | { | ||
| 30 | i32 x; | ||
| 31 | i32 y; | ||
| 32 | i32 z; | ||
| 33 | }; | ||
| 34 | |||
| 35 | typedef struct display_pos display_pos; | ||
| 36 | |||
| 37 | struct display_pos | ||
| 38 | { | ||
| 39 | i32 x; | ||
| 40 | i32 y; | ||
| 41 | |||
| 42 | }; | ||
| 43 | |||
| 44 | typedef struct pos pos; | ||
| 45 | struct pos | ||
| 46 | { | ||
| 47 | i32 x; | ||
| 48 | i32 y; | ||
| 49 | i32 z; | ||
| 50 | |||
| 51 | } ; | ||
| 52 | |||
| 53 | |||
| 54 | |||
| 55 | |||
| 56 | #endif /* PLATFORM_H */ | ||
diff --git a/source/platform/platform_include.h b/source/platform/platform_include.h new file mode 100644 index 0000000..886c6b8 --- /dev/null +++ b/source/platform/platform_include.h | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | #ifndef PLATFORM_INCLUDE_H | ||
| 2 | #define PLATFORM_INCLUDE_H | ||
| 3 | |||
| 4 | #include "platform.h" | ||
| 5 | #include "platform.c" | ||
| 6 | |||
| 7 | #endif /* PLATFORM_INCLUDE_H */ | ||
