/** * Copyright (c) 2025 Dominic Masters * * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ #include "drawoverworld.h" #include "world/chunk.h" #include "world/overworld.h" #include "display/render.h" Camera2D DRAW_OVERWORLD_CAMERA = { 0 }; void drawOverworldInit(void) { DRAW_OVERWORLD_CAMERA = (Camera2D){ .offset = { 0, 0 }, .target = { 0, 0 }, .rotation = 0.0f, .zoom = 1.0f }; } void drawOverworldDraw(void) { BeginMode2D(DRAW_OVERWORLD_CAMERA); DRAW_OVERWORLD_CAMERA.target.x = ( OVERWORLD_CAMERA_X * TILE_WIDTH + OVERWORLD_CAMERA_SUB_X ) - ( RENDER_WIDTH / 2 ); DRAW_OVERWORLD_CAMERA.target.y = ( OVERWORLD_CAMERA_Y * TILE_HEIGHT + OVERWORLD_CAMERA_SUB_Y ) - ( RENDER_HEIGHT / 2 ); chunk_t *chunk = CHUNK_MAP.chunks; do { DrawRectangle( ((int32_t)chunk->x) * CHUNK_WIDTH * TILE_WIDTH, ((int32_t)chunk->y) * CHUNK_HEIGHT * TILE_HEIGHT, CHUNK_WIDTH * TILE_WIDTH, CHUNK_HEIGHT * TILE_HEIGHT, (chunk->tiles[0] == 0) ? RED : GREEN ); chunk++; } while(chunk < CHUNK_MAP.chunks + CHUNK_MAP_COUNT); EndMode2D(); }