blob: da3dd44a67172231219e2f2544036d4173a0a17d [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>
swissChilic6b4f7e2020-08-09 16:36:36 -07005#include <pthread.h>
swissChilibb478f12020-08-07 20:45:07 -07006
swissChili94ba1f52020-08-08 11:39:10 -07007#ifndef SCREEN_ONLY_SDL
8
swissChilibb478f12020-08-07 20:45:07 -07009#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
swissChilibb478f12020-08-07 20:45:07 -070019void screen(struct nk_context *ctx, uint8_t *mem, uint8_t size);
swissChili94ba1f52020-08-08 11:39:10 -070020
21#endif
22
23#include <SDL2/SDL.h>
24
25
26typedef struct
27{
28 SDL_Window *win;
29 SDL_Renderer *r;
swissChilicc27cfe2020-08-08 12:57:57 -070030 SDL_Texture *tex;
swissChili94ba1f52020-08-08 11:39:10 -070031 uint8_t size;
32} sdl_screen_t;
33
34// draw the CPU screen
35sdl_screen_t new_sdl_screen(uint8_t size);
swissChilicc27cfe2020-08-08 12:57:57 -070036void free_sdl_screen(sdl_screen_t *scr);
37bool sdl_screen(sdl_screen_t *scr, uint8_t *mem, bool dirty);
38
swissChilib71e0272020-08-08 15:56:14 -070039extern bool g_screen_thread_halt;
40
swissChilicc27cfe2020-08-08 12:57:57 -070041void *screen_thread(uint8_t *mem);
swissChilib71e0272020-08-08 15:56:14 -070042pthread_t start_screen_thread(uint8_t *mem);