diff options
Diffstat (limited to 'src/editor.c')
| -rw-r--r-- | src/editor.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/editor.c b/src/editor.c new file mode 100644 index 0000000..64f1673 --- /dev/null +++ b/src/editor.c @@ -0,0 +1,26 @@ +#include "editor.h" + +#include "raylib.h" + +void SE_DrawEditor(Editor *editor, Camera2D *camera) { + Vector2 mousePos = GetScreenToWorld2D(GetMousePosition(), *camera); + float zoom = camera->zoom; + + for (int x = 0; x < editor->level->width; x++) { + for (int y = 0; y < editor->level->height; y++) { + float rx = x * zoom, ry = y * zoom; + Color innerColor = RAYWHITE; + Color borderColor = LIGHTGRAY; + + // recolor the tile if the cursor above the tile + if ((rx < mousePos.x && mousePos.x < rx + zoom) && + (ry < mousePos.y && mousePos.y < ry + zoom)) { + innerColor = SKYBLUE; + borderColor = BLUE; + } + + DrawRectangle(rx, ry, zoom, zoom, innerColor); + DrawRectangleLines(rx, ry, zoom, zoom, borderColor); + } + } +} |
