blob: 9eeddc885e80d56bb8cc175c34b4a95aec400ba6 [file] [log] [blame]
swissChilibb478f12020-08-07 20:45:07 -07001#pragma once
2
3#include <stdint.h>
swissChilicc27cfe2020-08-08 12:57:57 -07004#include <stdbool.h>
swissChilibb478f12020-08-07 20:45:07 -07005
swissChili94ba1f52020-08-08 11:39:10 -07006#ifndef SCREEN_ONLY_SDL
7
swissChilibb478f12020-08-07 20:45:07 -07008#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
swissChilibb478f12020-08-07 20:45:07 -070018void screen(struct nk_context *ctx, uint8_t *mem, uint8_t size);
swissChili94ba1f52020-08-08 11:39:10 -070019
20#endif
21
22#include <SDL2/SDL.h>
23
24
25typedef struct
26{
27 SDL_Window *win;
28 SDL_Renderer *r;
swissChilicc27cfe2020-08-08 12:57:57 -070029 SDL_Texture *tex;
swissChili94ba1f52020-08-08 11:39:10 -070030 uint8_t size;
31} sdl_screen_t;
32
33// draw the CPU screen
34sdl_screen_t new_sdl_screen(uint8_t size);
swissChilicc27cfe2020-08-08 12:57:57 -070035void free_sdl_screen(sdl_screen_t *scr);
36bool sdl_screen(sdl_screen_t *scr, uint8_t *mem, bool dirty);
37
38#ifndef NO_PTHREAD
swissChilib71e0272020-08-08 15:56:14 -070039
40#include <pthread.h>
41
42extern bool g_screen_thread_halt;
43
swissChilicc27cfe2020-08-08 12:57:57 -070044void *screen_thread(uint8_t *mem);
swissChilib71e0272020-08-08 15:56:14 -070045pthread_t start_screen_thread(uint8_t *mem);
46
swissChilicc27cfe2020-08-08 12:57:57 -070047#endif