]> git.lizzy.rs Git - nothing.git/blob - src/game/level/level_editor.h
3750e748cbf389a64c2ab02ae1c7086ee0b811dd
[nothing.git] / src / game / level / level_editor.h
1 #ifndef LEVEL_EDITOR_H_
2 #define LEVEL_EDITOR_H_
3
4 #include "game/level/level_editor/layer.h"
5 #include "game/level/level_editor/layer_picker.h"
6 #include "game/level/level_editor/undo_history.h"
7 #include "game/level/level_editor/rect_layer.h"
8 #include "game/level/level_editor/point_layer.h"
9 #include "game/level/level_editor/label_layer.h"
10 #include "ui/wiggly_text.h"
11 #include "ui/cursor.h"
12
13 typedef struct LevelEditor LevelEditor;
14 typedef struct Sound_samples Sound_samples;
15
16 typedef enum {
17     LEVEL_EDITOR_IDLE = 0,
18     LEVEL_EDITOR_SAVEAS
19 } LevelEditorState;
20
21 struct LevelEditor
22 {
23     LevelEditorState state;
24     Vec2f camera_position;
25     float camera_scale;
26     Edit_field edit_field_filename;
27     LayerPicker layer_picker;
28     FadingWigglyText notice;
29
30     RectLayer boxes_layer;
31     RectLayer platforms_layer;
32     RectLayer back_platforms_layer;
33     PointLayer goals_layer;
34     PlayerLayer player_layer;
35     RectLayer lava_layer;
36     RectLayer regions_layer;
37     BackgroundLayer background_layer;
38     LabelLayer label_layer;
39
40     LayerPtr layers[LAYER_PICKER_N];
41
42     UndoHistory undo_history;
43
44     bool drag;
45     int bell;
46     int click;
47     int save;
48
49     char *file_name;
50 };
51
52 void create_level_editor(LevelEditor *level_editor, Cursor *cursor);
53 void level_editor_load_from_file(LevelEditor *level_editor, Memory *tmpmem, const char *file_name);
54 void level_editor_clean(LevelEditor *level_editor);
55 void destroy_level_editor(LevelEditor *level_editor);
56
57 int level_editor_render(const LevelEditor *level_editor,
58                         const Camera *camera);
59 int level_editor_event(LevelEditor *level_editor,
60                        const SDL_Event *event,
61                        Camera *camera);
62 int level_editor_focus_camera(LevelEditor *level_editor,
63                               Camera *camera);
64 int level_editor_update(LevelEditor *level_editor, float delta_time);
65 void level_editor_sound(LevelEditor *level_editor, Sound_samples *sound_samples);
66
67 #endif  // LEVEL_EDITOR_H_