prosperon/source/engine/editor/editor.h

109 lines
2.6 KiB
C
Raw Normal View History

2021-11-30 21:29:18 -06:00
#ifndef EDITOR_H
#define EDITOR_H
#include "config.h"
2021-11-30 21:29:18 -06:00
#include <stdbool.h>
#include "resources.h"
2022-12-23 13:48:29 -06:00
#include "nuklear.h"
2022-08-15 16:38:21 -05:00
2021-11-30 21:29:18 -06:00
#define ASSET_TYPE_NULL 0
#define ASSET_TYPE_IMAGE 1
#define ASSET_TYPE_TEXT 2
2022-08-25 15:48:15 -05:00
#define ASSET_TYPE_SOUND 3
2021-11-30 21:29:18 -06:00
struct fileasset {
char *filename;
bool searched;
short type;
2022-08-24 12:24:21 -05:00
void *data; // Struct of the underlying asset - Texture struct, etc
2021-11-30 21:29:18 -06:00
};
2022-08-15 16:38:21 -05:00
typedef struct {
bool show;
struct nk_rect rect;
} editor_win;
2021-11-30 21:29:18 -06:00
struct editorVars {
2022-08-15 16:38:21 -05:00
editor_win stats;
editor_win hierarchy;
editor_win gamesettings;
editor_win viewmode;
editor_win debug;
editor_win assets;
2022-08-19 11:25:08 -05:00
editor_win asset;
2022-08-15 16:38:21 -05:00
editor_win repl;
editor_win export;
editor_win level;
editor_win gameobject;
editor_win components;
2022-08-18 08:50:03 -05:00
editor_win simulate;
editor_win prefab;
2022-08-19 11:25:08 -05:00
nk_flags text_ed;
nk_flags asset_srch;
2021-11-30 21:29:18 -06:00
};
2022-11-19 17:13:57 -06:00
struct gameobject;
2022-08-15 16:38:21 -05:00
2022-08-18 08:50:03 -05:00
extern int show_desktop;
#define NK_MENU_START(VAR) if (editor.VAR.show && !show_desktop) { \
2022-08-15 16:38:21 -05:00
if (editor.VAR.rect.w == 0) editor.VAR.rect = nk_rect_std; \
2022-12-23 13:48:29 -06:00
if (nuke_begin(#VAR, editor.VAR.rect, nuk_std)) { \
editor.VAR.rect = nuke_win_get_bounds();
2022-08-15 16:38:21 -05:00
2022-12-23 13:48:29 -06:00
#define NK_MENU_END() } nuke_stop(); }
2022-08-15 16:38:21 -05:00
#define NK_FORCE(VAR) if (editor.VAR.rect.w == 0) editor.VAR.rect = nk_rect_std; \
2022-12-23 13:48:29 -06:00
if (!show_desktop && nuke_begin(#VAR, editor.VAR.rect, nuk_std)) { \
editor.VAR.rect = nuke_win_get_bounds();
2022-08-15 16:38:21 -05:00
2022-12-23 13:48:29 -06:00
#define NK_FORCE_END() nuke_stop(); }
2022-08-15 16:38:21 -05:00
#define NEGATE(VAR) VAR = ! VAR
2022-08-14 14:19:36 -05:00
struct vec;
struct gameproject;
struct sprite;
2022-08-14 14:19:36 -05:00
extern struct gameproject *cur_project;
extern struct vec *projects;
2021-11-30 21:29:18 -06:00
struct Texture;
struct window;
2021-11-30 21:29:18 -06:00
void pickGameObject(int pickID);
int is_allowed_extension(const char *ext);
void editor_init(struct window *window);
2022-02-06 10:14:57 -06:00
void editor_input();
2021-11-30 21:29:18 -06:00
void editor_render();
int editor_wantkeyboard();
void editor_save();
void editor_makenewobject();
void editor_project_gui();
void editor_selectasset(struct fileasset *asset);
2022-08-25 15:48:15 -05:00
void editor_selectasset_str(const char *path);
2021-11-30 21:29:18 -06:00
void editor_asset_gui(struct fileasset *asset);
void editor_asset_tex_gui(struct Texture *tex);
void editor_asset_text_gui(char *text);
void editor_level_btn(char *level);
void editor_prefab_btn(char *prefab);
void game_start();
void game_resume();
void game_stop();
void game_pause();
void get_levels();
2022-11-19 17:13:57 -06:00
int obj_gui_hierarchy(struct gameobject *selected);
2021-11-30 21:29:18 -06:00
void sprite_gui(struct sprite *sprite);
2022-08-12 14:03:56 -05:00
2021-11-30 21:29:18 -06:00
#endif