31 #include <glad/glad.h> 34 #define NK_IMPLEMENTATION 35 #define NK_INCLUDE_FIXED_TYPES 36 #define NK_INCLUDE_FONT_BAKING 37 #define NK_INCLUDE_DEFAULT_FONT 38 #define NK_INCLUDE_DEFAULT_ALLOCATOR 39 #define NK_INCLUDE_VERTEX_BUFFER_OUTPUT 40 #define NK_INCLUDE_STANDARD_VARARGS 41 #define NK_BUTTON_TRIGGER_ON_RELEASE 44 #define NK_GLFW_GL2_IMPLEMENTATION 53 fprintf(stderr,
"Error: %s\n", description);
67 color,
nk_rgb(255, 255, 255),
71 for (i = 0; i <
count; i++)
76 snprintf(buffer,
sizeof(buffer),
"#%u: %u (%0.5f) ",
77 i, values[i], values[i] / 65535.
f);
86 int main(
int argc,
char** argv)
92 struct nk_font_atlas* atlas;
93 float gamma_value = 1.f;
115 orig_ramp.
red = malloc(array_size);
116 orig_ramp.
green = malloc(array_size);
117 orig_ramp.
blue = malloc(array_size);
118 memcpy(orig_ramp.
red, ramp->
red, array_size);
119 memcpy(orig_ramp.
green, ramp->
green, array_size);
120 memcpy(orig_ramp.
blue, ramp->
blue, array_size);
139 area =
nk_rect(0.
f, 0.
f, (
float) width, (
float) height);
171 free(orig_ramp.
green);
172 free(orig_ramp.
blue);
NK_API int nk_begin(struct nk_context *ctx, const char *title, struct nk_rect bounds, nk_flags flags)
GLFWAPI void glfwGetWindowSize(GLFWwindow *window, int *width, int *height)
Retrieves the size of the client area of the specified window.
GLFWAPI void glfwSetGamma(GLFWmonitor *monitor, float gamma)
Generates a gamma ramp and sets it for the specified monitor.
The header of the GLFW 3 API.
GLFWAPI GLFWglproc glfwGetProcAddress(const char *procname)
Returns the address of the specified function for the current context.
void *(* GLADloadproc)(const char *name)
static GLFWwindow * window
static void error_callback(int error, const char *description)
struct GLFWmonitor GLFWmonitor
NK_API void nk_glfw3_shutdown(void)
GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun)
Sets the error callback.
NK_API void nk_glfw3_render(enum nk_anti_aliasing)
NK_API struct nk_color nk_rgb(int r, int g, int b)
#define GLFW_SCALE_TO_MONITOR
Window content area scaling window window hint.
std::size_t array_size(T BOOST_RANGE_ARRAY_REF()[sz])
GLFWAPI int glfwInit(void)
Initializes the GLFW library.
NK_API void nk_layout_row_dynamic(struct nk_context *ctx, float height, int cols)
#define GL_COLOR_BUFFER_BIT
NK_API void nk_glfw3_new_frame(void)
NK_API struct nk_rect nk_rect(float x, float y, float w, float h)
NK_API struct nk_context * nk_glfw3_init(GLFWwindow *win, enum nk_glfw_init_state)
GLFWAPI void glfwSwapInterval(int interval)
Sets the swap interval for the current context.
int main(int argc, char **argv)
NK_API int nk_chart_begin_colored(struct nk_context *, enum nk_chart_type, struct nk_color, struct nk_color active, int num, float min, float max)
GLint GLsizei GLsizei height
GLFWAPI void glfwSwapBuffers(GLFWwindow *window)
Swaps the front and back buffers of the specified window.
GLFWAPI void glfwMakeContextCurrent(GLFWwindow *window)
Makes the context of the specified window current for the calling thread.
GLFWAPI const GLFWgammaramp * glfwGetGammaRamp(GLFWmonitor *monitor)
Returns the current gamma ramp for the specified monitor.
NK_API void nk_tooltip(struct nk_context *, const char *)
GLAPI int gladLoadGLLoader(GLADloadproc)
static const textual_icon exit
GLFWAPI void glfwSetWindowShouldClose(GLFWwindow *window, int value)
Sets the close flag of the specified window.
NK_API int nk_slider_float(struct nk_context *, float min, float *val, float max, float step)
GLFWAPI GLFWwindow * glfwCreateWindow(int width, int height, const char *title, GLFWmonitor *monitor, GLFWwindow *share)
Creates a window and its associated context.
GLsizei const GLfloat * values
GLFWAPI void glfwWaitEventsTimeout(double timeout)
Waits with timeout until events are queued and processes them.
static void chart_ramp_array(struct nk_context *nk, struct nk_color color, int count, unsigned short int *values)
GLFWAPI GLFWmonitor * glfwGetPrimaryMonitor(void)
Returns the primary monitor.
GLFWAPI void glfwTerminate(void)
Terminates the GLFW library.
NK_API nk_flags nk_chart_push(struct nk_context *, float)
NK_API void nk_window_set_bounds(struct nk_context *, const char *name, struct nk_rect bounds)
NK_API void nk_glfw3_font_stash_end(void)
NK_API void nk_glfw3_font_stash_begin(struct nk_font_atlas **atlas)
NK_API void nk_end(struct nk_context *ctx)
static void key_callback(GLFWwindow *window, int key, int scancode, int action, int mods)
NK_API int nk_button_label(struct nk_context *, const char *title)
struct GLFWwindow GLFWwindow
GLFWAPI void glfwWindowHint(int hint, int value)
Sets the specified window hint to the desired value.
GLFWAPI void glfwSetGammaRamp(GLFWmonitor *monitor, const GLFWgammaramp *ramp)
Sets the current gamma ramp for the specified monitor.
NK_API void nk_chart_end(struct nk_context *)
GLFWAPI int glfwWindowShouldClose(GLFWwindow *window)
Checks the close flag of the specified window.