finally properly implemented depth optimization for 2d

This commit is contained in:
2024-10-14 15:31:56 +03:00
parent 3535a185df
commit 19bf88d44e
4 changed files with 127 additions and 13 deletions

View File

@ -30,7 +30,9 @@ static void handle_input(void)
state->bunnies[state->bunniesCount].speed.x = (float)(rand() % 500 - 250) / 60.0f;
state->bunnies[state->bunniesCount].speed.y = (float)(rand() % 500 - 250) / 60.0f;
state->bunnies[state->bunniesCount].color =
(Color){(uint8_t)(rand() % 190 + 50), (uint8_t)(rand() % 160 + 80), (uint8_t)(rand() % 140 + 100), 255};
(Color){(uint8_t)(state->bunniesCount % 190 + 50),
(uint8_t)((state->bunniesCount + 120) % 160 + 80),
(uint8_t)((state->bunniesCount + 65) % 140 + 100), 255};
state->bunniesCount++;
}
}
@ -46,7 +48,9 @@ static void handle_input(void)
state->bunnies[state->bunniesCount].speed.x = (float)(rand() % 500 - 250) / 60.0f;
state->bunnies[state->bunniesCount].speed.y = (float)(rand() % 500 - 250) / 60.0f;
state->bunnies[state->bunniesCount].color =
(Color){(uint8_t)(rand() % 190 + 50), (uint8_t)(rand() % 160 + 80), (uint8_t)(rand() % 140 + 100), 255};
(Color){(uint8_t)(state->bunniesCount % 190 + 50),
(uint8_t)((state->bunniesCount + 120) % 160 + 80),
(uint8_t)((state->bunniesCount + 65) % 140 + 100), 255};
state->bunniesCount++;
}
}

View File

@ -3,7 +3,7 @@
#include "twn_game_api.h"
#define MAX_BUNNIES 100000 // 100K bunnies limit
#define MAX_BUNNIES 500000 // 100K bunnies limit
#define BUNNY_W 26
#define BUNNY_H 37
#define SPRITE_SCALE 1