summaryrefslogtreecommitdiff
path: root/tiled.c
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2023-04-24 13:27:27 +0100
committerdavidovski <david@davidovski.xyz>2023-04-24 13:27:27 +0100
commiteac93d5524067f44e2601348cc1f658ee79a2486 (patch)
treea88f81ae15e91c020dc2441fce4cb7c66aeb1d6a /tiled.c
parent50a8424269b868bc89be72fe19756bab8f6d12e9 (diff)
Test with bigger map and show fps
Diffstat (limited to 'tiled.c')
-rw-r--r--tiled.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/tiled.c b/tiled.c
index 0c9954e..fb51183 100644
--- a/tiled.c
+++ b/tiled.c
@@ -4,17 +4,17 @@
#define SCREEN_W 1280
#define SCREEN_H 720
-#define MAP_W 8
+#define MAP_W 16
#define MAP_H 4
const int tilemap[MAP_H][MAP_W] = {
- {0, 0, 0, 0, 0, 0, 3, 3},
- {0, 3, 3, 0, 0, 3, 1, 1},
- {3, 1, 1, 3, 3, 1, 2, 2},
- {1, 2, 2, 1, 1, 2, 4, 4}
-};
-const int atlasSize[2] = {2, 2};
+ {0, 0, 0, 0, 0, 0, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0,},
+ {0, 3, 3, 0, 0, 3, 1, 1, 1, 3, 0, 0, 0, 0, 0, 0,},
+ {3, 1, 1, 3, 3, 1, 2, 2, 2, 1, 3, 3, 3, 0, 0, 3,},
+ {1, 2, 2, 1, 1, 2, 4, 4, 4, 2, 1, 1, 1, 3, 3, 1,}
+};
+const int atlasSize[2] = {2, 2};
int main() {
InitWindow(SCREEN_W, SCREEN_H, "tiled");
@@ -27,20 +27,18 @@ int main() {
float offset[2] = {0, 0};
float zoom = 1.0f;
Texture atlas = LoadTexture("tiles.png");
- // size of the tile atlas grid in tiles
-
int resolutionLoc = GetShaderLocation(shader, "resolution");
int locationLoc = GetShaderLocation(shader, "offset");
int zoomLoc = GetShaderLocation(shader, "zoom");
int atlasSizeLoc = GetShaderLocation(shader, "atlasSize");
- int tilemapLoc[MAP_H][MAP_W]= {};
+ int tilemapLoc[MAP_H][MAP_W] = {};
for (int x = 0; x < MAP_W; x++) {
- for (int y = 0; y < MAP_H; y++) {
- tilemapLoc[y][x] = GetShaderLocation(shader, TextFormat("tilemap[%d][%d]", y, x));
+ for (int y = 0; y < MAP_H; y++) {
+ tilemapLoc[y][x] =
+ GetShaderLocation(shader, TextFormat("tilemap[%d][%d]", y, x));
+ }
}
- }
-
int textureLoc = GetShaderLocation(shader, "texture1");
@@ -78,6 +76,8 @@ int main() {
DrawTexture(target.texture, 0, 0, WHITE);
EndShaderMode();
+ DrawText(TextFormat("FPS: %d", GetFPS()), 12, 12, 24, DARKGRAY);
+
EndDrawing();
}