summaryrefslogtreecommitdiff
path: root/src/tiled.h
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2023-07-23 16:46:05 +0200
committerdavidovski <david@davidovski.xyz>2023-07-23 16:46:05 +0200
commitc726acd0467906afee74afb7051bb2e705e26565 (patch)
treee8b9422ba926f09b85c229d51d5a99a077ea69e8 /src/tiled.h
parent0d78ec0e53d9824a029840e74bf0721ed2187e6a (diff)
add chunk offset to rendering
Diffstat (limited to 'src/tiled.h')
-rw-r--r--src/tiled.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/tiled.h b/src/tiled.h
index c3d0950..de469be 100644
--- a/src/tiled.h
+++ b/src/tiled.h
@@ -5,13 +5,22 @@
#define SCREEN_W 1280
#define SCREEN_H 720
+#define RENDER_DISTANCE 16
+
typedef struct Tiled {
TiledMap tiledMap;
float zoom;
+
+ // main viewport offset
Vector2 offset;
+ // offset passed to shader for rendering
+ Vector2 renderOffset;
+ // offset used to calculate which chunks to render
+ int chunkOffset[2];
+
int atlasSize[2];
- int mapSize[2];
+ int renderArea[2];
Texture2D atlasTexture;
@@ -23,7 +32,7 @@ typedef struct Tiled {
int offsetLoc;
int atlasSizeLoc;
- int mapSizeLoc;
+ int renderAreaLoc;
int atlasTextureLoc;
int tilemapTextureLoc;