diff options
author | davidovski <david@davidovski.xyz> | 2023-07-23 17:03:22 +0200 |
---|---|---|
committer | davidovski <david@davidovski.xyz> | 2023-07-23 17:03:22 +0200 |
commit | 0f1d7ba48387faaced30d35e64cf346d368f4a23 (patch) | |
tree | 777aebd01c1e6edc96e3bd727ce50b0e5dda83b0 /src | |
parent | dada8de750b19abf450befbc0563f5853a3bbff2 (diff) |
adjust scroll speed
Diffstat (limited to 'src')
-rw-r--r-- | src/tiled.c | 11 |
1 files changed, 7 insertions, 4 deletions
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); } |