Start HUD
This commit is contained in:
parent
6d31c3c492
commit
b177e924dd
5 changed files with 78 additions and 12 deletions
44
game.h
44
game.h
|
@ -179,6 +179,13 @@ void LCR_gameSetState(uint8_t state)
|
|||
LCR_game.stateStartTime = LCR_game.time;
|
||||
}
|
||||
|
||||
LCR_GameUnit LCR_carSpeedKMH(void)
|
||||
{
|
||||
return // we use 28/8 as an approximation of 3.6 to convers MPS to KMH
|
||||
(28 * LCR_SETTING_METERS_PER_BLOCK * LCR_racingGetCarSpeedUnsigned() *
|
||||
LCR_RACING_FPS) / (8 * LCR_GAME_UNIT);
|
||||
}
|
||||
|
||||
void LCR_gameResetRun(void)
|
||||
{
|
||||
LCR_LOG0("resetting run");
|
||||
|
@ -233,14 +240,6 @@ uint8_t LCR_gameStep(uint32_t time)
|
|||
LCR_keyStates[i] = LCR_keyPressed(i) ?
|
||||
(LCR_keyStates[i] < 255 ? LCR_keyStates[i] + 1 : 255) : 0;
|
||||
|
||||
//S3L_logTransform3D(LCR_renderer.scene.camera.transform);
|
||||
|
||||
if ((LCR_racing.tick % 32) == 0)
|
||||
{
|
||||
printf("speed: %d\n",LCR_racingGetCarSpeedSigned());
|
||||
|
||||
}
|
||||
|
||||
uint32_t sleep = 0;
|
||||
|
||||
if (LCR_keyStates[LCR_KEY_B] == 1)
|
||||
|
@ -365,7 +364,34 @@ LCR_GameUnit physicsInterpolationParam = LCR_GAME_UNIT -
|
|||
|
||||
LCR_rendererDraw();
|
||||
|
||||
LCR_rendererDrawText("abcdefghijklmnopqrstuvwxyz",10,20,0,2);
|
||||
int val = LCR_carSpeedKMH();
|
||||
|
||||
if (val < 5) // don't show tiny oscillations when still
|
||||
val = 0;
|
||||
|
||||
char str[6];
|
||||
|
||||
str[0] = val >= 100 ? '0' + (val / 100) % 10 : ' ';
|
||||
str[1] = val >= 10 ? '0' + (val / 10) % 10 : ' ';
|
||||
str[2] = '0' + val % 10;
|
||||
str[3] = 0;
|
||||
|
||||
LCR_rendererDrawText(str,
|
||||
LCR_EFFECTIVE_RESOLUTION_X -
|
||||
LCR_rendererComputeTextWidth(str,2) - 20,
|
||||
LCR_EFFECTIVE_RESOLUTION_Y -
|
||||
LCR_rendererComputeTextHeight(2) - 20,0,2);
|
||||
|
||||
str[0] = '1'; // TODO
|
||||
str[1] = '2';
|
||||
str[2] = '\'';
|
||||
str[3] = '3';
|
||||
str[4] = '4';
|
||||
str[5] = 0;
|
||||
|
||||
LCR_rendererDrawText(str,20,
|
||||
LCR_EFFECTIVE_RESOLUTION_Y -
|
||||
LCR_rendererComputeTextHeight(2) - 20,0,2);
|
||||
|
||||
if (LCR_game.debugDraw)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue