Skip to content

Commit

Permalink
added missing files
Browse files Browse the repository at this point in the history
  • Loading branch information
TheGAzed committed Jul 17, 2024
1 parent 5bea264 commit 8047461
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 0 deletions.
31 changes: 31 additions & 0 deletions program/include/gui/default.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#ifndef GUI_DEFAULT_H
#define GUI_DEFAULT_H

#define NK_INCLUDE_FIXED_TYPES
#define NK_INCLUDE_STANDARD_IO
#define NK_INCLUDE_STANDARD_VARARGS
#define NK_INCLUDE_DEFAULT_ALLOCATOR
#define NK_INCLUDE_VERTEX_BUFFER_OUTPUT
#define NK_INCLUDE_FONT_BAKING
#define NK_INCLUDE_DEFAULT_FONT
#define NK_KEYSTATE_BASED_INPUT
#include <nuklear.h>

#include <structures/concrete/board.h>

#define WINDOW_WIDTH 500
#define WINDOW_HEIGHT 560

#define MAX_VERTEX_BUFFER 512 * 1024
#define MAX_ELEMENT_BUFFER 128 * 1024

struct nk_solver {
board_s board;
};

struct nk_super {
struct nk_context * context;
struct nk_solver solver;
};

#endif /* GUI_DEFAULT_H */
17 changes: 17 additions & 0 deletions program/include/gui/draw.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#ifndef GUI_DRAW_H
#define GUI_DRAW_H

#define NK_INCLUDE_FIXED_TYPES
#define NK_INCLUDE_STANDARD_IO
#define NK_INCLUDE_STANDARD_VARARGS
#define NK_INCLUDE_DEFAULT_ALLOCATOR
#define NK_INCLUDE_VERTEX_BUFFER_OUTPUT
#define NK_INCLUDE_FONT_BAKING
#define NK_INCLUDE_DEFAULT_FONT
#define NK_KEYSTATE_BASED_INPUT
#include <nuklear.h>
#include <nuklear_glfw_gl3.h>

void draw(struct nk_glfw * glfw);

#endif /* GUI_DRAW_H */
17 changes: 17 additions & 0 deletions program/include/gui/input.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#ifndef GUI_INPUT_H
#define GUI_INPUT_H

#define NK_INCLUDE_FIXED_TYPES
#define NK_INCLUDE_STANDARD_IO
#define NK_INCLUDE_STANDARD_VARARGS
#define NK_INCLUDE_DEFAULT_ALLOCATOR
#define NK_INCLUDE_VERTEX_BUFFER_OUTPUT
#define NK_INCLUDE_FONT_BAKING
#define NK_INCLUDE_DEFAULT_FONT
#define NK_KEYSTATE_BASED_INPUT
#include <nuklear.h>
#include <nuklear_glfw_gl3.h>

void input(struct nk_glfw * glfw);

#endif /* GUI_INPUT_H */
10 changes: 10 additions & 0 deletions program/source/gui/draw.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include <gui/draw.h>
#include <gui/default.h>
#include <instance/settings.h>

void draw(struct nk_glfw * glfw) {
glViewport(0, 0, WINDOW_HEIGHT, WINDOW_WIDTH);
glClear(GL_COLOR_BUFFER_BIT);
nk_glfw3_render(glfw, NK_ANTI_ALIASING_ON, MAX_VERTEX_BUFFER, MAX_ELEMENT_BUFFER);
glfwSwapBuffers(glfw->win);
}
6 changes: 6 additions & 0 deletions program/source/gui/input.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <gui/input.h>

void input(struct nk_glfw * glfw) {
glfwPollEvents();
nk_glfw3_new_frame(glfw);
}

0 comments on commit 8047461

Please sign in to comment.