Add SAF frontend

This commit is contained in:
Miloslav Ciz 2025-05-19 18:40:36 +02:00
parent bf2cd38337
commit c2bcf2d325
8 changed files with 131 additions and 40 deletions

28
game.h
View file

@ -176,6 +176,15 @@ uint8_t LCR_gameGetNextAudioSample(void);
#define LCR_LOADING_COMMAND ;
#endif
/**
This macro may be redefined to a command that will be executed upon certain
sound. This can be used if the platform can't play the game's 8 bit audio but
wants to play it's own sounds, e.g. beeps.
*/
#ifndef LCR_PLAY_SOUND_CALLBACK
#define LCR_PLAY_SOUND_CALLBACK(s) ;
#endif
/*
To make the game log FPS define a macro named LCR_FPS_GET_MS to a command that
evaluates to the current number of milliseconds since some given time. It
@ -1196,7 +1205,7 @@ void LCR_gameTimeToStr(uint32_t timeMS, char *str)
void LCR_gameDrawPopupMessage(void)
{
#define _TEXT_SIZE 5
#define _TEXT_SIZE 1 + 4 * (LCR_EFFECTIVE_RESOLUTION_Y > 96)
#define _OFFSET_V (LCR_EFFECTIVE_RESOLUTION_Y / 8)
int textH = LCR_rendererComputeTextHeight(_TEXT_SIZE);
@ -1267,28 +1276,31 @@ void LCR_gameDraw3DView(void)
str[2] = '0' + val % 10;
str[3] = 0;
#define _FONT_SIZE (1 + (LCR_EFFECTIVE_RESOLUTION_Y > 96))
LCR_rendererDrawText(str,LCR_EFFECTIVE_RESOLUTION_X - // speed (bot., right)
LCR_rendererComputeTextWidth(str,2) - LCR_GUI_GAP,
LCR_EFFECTIVE_RESOLUTION_Y - LCR_rendererComputeTextHeight(2) -
LCR_GUI_GAP,0,2);
LCR_rendererComputeTextWidth(str,_FONT_SIZE) - LCR_GUI_GAP,
LCR_EFFECTIVE_RESOLUTION_Y - LCR_rendererComputeTextHeight(_FONT_SIZE) -
LCR_GUI_GAP,0,_FONT_SIZE);
LCR_gameTimeToStr(LCR_timeTicksToMS(LCR_game.runTime),str);
if (LCR_game.state != LCR_GAME_STATE_RUN_FINISHED)
LCR_rendererDrawText(str,LCR_GUI_GAP,LCR_EFFECTIVE_RESOLUTION_Y -
2 * (LCR_rendererComputeTextHeight(2) + LCR_GUI_GAP),0,2);
2 * (LCR_rendererComputeTextHeight(_FONT_SIZE) + LCR_GUI_GAP),0,_FONT_SIZE);
else
LCR_rendererDrawText(str,((LCR_EFFECTIVE_RESOLUTION_X -
LCR_rendererComputeTextWidth(str,4)) / 2),
LCR_EFFECTIVE_RESOLUTION_Y / 2,
LCR_game.runTime <= LCR_currentMap.targetTime ?
LCR_CONVERT_COLOR(0x0700) : LCR_CONVERT_COLOR(0x4208),4);
LCR_CONVERT_COLOR(0x0700) : LCR_CONVERT_COLOR(0x4208),2 * _FONT_SIZE);
LCR_gameTimeToStr(LCR_currentMap.targetTime * LCR_RACING_TICK_MS,str);
LCR_rendererDrawText(str,LCR_GUI_GAP,LCR_EFFECTIVE_RESOLUTION_Y -
LCR_rendererComputeTextHeight(2) - LCR_GUI_GAP,
LCR_CONVERT_COLOR(0x4208),2);
LCR_rendererComputeTextHeight(_FONT_SIZE) - LCR_GUI_GAP,
LCR_CONVERT_COLOR(0x4208),_FONT_SIZE);
#undef _FONT_SIZE
}
void LCR_gameSaveReplay(void)