From 0f1d7ba48387faaced30d35e64cf346d368f4a23 Mon Sep 17 00:00:00 2001 From: davidovski Date: Sun, 23 Jul 2023 17:03:22 +0200 Subject: adjust scroll speed --- src/tiled.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/tiled.c b/src/tiled.c index d525027..b90aea7 100644 --- a/src/tiled.c +++ b/src/tiled.c @@ -6,10 +6,10 @@ int alpha =0; void updateCamera(Tiled * tiled) { - if (IsKeyDown(KEY_UP)) tiled->offset.y += 4.0f / tiled->zoom; - if (IsKeyDown(KEY_DOWN)) tiled->offset.y -= 4.0f / tiled->zoom; - if (IsKeyDown(KEY_RIGHT)) tiled->offset.x -= 4.0f / tiled->zoom; - if (IsKeyDown(KEY_LEFT)) tiled->offset.x += 4.0f / tiled->zoom; + if (IsKeyDown(KEY_UP)) tiled->offset.y += 16.0f / tiled->zoom; + if (IsKeyDown(KEY_DOWN)) tiled->offset.y -= 16.0f / tiled->zoom; + if (IsKeyDown(KEY_RIGHT)) tiled->offset.x -= 16.0f / tiled->zoom; + if (IsKeyDown(KEY_LEFT)) tiled->offset.x += 16.0f / tiled->zoom; if (IsKeyDown(KEY_W)) tiled->zoom += tiled->zoom * 0.01f; if (IsKeyDown(KEY_S)) tiled->zoom -= tiled->zoom * 0.01f; @@ -19,6 +19,9 @@ void updateCamera(Tiled * tiled) { tiled->renderOffset.x = tiled->offset.x - tiled->chunkOffset[0]*tiled->tiledMap.chunkWidth; tiled->renderOffset.y = tiled->offset.y - tiled->chunkOffset[1]*tiled->tiledMap.chunkHeight; + + // TODO only do this when chunk offset has changed + // TODO unload chunks when they are no longer visible redrawTiledMap(*tiled); } -- cgit v1.2.1