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