sdl_renderer: Update code

This commit is contained in:
Rob Loach 2022-01-06 21:55:20 -05:00
parent 1f562ecb94
commit cd4990834f
No known key found for this signature in database
GPG Key ID: 627C60834A74A21A
3 changed files with 22 additions and 14 deletions

View File

@ -9,7 +9,7 @@
#include <limits.h> #include <limits.h>
#include <time.h> #include <time.h>
#include <SDL.h> #include <SDL2/SDL.h>
#define NK_INCLUDE_FIXED_TYPES #define NK_INCLUDE_FIXED_TYPES
#define NK_INCLUDE_STANDARD_IO #define NK_INCLUDE_STANDARD_IO
@ -19,9 +19,9 @@
#define NK_INCLUDE_FONT_BAKING #define NK_INCLUDE_FONT_BAKING
#define NK_INCLUDE_DEFAULT_FONT #define NK_INCLUDE_DEFAULT_FONT
#define NK_IMPLEMENTATION #define NK_IMPLEMENTATION
#define NK_SDL_GL2_IMPLEMENTATION #define NK_SDL_RENDERER_IMPLEMENTATION
#include "../../nuklear.h" #include "../../nuklear.h"
#include "nuklear_sdl_sdlrenderer.h" #include "nuklear_sdl_renderer.h"
#define WINDOW_WIDTH 1200 #define WINDOW_WIDTH 1200
#define WINDOW_HEIGHT 800 #define WINDOW_HEIGHT 800
@ -42,6 +42,7 @@
#ifdef INCLUDE_ALL #ifdef INCLUDE_ALL
#define INCLUDE_STYLE #define INCLUDE_STYLE
#define INCLUDE_CALCULATOR #define INCLUDE_CALCULATOR
#define INCLUDE_CANVAS
#define INCLUDE_OVERVIEW #define INCLUDE_OVERVIEW
#define INCLUDE_NODE_EDITOR #define INCLUDE_NODE_EDITOR
#endif #endif
@ -52,6 +53,9 @@
#ifdef INCLUDE_CALCULATOR #ifdef INCLUDE_CALCULATOR
#include "../calculator.c" #include "../calculator.c"
#endif #endif
#ifdef INCLUDE_CANVAS
#include "../canvas.c"
#endif
#ifdef INCLUDE_OVERVIEW #ifdef INCLUDE_OVERVIEW
#include "../overview.c" #include "../overview.c"
#endif #endif
@ -182,6 +186,9 @@ main(int argc, char *argv[])
#ifdef INCLUDE_CALCULATOR #ifdef INCLUDE_CALCULATOR
calculator(ctx); calculator(ctx);
#endif #endif
#ifdef INCLUDE_CANVAS
canvas(ctx);
#endif
#ifdef INCLUDE_OVERVIEW #ifdef INCLUDE_OVERVIEW
overview(ctx); overview(ctx);
#endif #endif

View File

@ -1,5 +1,5 @@
/* /*
* Nuklear - 1.32.0 - public domain * Nuklear - 4.9.4 - public domain
*/ */
/* /*
* ============================================================== * ==============================================================
@ -8,10 +8,10 @@
* *
* =============================================================== * ===============================================================
*/ */
#ifndef NK_SDL_GL2_H_ #ifndef NK_SDL_RENDERER_H_
#define NK_SDL_GL2_H_ #define NK_SDL_RENDERER_H_
#include <SDL.h> #include <SDL2/SDL.h>
NK_API struct nk_context* nk_sdl_init(SDL_Window *win, SDL_Renderer *renderer); NK_API struct nk_context* nk_sdl_init(SDL_Window *win, SDL_Renderer *renderer);
NK_API void nk_sdl_font_stash_begin(struct nk_font_atlas **atlas); NK_API void nk_sdl_font_stash_begin(struct nk_font_atlas **atlas);
NK_API void nk_sdl_font_stash_end(void); NK_API void nk_sdl_font_stash_end(void);
@ -19,7 +19,8 @@ NK_API int nk_sdl_handle_event(SDL_Event *evt);
NK_API void nk_sdl_render(enum nk_anti_aliasing); NK_API void nk_sdl_render(enum nk_anti_aliasing);
NK_API void nk_sdl_shutdown(void); NK_API void nk_sdl_shutdown(void);
#endif #endif /* NK_SDL_RENDERER_H_ */
/* /*
* ============================================================== * ==============================================================
* *
@ -27,7 +28,7 @@ NK_API void nk_sdl_shutdown(void);
* *
* =============================================================== * ===============================================================
*/ */
#ifdef NK_SDL_GL2_IMPLEMENTATION #ifdef NK_SDL_RENDERER_IMPLEMENTATION
struct nk_sdl_device { struct nk_sdl_device {
struct nk_buffer cmds; struct nk_buffer cmds;
@ -324,4 +325,4 @@ void nk_sdl_shutdown(void)
memset(&sdl, 0, sizeof(sdl)); memset(&sdl, 0, sizeof(sdl));
} }
#endif #endif /* NK_SDL_RENDERER_IMPLEMENTATION */