Misc. debugging bits.

This commit is contained in:
Steve 2018-02-03 16:22:04 +00:00
parent 187b887698
commit 52b4336c00
4 changed files with 17 additions and 0 deletions

View File

@ -44,6 +44,11 @@ void doHud(void)
}
}
void drawHud(void)
{
drawText(SCREEN_WIDTH / 2, SCREEN_HEIGHT - 25, 14, TA_CENTER, colors.white, "Bob [%.0f, %.0f]", world.bob->x / MAP_TILE_SIZE, world.bob->y / MAP_TILE_SIZE);
}
void setGameplayMessage(int newMessageType, const char *format, ...)
{
char newMessage[MAX_DESCRIPTION_LENGTH];
@ -60,6 +65,8 @@ void setGameplayMessage(int newMessageType, const char *format, ...)
STRNCPY(message, newMessage, MAX_DESCRIPTION_LENGTH);
messageType = newMessageType;
messageTime = FPS * 3;
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "%s", message);
}
}

View File

@ -21,3 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../common.h"
extern void showWidgetGroup(char *groupName);
extern void drawText(int x, int y, int size, int align, SDL_Color c, const char *format, ...);
extern Colors colors;
extern World world;

View File

@ -65,6 +65,9 @@ void initWorld(void)
app.delegate.draw = draw;
startMission();
world.bob->x = 110 * MAP_TILE_SIZE;
world.bob->y = 105 * MAP_TILE_SIZE;
}
static void logic(void)
@ -120,6 +123,8 @@ static void draw(void)
drawMap();
drawEntities(PLANE_FOREGROUND);
drawHud();
}
}

View File

@ -51,6 +51,7 @@ extern void drawEntities(int plane);
extern void drawMap(void);
extern void blitScaled(SDL_Texture *texture, int x, int y, int w, int h, int center);
extern void clearScreen(void);
extern void drawHud(void);
extern App app;
extern Dev dev;