diff options
| author | ilotterytea <iltsu@alright.party> | 2025-02-01 14:54:55 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-02-01 14:55:37 +0500 |
| commit | 98bb51185eb053d56052ad9feb3420c258dbb601 (patch) | |
| tree | 81562188ef0015a6c903bb985ab864014b80f4b4 /src/main.c | |
| parent | f1ab4e564ea83540e513e1266c87e31c0eedf073 (diff) | |
upd: we migrated to sfml/imgui/c++ stack (project rewrite)
Diffstat (limited to 'src/main.c')
| -rw-r--r-- | src/main.c | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/src/main.c b/src/main.c deleted file mode 100644 index 5ba9463..0000000 --- a/src/main.c +++ /dev/null @@ -1,87 +0,0 @@ -#include <stddef.h> -#include <stdio.h> -#include <stdlib.h> - -#include "editor.h" -#include "floor.h" -#include "logger.h" -#include "nfd.h" -#include "raylib.h" -#include "tileset.h" - -int main() { - NFD_Init(); - SetTraceLogCallback(SE_Logger); - - SetConfigFlags(FLAG_WINDOW_RESIZABLE); - InitWindow(800, 600, "sillyeditor"); - SetTargetFPS(60); - SetWindowMinSize(800, 600); - - Editor editor = {0}; - editor.state.activeTileLayerId = 0; - - Tileset* tileset = SE_CreateTileset(); - TileFloor* floor = SE_CreateTileFloor(30, 30); - - Camera2D camera = {0}; - camera.target = (Vector2){0.0f, 0.0f}; - camera.offset = (Vector2){0.0f, 0.0f}; - camera.rotation = 0.0f; - camera.zoom = 4.0f; - - while (!WindowShouldClose()) { - SE_UpdateEditor(&editor); - - bool isEditorFocused = - CheckCollisionPointRec( - GetMousePosition(), - (Rectangle){0.0f, 0.0f, EDITOR_TOOLKIT_X, GetScreenHeight()}) && - editor.state.createBlockState == NULL; - - if (isEditorFocused) { - SE_UpdateTileFloor(&editor.state, floor, &camera); - - if (GetMouseWheelMove() != 0.0) { - camera.zoom += (int)GetMouseWheelMove(); - - if (camera.zoom > 6.0f) - camera.zoom = 6.0f; - else if (camera.zoom < 4.0f) - camera.zoom = 4.0f; - } - - if (IsMouseButtonDown(MOUSE_BUTTON_MIDDLE)) { - Vector2 mousePos = GetMouseDelta(); - camera.target.x -= mousePos.x / 5.0f; - camera.target.y -= mousePos.y / 5.0f; - } - } - - BeginDrawing(); - ClearBackground(RAYWHITE); - - BeginMode2D(camera); - SE_DrawTileFloor(floor, &editor.state, &camera); - - // rendering grid - for (int x = 0; x < floor->width; x++) { - for (int y = 0; y < floor->height; y++) { - DrawRectangleLines(x * camera.zoom, y * camera.zoom, camera.zoom, - camera.zoom, BLACK); - } - } - - EndMode2D(); - - SE_DrawEditor(&editor, tileset); - - EndDrawing(); - } - - SE_UnloadTileFloor(floor); - SE_UnloadTileset(tileset); - CloseWindow(); - - return 0; -} |
