]> git.lizzy.rs Git - nothing.git/blobdiff - src/game/level/level_editor/layer_picker.c
(#1118) Inner selection overlay for Rect Layer
[nothing.git] / src / game / level / level_editor / layer_picker.c
index 9d356dfa35202e194c49d0a76cbb6943f575b6d9..a458c83e512bb4ae89b4cbe4a74a96d38f2bd8c1 100644 (file)
 #define LAYER_SELECTED_OFFSET 15.0f
 
 static const Color LAYER_CELL_BACKGROUND_COLORS[LAYER_PICKER_N] = {
-    {1.0f, 0.0f, 0.0f, 1.0f},
-    {0.0f, 1.0f, 0.0f, 1.0f},
-    {0.0f, 0.0f, 1.0f, 1.0f},
-    {1.0f, 1.0f, 1.0f, 1.0f},
-    {1.0f, 0.2f, 0.6f, 1.0f},
-    {0.6f, 0.6f, 1.0f, 1.0f},
-    {0.2f, 1.0f, 0.6f, 1.0f},
-    {0.2f, 0.6f, 1.0f, 1.0f},
-    {0.2f, 1.0f, 0.6f, 1.0f},
+    {1.0f, 0.0f, 0.0f, 1.0f}, // LAYER_PICKER_BACKGROUND
+    {0.0f, 1.0f, 0.0f, 1.0f}, // LAYER_PICKER_PLAYER
+    {0.6f, 0.6f, 1.0f, 1.0f}, // LAYER_PICKER_BACK_PLATFORMS
+    {0.0f, 0.0f, 1.0f, 1.0f}, // LAYER_PICKER_PLATFORMS
+    {1.0f, 1.0f, 1.0f, 1.0f}, // LAYER_PICKER_GOALS
+    {1.0f, 0.2f, 0.6f, 1.0f}, // LAYER_PICKER_LAVA
+    {0.2f, 1.0f, 0.6f, 1.0f}, // LAYER_PICKER_BOXES
+    {0.2f, 0.6f, 1.0f, 1.0f}, // LAYER_PICKER_LABELS
+    {0.2f, 1.0f, 0.6f, 1.0f}, // LAYER_PICKER_REGIONS
 };
 
 static const char *LAYER_CELL_TITLES[LAYER_PICKER_N] = {
     "Background",              // LAYER_PICKER_BACKGROUND
     "Player",                  // LAYER_PICKER_PLAYER
-    "Platforms",               // LAYER_PICKER_PLATFORMS,
+    "Back Platforms",          // LAYER_PICKER_BACK_PLATFORMS
+    "Platforms",               // LAYER_PICKER_PLATFORMS
     "Goals",                   // LAYER_PICKER_GOALS
     "Lava",                    // LAYER_PICKER_LAVA
-    "Back Platforms",          // LAYER_PICKER_BACK_PLATFORMS,
-    "Boxes",                   // LAYER_PICKER_BOXES = 0,
+    "Boxes",                   // LAYER_PICKER_BOXES
     "Labels",                  // LAYER_PICKER_LABELS
     "Regions",                 // LAYER_PICKER_REGIONS
 };
@@ -60,7 +60,7 @@ inline static float layer_picker_max_width(void)
 #define LAYER_CELL_OW_RATIO (LAYER_SELECTED_OFFSET / LAYER_CELL_WIDTH)
 
 int layer_picker_render(const LayerPicker *layer_picker,
-                        Camera *camera)
+                        const Camera *camera)
 {
     trace_assert(layer_picker);
     trace_assert(camera);
@@ -68,12 +68,12 @@ int layer_picker_render(const LayerPicker *layer_picker,
     const Rect viewport = camera_view_port_screen(camera);
 
     for (size_t i = 0; i < LAYER_PICKER_N; ++i) {
-        const Vec size = {
+        const Vec2f size = {
             .x = viewport.w * LAYER_CELL_WR_RATIO,
             .y = viewport.w * LAYER_CELL_WR_RATIO * LAYER_CELL_HW_RATIO
         };
 
-        Vec position = {
+        Vec2f position = {
             .x = 0.0f,
             .y = viewport.h * 0.5f - size.y * LAYER_PICKER_N * 0.5f
         };
@@ -122,12 +122,12 @@ int layer_picker_event(LayerPicker *layer_picker,
 
     const Rect viewport = camera_view_port_screen(camera);
 
-    const Vec size = {
+    const Vec2f size = {
         .x = viewport.w * LAYER_CELL_WR_RATIO,
         .y = viewport.w * LAYER_CELL_WR_RATIO * LAYER_CELL_HW_RATIO
     };
 
-    const Vec position = {
+    const Vec2f position = {
         .x = 0.0f,
         .y = viewport.h * 0.5f - size.y * LAYER_PICKER_N * 0.5f
     };