104 lines
2.7 KiB
C
104 lines
2.7 KiB
C
#ifndef STATE_EDITOR_H
|
|
#define STATE_EDITOR_H
|
|
#include <SDL2/SDL.h>
|
|
#include "Map.h"
|
|
#include "Text.h"
|
|
#include "check.h"
|
|
#include "Ui.h"
|
|
|
|
// ================================================================
|
|
int openEditorState();
|
|
void closeEditorState();
|
|
int handleEditorState(SDL_Event event);
|
|
int processEditorState();
|
|
int renderEditorState();
|
|
// ================================================================
|
|
#define KEY_UP 0
|
|
#define KEY_DOWN 1
|
|
#define KEY_LEFT 2
|
|
#define KEY_RIGHT 3
|
|
#define KEY_DELETE 4
|
|
#define KEY_ZOOM_IN 5
|
|
#define KEY_ZOOM_OUT 6
|
|
#define KEY_T 7
|
|
#define KEY_F 8
|
|
#define KEY_1 9
|
|
#define KEY_2 10
|
|
#define KEY_3 11
|
|
#define KEY_ZOOM_FULL 12
|
|
#define KEYS 13
|
|
char keys[KEYS];
|
|
int mouse;
|
|
int mouse_x;
|
|
int mouse_y;
|
|
// ================================================================
|
|
int b_mode; // brush mode
|
|
#define BRUSH_NONE 0
|
|
#define BRUSH_FLAG 1
|
|
#define BRUSH_DECOR 2
|
|
#define BRUSH_TRIGGER 3
|
|
#define BRUSH_EVENT 4
|
|
#define BRUSH_PLAYER 5
|
|
#define BRUSH_ENTITY 6
|
|
int b_flags; // brush flags
|
|
// ================================================================
|
|
struct Text *text_cam_x;
|
|
struct Text *text_cam_y;
|
|
struct Box map_box;
|
|
int map_rows; // maximum y cells
|
|
int map_cols; // maximum x cells
|
|
int camera_x;
|
|
int camera_y;
|
|
// ================================================================
|
|
struct Textt *text_selected;
|
|
struct Textt *text_tool;
|
|
struct Textt *text_edit_name;
|
|
struct TextInput *input_edit_name;
|
|
struct Textt *text_edit_session;
|
|
struct TextInput *input_edit_session;
|
|
// ================================================================
|
|
struct Textt *info;
|
|
struct Box *dialog;
|
|
struct Button *none_button;
|
|
struct Button *tile_button;
|
|
struct Button *decor_button;
|
|
struct Button *trigger_button;
|
|
struct Button *event_button;
|
|
struct Button *entity_button;
|
|
struct Button *player_button;
|
|
// going switchmode on 'em
|
|
int switchMode(int mode);
|
|
struct TextInput *mode_input;
|
|
struct Button *mode_button;
|
|
//
|
|
struct Button *quit_button;
|
|
struct Button *save_button;
|
|
struct Button *load_button;
|
|
struct Button *animator_button;
|
|
struct Button *entedit_button;
|
|
struct Button *hide_button;
|
|
struct Button *coords_button;
|
|
struct Button *triggers_button;
|
|
struct Button *events_button;
|
|
struct Box controls;
|
|
int initControls();
|
|
int renderControls();
|
|
int syncControls();
|
|
// ================================================================
|
|
int show_coords;
|
|
int opts;
|
|
#define OPT_COORDS 1
|
|
#define OPT_TRIGGERS 2
|
|
#define OPT_EVENTS 4
|
|
#define OPT_HIDE_CELLS 8
|
|
struct MapCell *active_cell;
|
|
void setActiveCell(int x, int y);
|
|
int selected_x;
|
|
int selected_y;
|
|
float map_zoom;
|
|
int renderMapQuads();
|
|
int renderMapCoords();
|
|
// ================================================================
|
|
struct Resources *editor_sprites;
|
|
#endif
|