|
|
|
@ -1,44 +1,41 @@
|
|
|
|
|
#include "nuke.h"
|
|
|
|
|
|
|
|
|
|
#include "openglrender.h"
|
|
|
|
|
#include "editor.h"
|
|
|
|
|
#include "window.h"
|
|
|
|
|
#include "resources.h"
|
|
|
|
|
#include "registry.h"
|
|
|
|
|
#include "datastream.h"
|
|
|
|
|
#include "gameobject.h"
|
|
|
|
|
#include "2dphysics.h"
|
|
|
|
|
#include "camera.h"
|
|
|
|
|
#include "config.h"
|
|
|
|
|
#include "datastream.h"
|
|
|
|
|
#include "debug.h"
|
|
|
|
|
#include "debugdraw.h"
|
|
|
|
|
#include "editor.h"
|
|
|
|
|
#include "editorstate.h"
|
|
|
|
|
#include "gameobject.h"
|
|
|
|
|
#include "input.h"
|
|
|
|
|
#include "level.h"
|
|
|
|
|
#include "math.h"
|
|
|
|
|
#include "openglrender.h"
|
|
|
|
|
#include "registry.h"
|
|
|
|
|
#include "resources.h"
|
|
|
|
|
#include "script.h"
|
|
|
|
|
#include "shader.h"
|
|
|
|
|
#include "sound.h"
|
|
|
|
|
#include "sprite.h"
|
|
|
|
|
#include "texture.h"
|
|
|
|
|
#include "vec.h"
|
|
|
|
|
#include "window.h"
|
|
|
|
|
#include <chipmunk/chipmunk.h>
|
|
|
|
|
#include <ctype.h>
|
|
|
|
|
#include <dirent.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include "editorstate.h"
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include "input.h"
|
|
|
|
|
#include "2dphysics.h"
|
|
|
|
|
#include "debugdraw.h"
|
|
|
|
|
#include "level.h"
|
|
|
|
|
#include "texture.h"
|
|
|
|
|
#include "sprite.h"
|
|
|
|
|
#include <chipmunk/chipmunk.h>
|
|
|
|
|
#include "math.h"
|
|
|
|
|
#include <ctype.h>
|
|
|
|
|
#include "config.h"
|
|
|
|
|
#include "vec.h"
|
|
|
|
|
#include "debug.h"
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include "script.h"
|
|
|
|
|
#include "sound.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define __USE_XOPEN_EXTENDED 1
|
|
|
|
|
#include "ftw.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <stb_ds.h>
|
|
|
|
|
#define ASSET_TEXT_BUF 1024 * 1024 /* 1 MB buffer for editing text files */
|
|
|
|
|
|
|
|
|
|
struct gameproject *cur_project;
|
|
|
|
|
struct vec *projects;
|
|
|
|
|
struct gameproject *cur_project = NULL;
|
|
|
|
|
struct vec *projects = NULL;
|
|
|
|
|
static char setpath[MAXPATH];
|
|
|
|
|
|
|
|
|
|
// Menus
|
|
|
|
@ -88,22 +85,18 @@ static struct vec *levels = NULL;
|
|
|
|
|
|
|
|
|
|
static const int ASSET_WIN_SIZE = 512;
|
|
|
|
|
|
|
|
|
|
static const char *get_extension(const char *filepath)
|
|
|
|
|
{
|
|
|
|
|
static const char *get_extension(const char *filepath) {
|
|
|
|
|
return strrchr(filepath, '.');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
check_if_resource(const char *fpath, const struct stat *sb, int typeflag,
|
|
|
|
|
struct FTW *ftwbuf)
|
|
|
|
|
{
|
|
|
|
|
static int check_if_resource(const char *fpath, const struct stat *sb,
|
|
|
|
|
int typeflag, struct FTW *ftwbuf) {
|
|
|
|
|
if (typeflag == FTW_F) {
|
|
|
|
|
const char *ext = get_extension(fpath);
|
|
|
|
|
if (ext && is_allowed_extension(ext)) {
|
|
|
|
|
struct fileasset *newasset =
|
|
|
|
|
(struct fileasset *)calloc(1, sizeof(struct fileasset));
|
|
|
|
|
newasset->filename =
|
|
|
|
|
(char *) malloc(sizeof(char) * strlen(fpath) + 1);
|
|
|
|
|
newasset->filename = (char *)malloc(sizeof(char) * strlen(fpath) + 1);
|
|
|
|
|
strcpy(newasset->filename, fpath);
|
|
|
|
|
newasset->extension_len = strlen(ext);
|
|
|
|
|
newasset->searched = true;
|
|
|
|
@ -114,20 +107,15 @@ check_if_resource(const char *fpath, const struct stat *sb, int typeflag,
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void print_files_in_directory(const char *dirpath)
|
|
|
|
|
{
|
|
|
|
|
static void print_files_in_directory(const char *dirpath) {
|
|
|
|
|
int nflags = 0;
|
|
|
|
|
shfree(assets);
|
|
|
|
|
nftw(dirpath, &check_if_resource, 10, nflags);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void get_all_files()
|
|
|
|
|
{
|
|
|
|
|
print_files_in_directory(DATA_PATH);
|
|
|
|
|
}
|
|
|
|
|
static void get_all_files() { print_files_in_directory(DATA_PATH); }
|
|
|
|
|
|
|
|
|
|
static int *compute_prefix_function(const char *str)
|
|
|
|
|
{
|
|
|
|
|
static int *compute_prefix_function(const char *str) {
|
|
|
|
|
int str_len = strlen(str);
|
|
|
|
|
int *pi = (int *)malloc(sizeof(int) * str_len);
|
|
|
|
|
pi[0] = 0;
|
|
|
|
@ -146,8 +134,7 @@ static int *compute_prefix_function(const char *str)
|
|
|
|
|
return pi;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool kmp_match(const char *search, const char *text, int *pi)
|
|
|
|
|
{
|
|
|
|
|
static bool kmp_match(const char *search, const char *text, int *pi) {
|
|
|
|
|
int s_len = strlen(search);
|
|
|
|
|
int t_len = strlen(text);
|
|
|
|
|
// int *pi = compute_prefix_function(search);
|
|
|
|
@ -172,10 +159,7 @@ static bool kmp_match(const char *search, const char *text, int *pi)
|
|
|
|
|
return found;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int MyCallback()//ImGuiInputTextCallbackData * data)
|
|
|
|
|
{
|
|
|
|
|
static int MyCallback() {
|
|
|
|
|
/*
|
|
|
|
|
if (data->EventFlag == ImGuiInputTextFlags_CallbackCompletion) {
|
|
|
|
|
data->InsertChars(data->CursorPos, "..");
|
|
|
|
@ -227,7 +211,9 @@ static int TextEditCallback()//ImGuiInputTextCallbackData * data)
|
|
|
|
|
|
|
|
|
|
while (*c != '\n')
|
|
|
|
|
c--;
|
|
|
|
|
|
|
|
|
|
c++;
|
|
|
|
|
|
|
|
|
|
if (isblank(*c)) {
|
|
|
|
|
char *ce = c;
|
|
|
|
|
|
|
|
|
@ -244,21 +230,23 @@ static int TextEditCallback()//ImGuiInputTextCallbackData * data)
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void editor_save()
|
|
|
|
|
{
|
|
|
|
|
void editor_save() {
|
|
|
|
|
FILE *feditor = fopen(editor_filename, "w+");
|
|
|
|
|
fwrite(&editor, sizeof(editor), 1, feditor);
|
|
|
|
|
fclose(feditor);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void edit_input_cb(GLFWwindow *w, int key, int scancode, int action, int mods)
|
|
|
|
|
{
|
|
|
|
|
if (editor_wantkeyboard()) return;
|
|
|
|
|
static void edit_input_cb(GLFWwindow *w, int key, int scancode, int action, int mods) {
|
|
|
|
|
if (editor_wantkeyboard())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (action != GLFW_PRESS)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
switch (key) {
|
|
|
|
|
case GLFW_KEY_ESCAPE:
|
|
|
|
|
quit = true;
|
|
|
|
|
editor_save_projects();
|
|
|
|
|
//editor_save_projects();
|
|
|
|
|
editor_save();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
@ -359,13 +347,12 @@ static void edit_input_cb(GLFWwindow *w, int key, int scancode, int action, int
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void edit_mouse_cb(GLFWwindow *w, int button, int action, int mods)
|
|
|
|
|
{
|
|
|
|
|
if (editor_wantkeyboard()) return;
|
|
|
|
|
static void edit_mouse_cb(GLFWwindow *w, int button, int action, int mods) {
|
|
|
|
|
if (editor_wantkeyboard())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (action == GLFW_PRESS) {
|
|
|
|
|
switch (button) {
|
|
|
|
@ -400,11 +387,7 @@ static void edit_mouse_cb(GLFWwindow *w, int button, int action, int mods)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void editor_init(struct mSDLWindow *window)
|
|
|
|
|
{
|
|
|
|
|
projects = vec_make(sizeof(struct gameproject), 5);
|
|
|
|
|
void editor_init(struct mSDLWindow *window) {
|
|
|
|
|
levels = vec_make(MAXNAME, 10);
|
|
|
|
|
editor_load_projects();
|
|
|
|
|
|
|
|
|
@ -417,38 +400,29 @@ void editor_init(struct mSDLWindow *window)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nuke_init(window);
|
|
|
|
|
|
|
|
|
|
window->nuke_gui = editor_render;
|
|
|
|
|
glfwSetKeyCallback(window->window, edit_input_cb);
|
|
|
|
|
glfwSetMouseButtonCallback(window->window, edit_mouse_cb);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: Implement
|
|
|
|
|
int editor_wantkeyboard()
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
int editor_wantkeyboard() { return 0; }
|
|
|
|
|
|
|
|
|
|
const int nuk_std = NK_WINDOW_BORDER | NK_WINDOW_MOVABLE | NK_WINDOW_SCALABLE |
|
|
|
|
|
NK_WINDOW_MINIMIZABLE | NK_WINDOW_TITLE;
|
|
|
|
|
|
|
|
|
|
const struct nk_rect nk_rect_std = {250, 250, 250, 250};
|
|
|
|
|
|
|
|
|
|
void editor_project_gui()
|
|
|
|
|
{
|
|
|
|
|
void editor_project_gui() {
|
|
|
|
|
/* Grid, etc */
|
|
|
|
|
if (grid1_draw)
|
|
|
|
|
draw_grid(grid1_width, grid1_span);
|
|
|
|
|
if (grid2_draw)
|
|
|
|
|
draw_grid(grid2_width, grid2_span);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (debugDrawPhysics) {
|
|
|
|
|
/*
|
|
|
|
|
for (int i = 0; i < number_of_gameobjects(); i++)
|
|
|
|
|
phys2d_dbgdrawcircle(objects[i]->circle);
|
|
|
|
|
*/
|
|
|
|
|
// for (int i = 0; i < number_of_gameobjects(); i++)
|
|
|
|
|
// phys2d_dbgdrawcircle(objects[i]->circle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static char text[3][64];
|
|
|
|
@ -459,50 +433,16 @@ void editor_project_gui()
|
|
|
|
|
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
if (nk_begin(ctx, "Grid Demo", nk_rect(600, 350, 275, 250),
|
|
|
|
|
NK_WINDOW_TITLE|NK_WINDOW_BORDER|NK_WINDOW_MOVABLE|
|
|
|
|
|
NK_WINDOW_NO_SCROLLBAR))
|
|
|
|
|
{
|
|
|
|
|
nk_layout_row_dynamic(ctx, 25, 2);
|
|
|
|
|
static struct wav ss;
|
|
|
|
|
|
|
|
|
|
if (nk_button_label(ctx, "Load sound")) {
|
|
|
|
|
ss = make_sound("alert.wav");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (nk_button_label(ctx, "Play sound")) {
|
|
|
|
|
play_sound(&ss);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nk_layout_row_dynamic(ctx, 30, 2);
|
|
|
|
|
nk_label(ctx, "Floating point:", NK_TEXT_RIGHT);
|
|
|
|
|
nk_edit_string(ctx, NK_EDIT_FIELD, text[0], &text_len[0], 64, nk_filter_float);
|
|
|
|
|
nk_label(ctx, "Hexadecimal:", NK_TEXT_RIGHT);
|
|
|
|
|
nk_edit_string(ctx, NK_EDIT_FIELD, text[1], &text_len[1], 64, nk_filter_hex);
|
|
|
|
|
nk_label(ctx, "Binary:", NK_TEXT_RIGHT);
|
|
|
|
|
nk_edit_string(ctx, NK_EDIT_FIELD, text[2], &text_len[2], 64, nk_filter_binary);
|
|
|
|
|
nk_label(ctx, "Checkbox:", NK_TEXT_RIGHT);
|
|
|
|
|
nk_checkbox_label(ctx, "Check me", &check);
|
|
|
|
|
nk_label(ctx, "Combobox:", NK_TEXT_RIGHT);
|
|
|
|
|
if (nk_combo_begin_label(ctx, items[selected_item], nk_vec2(nk_widget_width(ctx), 200))) {
|
|
|
|
|
nk_layout_row_dynamic(ctx, 25, 1);
|
|
|
|
|
for (i = 0; i < 3; ++i)
|
|
|
|
|
if (nk_combo_item_label(ctx, items[i], NK_TEXT_LEFT))
|
|
|
|
|
selected_item = i;
|
|
|
|
|
nk_combo_end(ctx);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
nk_end(ctx);
|
|
|
|
|
|
|
|
|
|
if (nk_begin(ctx, "Menu Demo", nk_rect(600, 350, 275, 250), nuk_std)) {
|
|
|
|
|
nk_menubar_begin(ctx);
|
|
|
|
|
|
|
|
|
|
nk_layout_row_dynamic(ctx, 30, 4);
|
|
|
|
|
/*
|
|
|
|
|
nk_layout_row_dynamic(ctx, 30, 2);
|
|
|
|
|
|
|
|
|
|
char bbbuf[256];
|
|
|
|
|
snprintf(bbbuf, 256, "Current level: %s", current_level[0] == '\0' ? "Level not saved!" : current_level);
|
|
|
|
|
|
|
|
|
|
nk_label(ctx, bbbuf, NK_TEXT_LEFT);
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
if (nk_menu_begin_label(ctx, "Windows", NK_TEXT_LEFT, nk_vec2(100, 200))) {
|
|
|
|
|
nk_layout_row_dynamic(ctx, 30, 1);
|
|
|
|
|
|
|
|
|
@ -538,18 +478,18 @@ if (nk_begin(ctx, "Menu Demo", nk_rect(600, 350, 275, 250), nuk_std)) {
|
|
|
|
|
get_levels();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nk_edit_string_zero_terminated(ctx, NK_EDIT_SIMPLE, levelname, MAXNAME-1, nk_filter_default);
|
|
|
|
|
nk_edit_string_zero_terminated(ctx, NK_EDIT_SIMPLE, levelname,
|
|
|
|
|
MAXNAME - 1, nk_filter_default);
|
|
|
|
|
|
|
|
|
|
vec_walk(levels, (void (*)(void *)) & editor_level_btn);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nk_menubar_end(ctx);
|
|
|
|
|
}
|
|
|
|
|
nk_end(ctx);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (editor.showExport && nk_begin(ctx, "Export and Bake", nk_rect_std, nuk_std)) {
|
|
|
|
|
if (editor.showExport &&
|
|
|
|
|
nk_begin(ctx, "Export and Bake", nk_rect_std, nuk_std)) {
|
|
|
|
|
|
|
|
|
|
if (nk_button_label(ctx, "Bake")) {
|
|
|
|
|
}
|
|
|
|
@ -559,29 +499,29 @@ nk_end(ctx);
|
|
|
|
|
nk_end(ctx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Shadow map vars
|
|
|
|
|
if (nk_begin(ctx, "Lighting options", nk_rect_std, nuk_std)) {
|
|
|
|
|
nk_layout_row_dynamic(ctx, 25, 1);
|
|
|
|
|
nk_label(ctx, "Directional shadow map", NK_TEXT_LEFT);
|
|
|
|
|
|
|
|
|
|
nk_property_float(ctx, "Near plane", -200.f, &near_plane, 200.f, 1.f, 0.01f);
|
|
|
|
|
nk_property_float(ctx, "Near plane", -200.f, &near_plane, 200.f, 1.f,
|
|
|
|
|
0.01f);
|
|
|
|
|
nk_property_float(ctx, "Far plane", -200.f, &far_plane, 200.f, 1.f, 0.01f);
|
|
|
|
|
nk_property_float(ctx, "Shadow lookahead", 0.f, &shadowLookahead, 100.f, 1.f, 0.01f);
|
|
|
|
|
nk_property_float(ctx, "Shadow lookahead", 0.f, &shadowLookahead, 100.f,
|
|
|
|
|
1.f, 0.01f);
|
|
|
|
|
nk_property_float(ctx, "Plane size", 0.f, &plane_size, 100.f, 1.f, 0.01f);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}nk_end(ctx);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
nk_end(ctx);
|
|
|
|
|
|
|
|
|
|
if (editor.showGameSettings) {
|
|
|
|
|
nk_begin(ctx, "Game settings", nk_rect_std, nuk_std);
|
|
|
|
|
|
|
|
|
|
//nk_edit_string_zero_terminated(ctx, NK_EDIT_SIMPLE, cur_project->name, 126, nk_filter_default);
|
|
|
|
|
// nk_edit_string_zero_terminated(ctx, NK_EDIT_SIMPLE, cur_project->name,
|
|
|
|
|
// 126, nk_filter_default);
|
|
|
|
|
|
|
|
|
|
if (nk_tree_push(ctx, NK_TREE_NODE, "Physics", NK_MINIMIZED)) {
|
|
|
|
|
nk_property_float(ctx, "2d Gravity", -5000.f, &phys2d_gravity, 0.f, 1.f, 0.1f);
|
|
|
|
|
nk_property_float(ctx, "2d Gravity", -5000.f, &phys2d_gravity, 0.f, 1.f,
|
|
|
|
|
0.1f);
|
|
|
|
|
phys2d_apply();
|
|
|
|
|
nk_tree_pop(ctx);
|
|
|
|
|
}
|
|
|
|
@ -592,7 +532,6 @@ nk_end(ctx);
|
|
|
|
|
nk_end(ctx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (editor.showStats) {
|
|
|
|
|
nk_begin(ctx, "Stats", nk_rect_std, nuk_std);
|
|
|
|
|
nk_labelf(ctx, NK_TEXT_LEFT, "FPS: %2.4f", 1.f / deltaT);
|
|
|
|
@ -600,7 +539,6 @@ nk_end(ctx);
|
|
|
|
|
nk_end(ctx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (editor.showREPL) {
|
|
|
|
|
nk_begin(ctx, "REPL", nk_rect_std, nuk_std);
|
|
|
|
|
|
|
|
|
@ -615,21 +553,30 @@ nk_end(ctx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nk_end(ctx);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (editor.showViewmode) {
|
|
|
|
|
nk_begin(ctx, "View options", nk_rect_std, nuk_std);
|
|
|
|
|
|
|
|
|
|
nk_property_float(ctx, "Camera FOV", 0.1f, &editorFOV, 90.f, 1.f, 0.1f);
|
|
|
|
|
nk_property_float(ctx, "Camera Near Plane", 0.1f, &editorClose, 5.f, 0.1f, 0.01f);
|
|
|
|
|
nk_property_float(ctx, "Camera Far Plane", 50.f, &editorFar, 10000.f, 1.f, 1.f);
|
|
|
|
|
nk_property_float(ctx, "Camera Near Plane", 0.1f, &editorClose, 5.f, 0.1f,
|
|
|
|
|
0.01f);
|
|
|
|
|
nk_property_float(ctx, "Camera Far Plane", 50.f, &editorFar, 10000.f, 1.f,
|
|
|
|
|
1.f);
|
|
|
|
|
|
|
|
|
|
if (nk_tree_push(ctx, NK_TREE_NODE, "Shading mode", NK_MINIMIZED)) {
|
|
|
|
|
renderMode = nk_option_label(ctx, "Lit", renderMode == LIT) ? LIT : renderMode;
|
|
|
|
|
renderMode = nk_option_label(ctx, "Unlit", renderMode == UNLIT) ? UNLIT : renderMode;
|
|
|
|
|
renderMode = nk_option_label(ctx, "Wireframe", renderMode == WIREFRAME) ? WIREFRAME : renderMode;
|
|
|
|
|
renderMode = nk_option_label(ctx, "Directional shadow map", renderMode == DIRSHADOWMAP) ? DIRSHADOWMAP : renderMode;
|
|
|
|
|
renderMode =
|
|
|
|
|
nk_option_label(ctx, "Lit", renderMode == LIT) ? LIT : renderMode;
|
|
|
|
|
renderMode = nk_option_label(ctx, "Unlit", renderMode == UNLIT)
|
|
|
|
|
? UNLIT
|
|
|
|
|
: renderMode;
|
|
|
|
|
renderMode = nk_option_label(ctx, "Wireframe", renderMode == WIREFRAME)
|
|
|
|
|
? WIREFRAME
|
|
|
|
|
: renderMode;
|
|
|
|
|
renderMode = nk_option_label(ctx, "Directional shadow map",
|
|
|
|
|
renderMode == DIRSHADOWMAP)
|
|
|
|
|
? DIRSHADOWMAP
|
|
|
|
|
: renderMode;
|
|
|
|
|
nk_tree_pop(ctx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -650,7 +597,7 @@ nk_end(ctx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (editor.showHierarchy) {
|
|
|
|
|
nk_begin(ctx, "Objects", nk_rect_std, nuk_std);
|
|
|
|
|
editor.showHierarchy = nk_begin(ctx, "Objects", nk_rect_std, nuk_std);
|
|
|
|
|
|
|
|
|
|
if (nk_button_label(ctx, "New Object")) {
|
|
|
|
|
MakeGameobject();
|
|
|
|
@ -661,8 +608,7 @@ nk_end(ctx);
|
|
|
|
|
nk_end(ctx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nk_begin(ctx, "Simulate", nk_rect_std, nuk_std);
|
|
|
|
|
if (nk_begin(ctx, "Simulate", nk_rect_std, nuk_std)) {
|
|
|
|
|
|
|
|
|
|
if (physOn) {
|
|
|
|
|
if (nk_button_label(ctx, "Pause"))
|
|
|
|
@ -676,20 +622,19 @@ nk_end(ctx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nk_end(ctx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nk_begin(ctx, "Prefab Creator", nk_rect_std, nuk_std);
|
|
|
|
|
|
|
|
|
|
if (nk_begin(ctx, "Prefab Creator", nk_rect_std, nuk_std)) {
|
|
|
|
|
vec_walk(prefabs, (void (*)(void *)) & editor_prefab_btn);
|
|
|
|
|
|
|
|
|
|
nk_end(ctx);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (editor.showAssetMenu) {
|
|
|
|
|
nk_begin(ctx, "Asset Menu", nk_rect_std, nuk_std);
|
|
|
|
|
//active = nk_edit_string_zero_terminated(ctx, NK_EDIT_BOX|NK_EDIT_SIG_ENTER, buffer, 512-1, nk_filter_ascii);
|
|
|
|
|
nk_edit_string_zero_terminated(ctx, NK_EDIT_SIMPLE, asset_search_buffer, 100, nk_filter_ascii);
|
|
|
|
|
|
|
|
|
|
nk_edit_string_zero_terminated(ctx,
|
|
|
|
|
NK_EDIT_BOX | NK_EDIT_NO_HORIZONTAL_SCROLL,
|
|
|
|
|
asset_search_buffer, 100, nk_filter_ascii);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
if (data->EventFlag == ImGuiInputTextFlags_CallbackCompletion) {
|
|
|
|
@ -738,15 +683,12 @@ nk_end(ctx);
|
|
|
|
|
if (selected_asset)
|
|
|
|
|
editor_asset_gui(selected_asset);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (editor.showDebugMenu) {
|
|
|
|
|
nk_begin(ctx, "Debug Menu", nk_rect_std, nuk_std);
|
|
|
|
|
|
|
|
|
|
if (nk_button_label(ctx, "Reload Shaders")) {
|
|
|
|
|
shader_compile_all();
|
|
|
|
|
}
|
|
|
|
|
//ImGui::SliderFloat("Grid scale", &gridScale, 100.f, 500.f, "%1.f");
|
|
|
|
|
|
|
|
|
|
nk_property_int(ctx, "Grid 1 Span", 1, &grid1_span, 500, 1, 1);
|
|
|
|
|
nk_checkbox_label(ctx, "Draw", &grid1_draw);
|
|
|
|
@ -754,12 +696,14 @@ nk_end(ctx);
|
|
|
|
|
nk_property_int(ctx, "Grid 2 Span", 10, &grid2_span, 1000, 1, 1);
|
|
|
|
|
nk_checkbox_label(ctx, "Draw", &grid2_draw);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nk_property_float(ctx, "Grid Opacity",0.f, &gridOpacity, 1.f, 0.01f, 0.01f);
|
|
|
|
|
nk_property_float(ctx, "Grid Opacity", 0.f, &gridOpacity, 1.f, 0.01f,
|
|
|
|
|
0.01f);
|
|
|
|
|
nk_property_float(ctx, "Small unit", 0.5f, &smallGridUnit, 5.f, 0.1f, 0.1f);
|
|
|
|
|
nk_property_float(ctx, "Big unit", 10.f, &bigGridUnit, 50.f, 1.f, 0.1f);
|
|
|
|
|
nk_property_float(ctx, "Small thickness",1.f, &gridSmallThickness, 10.f, 0.1f, 0.1f);
|
|
|
|
|
nk_property_float(ctx, "Big thickness", 1.f, &gridBigThickness, 10.f, 0.1f, 0.1f);
|
|
|
|
|
nk_property_float(ctx, "Small thickness", 1.f, &gridSmallThickness, 10.f,
|
|
|
|
|
0.1f, 0.1f);
|
|
|
|
|
nk_property_float(ctx, "Big thickness", 1.f, &gridBigThickness, 10.f, 0.1f,
|
|
|
|
|
0.1f);
|
|
|
|
|
|
|
|
|
|
static struct nk_colorf smgrd;
|
|
|
|
|
static struct nk_colorf lgrd;
|
|
|
|
@ -767,7 +711,6 @@ nk_end(ctx);
|
|
|
|
|
nk_color_pick(ctx, &smgrd, NK_RGBA);
|
|
|
|
|
nk_color_pick(ctx, &lgrd, NK_RGBA);
|
|
|
|
|
|
|
|
|
|
//ImGui::SliderInt("MSAA", &msaaSamples, 0, 4);
|
|
|
|
|
nk_end(ctx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -777,13 +720,13 @@ nk_end(ctx);
|
|
|
|
|
draw_point(selectedobject->transform.position[0],
|
|
|
|
|
selectedobject->transform.position[1], 5);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nk_begin(ctx, "Object Parameters", nk_rect_std, nuk_std);
|
|
|
|
|
|
|
|
|
|
nk_layout_row_dynamic(ctx, 30, 3);
|
|
|
|
|
|
|
|
|
|
if (nk_button_label(ctx, "Save"))
|
|
|
|
|
gameobject_saveprefab(selectedobject);
|
|
|
|
|
|
|
|
|
|
// ImGui::SameLine();
|
|
|
|
|
if (nk_button_label(ctx, "Del")) {
|
|
|
|
|
gameobject_delete(selected_index);
|
|
|
|
|
pickGameObject(-1);
|
|
|
|
@ -791,27 +734,25 @@ nk_end(ctx);
|
|
|
|
|
goto startobjectgui;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ImGui::SameLine();
|
|
|
|
|
if (selectedobject->editor.prefabSync) {
|
|
|
|
|
if (nk_button_label(ctx, "Revert"))
|
|
|
|
|
gameobject_revertprefab(selectedobject);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nk_label(ctx, "Name", NK_TEXT_LEFT);
|
|
|
|
|
nk_edit_string_zero_terminated(ctx, 0, selectedobject->editor.mname, 50, nk_filter_ascii);
|
|
|
|
|
nk_edit_string_zero_terminated(ctx, 0, selectedobject->editor.mname, 50,
|
|
|
|
|
nk_filter_ascii);
|
|
|
|
|
|
|
|
|
|
nk_label(ctx, "Prefab", NK_TEXT_LEFT);
|
|
|
|
|
nk_edit_string_zero_terminated(ctx, 0, selectedobject->editor.prefabName, 50, nk_filter_ascii);
|
|
|
|
|
// Disabled if::::: selectedobject->editor.prefabSync ? ImGuiInputTextFlags_ReadOnly : 0);
|
|
|
|
|
nk_edit_string_zero_terminated(ctx, 0, selectedobject->editor.prefabName,
|
|
|
|
|
50, nk_filter_ascii);
|
|
|
|
|
// Disabled if::::: selectedobject->editor.prefabSync ?
|
|
|
|
|
// ImGuiInputTextFlags_ReadOnly : 0);
|
|
|
|
|
|
|
|
|
|
object_gui(selectedobject);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nk_end(ctx);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nk_begin(ctx, "Components", nk_rect_std, nuk_std);
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < ncomponent; i++) {
|
|
|
|
@ -820,39 +761,25 @@ nk_end(ctx);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nk_end(ctx);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
void editor_render() { editor_project_gui(); }
|
|
|
|
|
|
|
|
|
|
void editor_render()
|
|
|
|
|
{
|
|
|
|
|
if (cur_project)
|
|
|
|
|
editor_project_gui();
|
|
|
|
|
else
|
|
|
|
|
editor_proj_select_gui();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void pickGameObject(int pickID)
|
|
|
|
|
{
|
|
|
|
|
void pickGameObject(int pickID) {
|
|
|
|
|
if (pickID >= 0 && pickID < gameobjects->len) {
|
|
|
|
|
selected_index = pickID;
|
|
|
|
|
selectedobject =
|
|
|
|
|
(struct mGameObject *) vec_get(gameobjects, pickID);
|
|
|
|
|
selectedobject = (struct mGameObject *)vec_get(gameobjects, pickID);
|
|
|
|
|
} else {
|
|
|
|
|
selected_index = -1;
|
|
|
|
|
selectedobject = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int is_allowed_extension(const char *ext)
|
|
|
|
|
{
|
|
|
|
|
int is_allowed_extension(const char *ext) {
|
|
|
|
|
for (size_t i = 0;
|
|
|
|
|
i < sizeof(allowed_extensions) / sizeof(allowed_extensions[0]);
|
|
|
|
|
i++) {
|
|
|
|
|
i < sizeof(allowed_extensions) / sizeof(allowed_extensions[0]); i++) {
|
|
|
|
|
if (!strcmp(ext + 1, allowed_extensions[i]))
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
@ -860,18 +787,15 @@ int is_allowed_extension(const char *ext)
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void editor_level_btn(char *level)
|
|
|
|
|
{
|
|
|
|
|
void editor_level_btn(char *level) {
|
|
|
|
|
|
|
|
|
|
if (nk_button_label(ctx, level)) {
|
|
|
|
|
load_level(level);
|
|
|
|
|
strcpy(current_level, level);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void editor_selectasset(struct fileasset *asset)
|
|
|
|
|
{
|
|
|
|
|
void editor_selectasset(struct fileasset *asset) {
|
|
|
|
|
const char *ext = get_extension(asset->filename);
|
|
|
|
|
|
|
|
|
|
if (!strcmp(ext + 1, "png") || !strcmp(ext + 1, "jpg")) {
|
|
|
|
@ -879,7 +803,8 @@ void editor_selectasset(struct fileasset *asset)
|
|
|
|
|
tex_gui_anim.tex = (struct Texture *)asset->data;
|
|
|
|
|
asset->type = ASSET_TYPE_IMAGE;
|
|
|
|
|
tex_anim_set(&tex_gui_anim);
|
|
|
|
|
//float tex_scale = float((float) ASSET_WIN_SIZE / tex_gui_anim.tex->width);
|
|
|
|
|
// float tex_scale = float((float) ASSET_WIN_SIZE /
|
|
|
|
|
// tex_gui_anim.tex->width);
|
|
|
|
|
if (tex_scale >= 10.f)
|
|
|
|
|
tex_scale = 10.f;
|
|
|
|
|
} else if (!strcmp(ext + 1, "glsl")) {
|
|
|
|
@ -893,22 +818,18 @@ void editor_selectasset(struct fileasset *asset)
|
|
|
|
|
asset->data = malloc(ASSET_TEXT_BUF);
|
|
|
|
|
fread(asset->data, 1, length, fasset);
|
|
|
|
|
fclose(fasset);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
selected_asset = asset;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void editor_selectasset_str(char *path)
|
|
|
|
|
{
|
|
|
|
|
void editor_selectasset_str(char *path) {
|
|
|
|
|
struct fileasset *asset = (struct fileasset *)shget(assets, path);
|
|
|
|
|
|
|
|
|
|
if (asset)
|
|
|
|
|
editor_selectasset(asset);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void editor_asset_tex_gui(struct Texture *tex)
|
|
|
|
|
{
|
|
|
|
|
void editor_asset_tex_gui(struct Texture *tex) {
|
|
|
|
|
/*
|
|
|
|
|
ImGui::Text("%dx%d", tex->width, tex->height);
|
|
|
|
|
|
|
|
|
@ -988,11 +909,9 @@ void editor_asset_tex_gui(struct Texture *tex)
|
|
|
|
|
tex->height * tex_scale));
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void editor_asset_text_gui(char *text)
|
|
|
|
|
{
|
|
|
|
|
void editor_asset_text_gui(char *text) {
|
|
|
|
|
/*
|
|
|
|
|
ImGui::InputTextMultiline("File edit", text, ASSET_TEXT_BUF,
|
|
|
|
|
ImVec2(600, 500),
|
|
|
|
@ -1008,8 +927,7 @@ void editor_asset_text_gui(char *text)
|
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void editor_asset_gui(struct fileasset *asset)
|
|
|
|
|
{
|
|
|
|
|
void editor_asset_gui(struct fileasset *asset) {
|
|
|
|
|
|
|
|
|
|
nk_begin(ctx, "Asset Viewer", nk_rect_std, nuk_std);
|
|
|
|
|
|
|
|
|
@ -1033,105 +951,11 @@ void editor_asset_gui(struct fileasset *asset)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nk_end(ctx);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void editor_load_projects()
|
|
|
|
|
{
|
|
|
|
|
FILE *f = fopen("projects.yugh", "r");
|
|
|
|
|
if (!f)
|
|
|
|
|
return;
|
|
|
|
|
void editor_makenewobject() {}
|
|
|
|
|
|
|
|
|
|
vec_load(projects, f);
|
|
|
|
|
fclose(f);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void editor_save_projects()
|
|
|
|
|
{
|
|
|
|
|
FILE *f = fopen("projects.yugh", "w");
|
|
|
|
|
vec_store(projects, f);
|
|
|
|
|
fclose(f);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void editor_project_btn_gui(struct gameproject *gp)
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
if (ImGui::Button(gp->name))
|
|
|
|
|
editor_init_project(gp);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ImGui::SameLine();
|
|
|
|
|
ImGui::Text("%s", gp->path);
|
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void editor_proj_select_gui()
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
ImGui::Begin("Project Select");
|
|
|
|
|
|
|
|
|
|
vec_walk(projects, (void (*)(void *)) &editor_project_btn_gui);
|
|
|
|
|
|
|
|
|
|
ImGui::InputText("Project import path", setpath, MAXPATH);
|
|
|
|
|
ImGui::SameLine();
|
|
|
|
|
if (ImGui::Button("Create")) {
|
|
|
|
|
editor_make_project(setpath);
|
|
|
|
|
}
|
|
|
|
|
ImGui::SameLine();
|
|
|
|
|
if (ImGui::Button("Import")) {
|
|
|
|
|
editor_import_project(setpath);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ImGui::End();
|
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void editor_init_project(struct gameproject *gp)
|
|
|
|
|
{
|
|
|
|
|
cur_project = gp;
|
|
|
|
|
DATA_PATH = strdup(gp->path);
|
|
|
|
|
stemlen = strlen(DATA_PATH);
|
|
|
|
|
findPrefabs();
|
|
|
|
|
get_levels();
|
|
|
|
|
get_all_files();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void editor_make_project(char *path)
|
|
|
|
|
{
|
|
|
|
|
FILE *f = path_open("w", "%s%s", path, "/project.yugh");
|
|
|
|
|
cur_project =
|
|
|
|
|
(struct gameproject *) malloc(sizeof(struct gameproject));
|
|
|
|
|
strncpy(cur_project->name, "New Game", 127);
|
|
|
|
|
strncpy(cur_project->path, path, 2048);
|
|
|
|
|
vec_add(projects, cur_project);
|
|
|
|
|
fwrite(cur_project, sizeof(*cur_project), 1, f);
|
|
|
|
|
fclose(f);
|
|
|
|
|
|
|
|
|
|
editor_init_project(cur_project);
|
|
|
|
|
|
|
|
|
|
editor_save_projects();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void editor_import_project(char *path)
|
|
|
|
|
{
|
|
|
|
|
FILE *f = path_open("r", "%s%s", path, "/project.yugh");
|
|
|
|
|
if (!f)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
struct gameproject *gp = (struct gameproject *) malloc(sizeof(*gp));
|
|
|
|
|
fread(gp, sizeof(*gp), 1, f);
|
|
|
|
|
fclose(f);
|
|
|
|
|
|
|
|
|
|
vec_add(projects, gp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void editor_makenewobject()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int obj_gui_hierarchy(struct mGameObject *selected)
|
|
|
|
|
{
|
|
|
|
|
int obj_gui_hierarchy(struct mGameObject *selected) {
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < gameobjects->len; i++) {
|
|
|
|
|
struct mGameObject *go = (struct mGameObject *)vec_get(gameobjects, i);
|
|
|
|
@ -1145,47 +969,25 @@ int obj_gui_hierarchy(struct mGameObject *selected)
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void get_levels()
|
|
|
|
|
{
|
|
|
|
|
fill_extensions(levels, DATA_PATH, EXT_LEVEL);
|
|
|
|
|
}
|
|
|
|
|
void get_levels() { fill_extensions(levels, DATA_PATH, EXT_LEVEL); }
|
|
|
|
|
|
|
|
|
|
void editor_prefab_btn(char *prefab)
|
|
|
|
|
{
|
|
|
|
|
void editor_prefab_btn(char *prefab) {
|
|
|
|
|
if (nk_button_label(ctx, prefab)) {
|
|
|
|
|
gameobject_makefromprefab(prefab);
|
|
|
|
|
/*GameObject* newprefab = (GameObject*)createPrefab(*prefab); */
|
|
|
|
|
/*cam_inverse_goto(&camera, &newprefab->transform); */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void game_start()
|
|
|
|
|
{
|
|
|
|
|
physOn = 1;
|
|
|
|
|
}
|
|
|
|
|
void game_start() { physOn = 1; }
|
|
|
|
|
|
|
|
|
|
void game_resume()
|
|
|
|
|
{
|
|
|
|
|
physOn = 1;
|
|
|
|
|
}
|
|
|
|
|
void game_resume() { physOn = 1; }
|
|
|
|
|
|
|
|
|
|
void game_stop()
|
|
|
|
|
{
|
|
|
|
|
physOn = 0;
|
|
|
|
|
}
|
|
|
|
|
void game_stop() { physOn = 0; }
|
|
|
|
|
|
|
|
|
|
void game_pause()
|
|
|
|
|
{
|
|
|
|
|
physOn = 0;
|
|
|
|
|
}
|
|
|
|
|
void game_pause() { physOn = 0; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void sprite_gui(struct mSprite *sprite)
|
|
|
|
|
{
|
|
|
|
|
void sprite_gui(struct mSprite *sprite) {
|
|
|
|
|
nk_labelf(ctx, NK_TEXT_LEFT, "Path %s", sprite->tex->path);
|
|
|
|
|
// ImGui::SameLine();
|
|
|
|
|
|
|
|
|
@ -1195,11 +997,15 @@ void sprite_gui(struct mSprite *sprite)
|
|
|
|
|
|
|
|
|
|
if (sprite->tex != NULL) {
|
|
|
|
|
nk_labelf(ctx, NK_TEXT_LEFT, "%s", sprite->tex->path);
|
|
|
|
|
nk_labelf(ctx, NK_TEXT_LEFT, "%dx%d", sprite->tex->width, sprite->tex->height);
|
|
|
|
|
if (nk_button_label(ctx, "Imgbutton")) editor_selectasset_str(sprite->tex->path);
|
|
|
|
|
// if (ImGui::ImageButton ((void *) (intptr_t) sprite->tex->id, ImVec2(50, 50))) {
|
|
|
|
|
nk_labelf(ctx, NK_TEXT_LEFT, "%dx%d", sprite->tex->width,
|
|
|
|
|
sprite->tex->height);
|
|
|
|
|
if (nk_button_label(ctx, "Imgbutton"))
|
|
|
|
|
editor_selectasset_str(sprite->tex->path);
|
|
|
|
|
// if (ImGui::ImageButton ((void *) (intptr_t) sprite->tex->id, ImVec2(50,
|
|
|
|
|
// 50))) {
|
|
|
|
|
}
|
|
|
|
|
nk_property_float2(ctx, "Sprite Position", -1.f, sprite->pos, 0.f, 0.01f, 0.01f);
|
|
|
|
|
nk_property_float2(ctx, "Sprite Position", -1.f, sprite->pos, 0.f, 0.01f,
|
|
|
|
|
0.01f);
|
|
|
|
|
|
|
|
|
|
nk_layout_row_dynamic(ctx, 25, 3);
|
|
|
|
|
if (nk_button_label(ctx, "C")) {
|
|
|
|
@ -1207,16 +1013,13 @@ void sprite_gui(struct mSprite *sprite)
|
|
|
|
|
sprite->pos[1] = -0.5f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (nk_button_label(ctx, "U")) {
|
|
|
|
|
sprite->pos[0] = -0.5f;
|
|
|
|
|
sprite->pos[1] = -1.f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (nk_button_label(ctx, "D")) {
|
|
|
|
|
sprite->pos[0] = -0.5f;
|
|
|
|
|
sprite->pos[1] = 0.f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|