]> git.lizzy.rs Git - nothing.git/blob - src/game/level/level_editor/background_layer.c
Merge pull request #1020 from tsoding/1010
[nothing.git] / src / game / level / level_editor / background_layer.c
1 #include <SDL.h>
2
3 #include "system/stacktrace.h"
4 #include "game/camera.h"
5 #include "math/rect.h"
6 #include "color.h"
7 #include "background_layer.h"
8
9 // TODO(#1012): UndoHistory is not support in BackgroundLayer
10
11 int background_layer_render(BackgroundLayer *layer,
12                             Camera *camera,
13                             int active)
14 {
15     trace_assert(layer);
16     trace_assert(camera);
17
18     if (active) {
19         return color_picker_render(
20             &layer->color_picker,
21             camera);
22     }
23
24     return 0;
25 }
26
27 int background_layer_event(BackgroundLayer *layer,
28                            const SDL_Event *event,
29                            const Camera *camera,
30                            UndoHistory *undo_history)
31 {
32     trace_assert(layer);
33     trace_assert(event);
34     trace_assert(camera);
35     trace_assert(undo_history);
36
37     return color_picker_event(
38         &layer->color_picker,
39         event,
40         camera,
41         NULL);
42 }
43
44 int background_layer_dump_stream(BackgroundLayer *layer,
45                                  FILE *stream)
46 {
47     trace_assert(layer);
48     trace_assert(stream);
49
50     color_hex_to_stream(
51         color_picker_rgba(&layer->color_picker),
52         stream);
53
54     return fprintf(stream, "\n");;
55 }