mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 10:09:43 +01:00
preloader.cpp: make loading screen translatable
This mainly adds loc::gettext calls and replaces SDL_snprintf by VFormat for the percentage. This commit is part of rewritten history of the localization branch. The original (unsquashed) commit history can be found here: https://github.com/Dav999-v/VVVVVV/tree/localization-orig
This commit is contained in:
parent
56f812a7e9
commit
b548783df2
1 changed files with 20 additions and 6 deletions
|
@ -1,8 +1,11 @@
|
||||||
|
#include "Constants.h"
|
||||||
#include "Enums.h"
|
#include "Enums.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "Graphics.h"
|
#include "Graphics.h"
|
||||||
|
#include "Localization.h"
|
||||||
#include "KeyPoll.h"
|
#include "KeyPoll.h"
|
||||||
#include "UtilityClass.h"
|
#include "UtilityClass.h"
|
||||||
|
#include "VFormat.h"
|
||||||
|
|
||||||
static int pre_fakepercent=0, pre_transition=30;
|
static int pre_fakepercent=0, pre_transition=30;
|
||||||
static bool pre_startgame=false;
|
static bool pre_startgame=false;
|
||||||
|
@ -51,6 +54,8 @@ void preloaderrenderfixed(void)
|
||||||
|
|
||||||
void preloaderrender(void)
|
void preloaderrender(void)
|
||||||
{
|
{
|
||||||
|
bool print_percentage = false;
|
||||||
|
|
||||||
if(pre_transition>=30){
|
if(pre_transition>=30){
|
||||||
switch(pre_curcol) {
|
switch(pre_curcol) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -97,11 +102,7 @@ void preloaderrender(void)
|
||||||
|
|
||||||
FillRect(graphics.backBuffer, pre_frontrectx, pre_frontrecty, pre_frontrectw,pre_frontrecth, graphics.getRGB(0x3E,0x31,0xA2));
|
FillRect(graphics.backBuffer, pre_frontrectx, pre_frontrecty, pre_frontrectw,pre_frontrecth, graphics.getRGB(0x3E,0x31,0xA2));
|
||||||
|
|
||||||
if(pre_fakepercent==100){
|
print_percentage = true;
|
||||||
graphics.Print(282-(15*8), 204, "LOADING... " + help.String(int(pre_fakepercent))+"%", 124, 112, 218, false);
|
|
||||||
}else{
|
|
||||||
graphics.Print(282-(14*8), 204, "LOADING... " + help.String(int(pre_fakepercent))+"%", 124, 112, 218, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Render
|
//Render
|
||||||
if (pre_startgame) {
|
if (pre_startgame) {
|
||||||
|
@ -117,7 +118,20 @@ void preloaderrender(void)
|
||||||
ClearSurface(graphics.backBuffer);
|
ClearSurface(graphics.backBuffer);
|
||||||
FillRect(graphics.backBuffer, pre_frontrectx, pre_frontrecty, pre_frontrectw,pre_frontrecth, graphics.getRGB(0x3E,0x31,0xA2));
|
FillRect(graphics.backBuffer, pre_frontrectx, pre_frontrecty, pre_frontrectw,pre_frontrecth, graphics.getRGB(0x3E,0x31,0xA2));
|
||||||
|
|
||||||
graphics.Print(282-(15*8), 204, "LOADING... 100%", 124, 112, 218, false);
|
print_percentage = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (print_percentage) {
|
||||||
|
char buffer[SCREEN_WIDTH_CHARS + 1];
|
||||||
|
vformat_buf(
|
||||||
|
buffer, sizeof(buffer),
|
||||||
|
loc::gettext("LOADING... {percent|digits=2|spaces}%"),
|
||||||
|
"percent:int",
|
||||||
|
pre_fakepercent
|
||||||
|
);
|
||||||
|
|
||||||
|
int percentage_len = graphics.len(buffer);
|
||||||
|
graphics.Print(282-percentage_len, 204, buffer, 124, 112, 218, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
graphics.drawfade();
|
graphics.drawfade();
|
||||||
|
|
Loading…
Reference in a new issue