swissChili | bb478f1 | 2020-08-07 20:45:07 -0700 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <stdint.h> |
swissChili | cc27cfe | 2020-08-08 12:57:57 -0700 | [diff] [blame] | 4 | #include <stdbool.h> |
swissChili | bb478f1 | 2020-08-07 20:45:07 -0700 | [diff] [blame] | 5 | |
swissChili | 94ba1f5 | 2020-08-08 11:39:10 -0700 | [diff] [blame] | 6 | #ifndef SCREEN_ONLY_SDL |
| 7 | |
swissChili | bb478f1 | 2020-08-07 20:45:07 -0700 | [diff] [blame] | 8 | #undef NK_IMPLEMENTATION |
| 9 | #define NK_INCLUDE_FIXED_TYPES |
| 10 | #define NK_INCLUDE_STANDARD_IO |
| 11 | #define NK_INCLUDE_STANDARD_VARARGS |
| 12 | #define NK_INCLUDE_DEFAULT_ALLOCATOR |
| 13 | #define NK_INCLUDE_VERTEX_BUFFER_OUTPUT |
| 14 | #define NK_INCLUDE_FONT_BAKING |
| 15 | #define NK_INCLUDE_DEFAULT_FONT |
| 16 | #include "nuklear/nuklear.h" |
| 17 | |
swissChili | bb478f1 | 2020-08-07 20:45:07 -0700 | [diff] [blame] | 18 | void screen(struct nk_context *ctx, uint8_t *mem, uint8_t size); |
swissChili | 94ba1f5 | 2020-08-08 11:39:10 -0700 | [diff] [blame] | 19 | |
| 20 | #endif |
| 21 | |
| 22 | #include <SDL2/SDL.h> |
| 23 | |
| 24 | |
| 25 | typedef struct |
| 26 | { |
| 27 | SDL_Window *win; |
| 28 | SDL_Renderer *r; |
swissChili | cc27cfe | 2020-08-08 12:57:57 -0700 | [diff] [blame] | 29 | SDL_Texture *tex; |
swissChili | 94ba1f5 | 2020-08-08 11:39:10 -0700 | [diff] [blame] | 30 | uint8_t size; |
| 31 | } sdl_screen_t; |
| 32 | |
| 33 | // draw the CPU screen |
| 34 | sdl_screen_t new_sdl_screen(uint8_t size); |
swissChili | cc27cfe | 2020-08-08 12:57:57 -0700 | [diff] [blame] | 35 | void free_sdl_screen(sdl_screen_t *scr); |
| 36 | bool sdl_screen(sdl_screen_t *scr, uint8_t *mem, bool dirty); |
| 37 | |
| 38 | #ifndef NO_PTHREAD |
swissChili | b71e027 | 2020-08-08 15:56:14 -0700 | [diff] [blame] | 39 | |
| 40 | #include <pthread.h> |
| 41 | |
| 42 | extern bool g_screen_thread_halt; |
| 43 | |
swissChili | cc27cfe | 2020-08-08 12:57:57 -0700 | [diff] [blame] | 44 | void *screen_thread(uint8_t *mem); |
swissChili | b71e027 | 2020-08-08 15:56:14 -0700 | [diff] [blame] | 45 | pthread_t start_screen_thread(uint8_t *mem); |
| 46 | |
swissChili | cc27cfe | 2020-08-08 12:57:57 -0700 | [diff] [blame] | 47 | #endif |