33 #ifndef NUKLEAR_CROSS_H
34 #define NUKLEAR_CROSS_H
46 #define NK_INCLUDE_FIXED_TYPES
47 #define NK_INCLUDE_DEFAULT_ALLOCATOR
48 #define NK_INCLUDE_VERTEX_BUFFER_OUTPUT
49 #define NK_INCLUDE_FONT_BAKING
50 #define NK_INCLUDE_STANDARD_IO
51 #if !defined(NKC_DISABLE_DEFAULT_FONT)
52 #define NK_INCLUDE_DEFAULT_FONT
55 #if defined(NKC_IMPLEMENTATION) && !defined(NK_IMPLEMENTATION)
56 #define NK_IMPLEMENTATION
86 #define NKC_INITED 1234
89 #define MAX_VERTEX_MEMORY 512 * 1024
90 #define MAX_ELEMENT_MEMORY 128 * 1024
93 #if defined(__EMSCRIPTEN__)
95 #undef NKC_OPENGL_VERSION
96 #define NKC_OPENGL_VERSION NGL_ES2
98 #if defined(NKC_USE_OPENGL)
99 #define NKC_OPENGL_VERSION NKC_USE_OPENGL
101 #define NKC_OPENGL_VERSION 2
135 #include "nkc_frontend/nkc_gdip.h"
137 #include "nkc_frontend/nkc_sdl.h"
139 #include "nkc_frontend/nkc_glfw.h"
141 #include "nkc_frontend/nkc_xlib.h"
145 #if defined(WIN32) && !defined(__EMSCRIPTEN__)
146 #include "nkc_frontend/nkc_gdip.h"
149 #include "nkc_frontend/nkc_sdl.h"
167 NK_API
void*
nkc_rdie(
const char *fmt, ...);
179 NK_API
struct nk_context *
nkc_init(
struct nkc* nkcHandle,
const char* title,
190 NK_API
struct nk_context*
nkc_get_ctx(
struct nkc* nkcHandle);
203 NK_API
void nkc_render_bg(
struct nkc* nkcHandle,
struct nk_color bgColor);
204 NK_API
void nkc_render_gui(
struct nkc* nkcHandle);
207 NK_API
void nkc_render(
struct nkc* nkcHandle,
struct nk_color bgColor);
219 NK_API
void nkc_style_set_font(
struct nkc* nkcHandle,
const struct nk_user_font* font);
227 NK_API
struct nk_user_font*
nkc_load_font_file(
struct nkc* nkcHandle,
const char* filename,
float size,
228 const nk_rune *symbolsRange);
229 NK_API
struct nk_user_font* nkc_load_font_memory(
struct nkc* nkcHandle,
const void* membuf,
int membufSize,
230 float size,
const nk_rune *symbolsRange);
246 #if !defined(NKC_DISABLE_IMAGES)
247 NK_API
struct nk_image nkc_load_image_file(struct nkc* nkcHandle,
const char* filename);
248 NK_API
struct nk_image nkc_load_image_memory(struct nkc* nkcHandle,
const void* membuf,
int membufSize);
249 NK_API
void nkc_image_free(
struct nk_image* img);
274 void (*mainLoopFunc)(
void* loopArg),
void* loopArg);
287 #include "nkc_frontend/helpers/nkc_file.h"
319 #if defined(NKC_IMPLEMENTATION)
320 NK_API
void nkc_render(
struct nkc* nkcHandle,
struct nk_color bgColor){
321 nkc_render_bg(nkcHandle, bgColor);
322 nkc_render_gui(nkcHandle);
325 NK_API
struct nk_context*
nkc_get_ctx(
struct nkc* nkcHandle){
326 return nkcHandle->ctx;
329 NK_API
void nkc_style_set_font(
struct nkc* nkcHandle,
const struct nk_user_font* font){
330 if(font) nk_style_set_font(nkcHandle->ctx, font);
333 #if !defined(__EMSCRIPTEN__)
335 void (*mainLoopFunc)(
void* loopArg),
void* loopArg)
337 nkcHandle->keepRunning = nk_true;
338 while (nkcHandle->keepRunning)
339 mainLoopFunc(loopArg);
343 nkcHandle->keepRunning = nk_false;
size_t nkc_stdfile_size(FILE *f)
Returns file size in bytes.
Definition: nuklear_cross.h:126
NK_API char nkc_get_key_char(int code)
Converts keyboard code to it's latin character (if have)
Definition: nuklear_cross.h:112
Definition: nuklear_cross.h:82
Definition: nuklear_cross.h:80
size_t nkc_file_size(const char *filename)
nkc_window_mode
Window mode constants, passed to initialization.
Definition: nuklear_cross.h:78
NK_API void nkc_shutdown(struct nkc *nkcHandle)
Finalizing.
NK_API void nkc_style_set_font(struct nkc *nkcHandle, const struct nk_user_font *font)
NK_API struct nk_context * nkc_get_ctx(struct nkc *nkcHandle)
NK_API void nkc_set_main_loop(struct nkc *nkcHandle, void(*mainLoopFunc)(void *loopArg), void *loopArg)
Starts the 'infinite' main loop. Required for Emscipten only.
nkc_event_type
Definition: nuklear_cross.h:109
Definition: nuklear_cross.h:111
NK_API int nkc_get_desktop_size(struct nkc *nkcHandle, int *width, int *height)
Gets the desktop size in pixels. In browsers - draw area.
NK_API void nkc_stop_main_loop(struct nkc *nkcHandle)
Definition: nuklear_cross.h:83
Definition: nuklear_cross.h:121
Definition: nuklear_cross.h:79
void nkc_file_post_write()
int nkc_file_exists(const char *filename)
NK_API union nkc_event nkc_poll_events(struct nkc *nkcHandle)
Poll window's events in a loop.
void nkc_mount_write(const char *folder)
Mounts local storage folder for writing. Useful for Emscripten only.
NK_API void * nkc_rdie(const char *fmt,...)
Fatal error. Application exit. Die with message. Printf-like.
NK_API struct nk_user_font * nkc_load_font_file(struct nkc *nkcHandle, const char *filename, float size, const nk_rune *symbolsRange)
Load font from TTF-file from disk.
NK_API void nkc_render(struct nkc *nkcHandle, struct nk_color bgColor)
Definition: nuklear_cross.h:110
NK_API struct nk_context * nkc_init(struct nkc *nkcHandle, const char *title, int width, int height, enum nkc_window_mode windowMode)
Initialize the library, create the operation system window.
Definition: nuklear_cross.h:81
Definition: nuklear_cross.h:113
Definition: nuklear_cross.h:116