upd
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "../tiles/tile.h"
|
||||
#include "../util/font.h"
|
||||
#include "../util/atlas.h"
|
||||
#include "../entity/entity.h"
|
||||
|
||||
#define HEALTH_MARGIN 4
|
||||
|
||||
@@ -22,6 +23,7 @@ SDL_Rect PlayerRect;
|
||||
SDL_Rect playerTextureRect;
|
||||
|
||||
SDL_Rect targetItemBGRect;
|
||||
SDL_Rect waveInfoBGRect;
|
||||
|
||||
SDL_Rect targetItemRect;
|
||||
|
||||
@@ -142,6 +144,11 @@ void initPlayer(Player *plr) {
|
||||
targetItemBGRect.x = 0;
|
||||
targetItemBGRect.y = DISPLAY_HEIGHT - TILE_SIZE - fonts[2].size * 2;
|
||||
|
||||
waveInfoBGRect.y = 0;
|
||||
waveInfoBGRect.x = 0;
|
||||
waveInfoBGRect.w = 380;
|
||||
waveInfoBGRect.h = 80;
|
||||
|
||||
targetItemRect.w = TILE_SIZE;
|
||||
targetItemRect.h = TILE_SIZE;
|
||||
|
||||
@@ -249,6 +256,18 @@ void renderPlayer(Player *plr) {
|
||||
|
||||
SDL_SetRenderDrawColor(mainRenderer, 0, 0, 0, 255);
|
||||
SDL_RenderFillRect(mainRenderer, &targetItemBGRect);
|
||||
SDL_RenderFillRect(mainRenderer, &waveInfoBGRect);
|
||||
|
||||
|
||||
char hudStr[50];
|
||||
char waveStr[30];
|
||||
if (entities.activeCount > 0) {
|
||||
snprintf(waveStr, 30, "Remaining enemies: %d", entities.activeCount);
|
||||
} else {
|
||||
snprintf(waveStr, 30, "Next wave in: %dm %ds", waveInfo.waveTimer / 60, waveInfo.waveTimer % 60);
|
||||
}
|
||||
snprintf(hudStr, 30, "Wave: %d\n%s\n", waveInfo.waveCounter, waveStr);
|
||||
renderText(mainRenderer, fonts[1], hudStr, 0,0);
|
||||
|
||||
targetItemRect.y = DISPLAY_HEIGHT - TILE_SIZE;
|
||||
targetItemRect.x = TILE_SIZE / 4;
|
||||
|
Reference in New Issue
Block a user