Merged revision(s) 512 from branches/SFML2:

Several small improvements:
- Translate word "author"
- Improved handling of KeyRepeat
- Added Icon to Installer
........

Fixed a few bugs caused by recent merges


git-svn-id: https://svn.code.sf.net/p/extremetuxracer/code/trunk@519 0420edf4-82e4-42fc-9478-35b55e6d67a3
master
pkeus 2014-07-13 15:15:14 +00:00
parent 16c58e954a
commit 6d5872cb2b
18 changed files with 87 additions and 98 deletions

View File

@ -84,6 +84,7 @@
<UIRef Id="WixUI_FeatureTree"/>
<Icon Id='ExtremeTuxRacer.exe' SourceFile='$(var.BinDir)\ExtremeTuxRacer.exe' />
<Property Id="ARPPRODUCTICON" Value="ExtremeTuxRacer.exe" />
<WixVariable Id="WixUILicenseRtf" Value="GPLv3.rtf" />
<WixVariable Id="WixUIBannerBmp" Value="..\..\resources\banner.bmp" />

View File

@ -111,4 +111,6 @@
*[idx] 89 [engl] Path length [trans] Streckenlänge
*[idx] 90 [engl] Average speed [trans] Durchschnittsgeschwindigkeit
*[idx] 91 [engl] Position [trans] Platz
*[idx] 92 [engl] in highscore list [trans] in der Punktelilste.
*[idx] 92 [engl] in highscore list [trans] in der Punktelilste.
*[idx] 93 [engl] Author [trans] Autor

View File

@ -99,10 +99,15 @@
*[idx] 83 [engl] Randomize settings [trans]
*[idx] 84 [engl] Score [trans]
*[idx] 85 [engl] Herring [trans]
*[idx] 86 [engl] Time [trans]
*[idx] 87 [engl] Path length [trans]
*[idx] 88 [engl] Average speed [trans]
*[idx] 89 [engl] Position [trans]
*[idx] 90 [engl] in highscore list [trans]
*[idx] 84 [engl] Fullscreen setting has changed, [trans]
*[idx] 85 [engl] You need to restart the game [trans]
*[idx] 86 [engl] Score [trans]
*[idx] 87 [engl] Herring [trans]
*[idx] 88 [engl] Time [trans]
*[idx] 89 [engl] Path length [trans]
*[idx] 90 [engl] Average speed [trans]
*[idx] 91 [engl] Position [trans]
*[idx] 92 [engl] in highscore list [trans]
*[idx] 93 [engl] Author [trans]

View File

@ -149,7 +149,6 @@ static int dd;
void CGameConfig::Enter() {
Winsys.ShowCursor(!param.ice_cursor);
Winsys.KeyRepeat(true);
for (int i=0; i<NUM_RESOLUTIONS; i++) res_names[i] = Winsys.GetResName(i);
@ -199,9 +198,6 @@ void CGameConfig::Loop(double time_step) {
Tex.Draw(TOP_LEFT, 0, 0, 1);
Tex.Draw(TOP_RIGHT, ww-256, 0, 1);
// DrawFrameX (area.left, area.top, area.right-area.left, area.bottom - area.top,
// 0, colMBackgr, colBlack, 0.2);
FT.AutoSizeN(4);
if (resolution->focussed()) FT.SetColor(colDYell);
@ -251,7 +247,3 @@ void CGameConfig::Loop(double time_step) {
Reshape(ww, hh);
Winsys.SwapBuffers();
}
void CGameConfig::Exit() {
Winsys.KeyRepeat(false);
}

View File

@ -26,7 +26,6 @@ class CGameConfig : public State {
void Keyb(unsigned int key, bool special, bool release, int x, int y);
void Mouse(int button, int state, int x, int y);
void Motion(int x, int y);
void Exit();
public:
};

View File

@ -194,9 +194,6 @@ void CEvent::Loop(double timestep) {
Tex.Draw(TOP_LEFT, 0, 0, 1);
Tex.Draw(TOP_RIGHT, ww-256, 0, 1);
// DrawFrameX (area.left, area.top, area.right-area.left, area.bottom - area.top,
// 0, colMBackgr, colBlack, 0.2);
if (ready == 0) { // cup not finished
FT.AutoSizeN(6);
FT.SetColor(colWhite);

View File

@ -611,79 +611,77 @@ void SetFocus(TWidget* widget) {
if (!widget)
focussed = -1;
else
for (int i = 0; i < (int)Widgets.size(); i++)
for (size_t i = 0; i < Widgets.size(); i++) {
if (Widgets[i] == widget) {
focussed = i;
focussed = (int)i;
break;
}
}
}
void IncreaseFocus() {
if (focussed >= 0)
Widgets[focussed]->focus = false;
focussed++;
if (focussed >= (int)Widgets.size())
focussed = 0;
int end = focussed;
// Select only active widgets
do {
if (Widgets[focussed]->GetActive())
break;
void IncreaseFocus() {
if (focussed >= 0)
Widgets[focussed]->focus = false;
focussed++;
if (focussed >= (int)Widgets.size())
focussed = 0;
} while (end != focussed);
int end = focussed;
// Select only active widgets
do {
if (Widgets[focussed]->GetActive())
break;
if (focussed >= 0)
Widgets[focussed]->focus = true;
}
void DecreaseFocus() {
if (focussed >= 0)
Widgets[focussed]->focus = false;
focussed++;
if (focussed >= (int)Widgets.size())
focussed = 0;
} while (end != focussed);
if (focussed > 0)
focussed--;
else
focussed = (int)Widgets.size()-1;
int end = focussed;
// Select only active widgets
do {
if (Widgets[focussed]->GetActive())
break;
if (focussed >= 0)
Widgets[focussed]->focus = true;
}
void DecreaseFocus() {
if (focussed >= 0)
Widgets[focussed]->focus = false;
if (focussed > 0)
focussed--;
else
focussed = (int)Widgets.size()-1;
} while (end != focussed);
int end = focussed;
// Select only active widgets
do {
if (Widgets[focussed]->GetActive())
break;
if (focussed >= 0)
Widgets[focussed]->focus = true;
}
if (focussed > 0)
focussed--;
else
focussed = (int)Widgets.size()-1;
} while (end != focussed);
void ResetGUI() {
for (size_t i = 0; i < Widgets.size(); i++)
delete Widgets[i];
Widgets.clear();
focussed = 0;
}
if (focussed >= 0)
Widgets[focussed]->focus = true;
}
void ResetGUI() {
for (size_t i = 0; i < Widgets.size(); i++)
delete Widgets[i];
Widgets.clear();
focussed = 0;
}
// ------------------ new ---------------------------------------------
int AutoYPosN(double percent) {
double hh = (double)Winsys.resolution.height;
double po = hh * percent / 100;
return (int)(po);
}
int AutoYPosN(double percent) {
return Winsys.resolution.height * percent / 100.0;
}
TArea AutoAreaN(double top_perc, double bott_perc, int w) {
TArea res;
res.top = AutoYPosN(top_perc);
res.bottom = AutoYPosN(bott_perc);
if (w > Winsys.resolution.width) w = Winsys.resolution.width;
res.left = (Winsys.resolution.width - w) / 2;
res.right = Winsys.resolution.width - res.left;
return res;
}
TArea AutoAreaN(double top_perc, double bott_perc, int w) {
TArea res;
res.top = AutoYPosN(top_perc);
res.bottom = AutoYPosN(bott_perc);
if (w > Winsys.resolution.width) w = Winsys.resolution.width;
res.left = (Winsys.resolution.width - w) / 2;
res.right = Winsys.resolution.width - res.left;
return res;
}

View File

@ -82,7 +82,6 @@ void CNewPlayer::Motion(int x, int y) {
static int prevleft, prevtop, prevwidth;
void CNewPlayer::Enter() {
Winsys.KeyRepeat(true);
Winsys.ShowCursor(!param.ice_cursor);
Music.Play(param.menu_music, -1);
@ -123,9 +122,6 @@ void CNewPlayer::Loop(double timestep) {
textfield->UpdateCursor(timestep);
// DrawFrameX (area.left, area.top, area.right-area.left, area.bottom - area.top,
// 0, colMBackgr, col, 0.2);
Tex.Draw(BOTTOM_LEFT, 0, hh - 256, 1);
Tex.Draw(BOTTOM_RIGHT, ww-256, hh-256, 1);
Tex.Draw(TOP_LEFT, 0, 0, 1);

View File

@ -52,10 +52,6 @@ void COglTest::Keyb(unsigned int key, bool special, bool release, int x, int y)
}
}
void COglTest::Enter() {
Winsys.KeyRepeat(true);
}
void COglTest::Loop(double timestep) {
// ------------- 3d scenery ---------------------------------------
ScopedRenderMode rm(TUX);

View File

@ -22,7 +22,6 @@ GNU General Public License for more details.
#include "states.h"
class COglTest : public State {
void Enter();
void Loop(double time_step);
void Keyb(unsigned int key, bool special, bool release, int x, int y);
public:

View File

@ -219,7 +219,7 @@ void CRaceSelect::Loop(double timestep) {
FT.DrawString(boxleft+8, prevtop+i*dist, CourseList[course->GetValue()].desc[i]);
}
FT.DrawString(CENTER, prevtop + prevheight + 10, "Author: " + CourseList[course->GetValue()].author);
FT.DrawString(CENTER, prevtop + prevheight + 10, Trans.Text(93) + ": " + CourseList[course->GetValue()].author);
FT.DrawString(CENTER, AutoYPosN(45), info);

View File

@ -221,6 +221,8 @@ void CRacing::Enter() {
Music.PlayTheme(g_game.theme_id, MUS_RACING);
g_game.finish = false;
Winsys.KeyRepeat(false);
}
// -------------------- sound -----------------------------------------
@ -383,6 +385,7 @@ void CRacing::Loop(double time_step) {
}
// ---------------------------------- term ------------------
void CRacing::Exit() {
Winsys.KeyRepeat(true);
Sound.HaltAll();
break_track_marks();
}

View File

@ -216,7 +216,6 @@ static int dd1, dd2, dd3, dd4;
void CScore::Enter() {
Winsys.ShowCursor(!param.ice_cursor);
Winsys.KeyRepeat(true);
Music.Play(param.menu_music, -1);
framewidth = 550 * Winsys.scale;

View File

@ -42,7 +42,7 @@ void State::Manager::Run(State& entranceState) {
CallLoopFunction();
if (param.framerate != 0) {
clock_t nticks = clock();
int32_t sleeptime = (CLOCKS_PER_SEC/param.framerate - (nticks-ticks)) / 1000;
int32_t sleeptime = (int32_t)(CLOCKS_PER_SEC / param.framerate - (nticks - ticks)) * (1000 / CLOCKS_PER_SEC);
if (sleeptime > 0)
SDL_Delay(sleeptime);
ticks = nticks;

View File

@ -235,8 +235,6 @@ void CTools::Enter() {
InitCharTools();
InitFrameTools();
Winsys.KeyRepeat(true);
}
void CTools::Keyb(unsigned int key, bool special, bool release, int x, int y) {

View File

@ -125,13 +125,18 @@ void CTranslation::SetDefaultTranslations() {
texts[83] = "Randomize settings";
texts[84] = "Score";
texts[85] = "Herring";
texts[86] = "Time";
texts[87] = "Path length";
texts[88] = "Average speed";
texts[89] = "Position";
texts[90] = "in highscore list";
texts[84] = "Fullscreen setting has changed,";
texts[85] = "You need to restart the game";
texts[86] = "Score";
texts[87] = "Herring";
texts[88] = "Time";
texts[89] = "Path length";
texts[90] = "Average speed";
texts[91] = "Position";
texts[92] = "in highscore list";
texts[93] = "Author";
}
const string& CTranslation::Text(size_t idx) const {

View File

@ -27,7 +27,7 @@ An name convention:
#include <vector>
#define MAX_LANGUAGES 32
#define NUM_COMMON_TEXTS 93
#define NUM_COMMON_TEXTS 94
#define MAX_COMMON_TEXT_LINES NUM_COMMON_TEXTS*2

View File

@ -171,7 +171,6 @@ void CWinsys::Init() {
Reshape(resolution.width, resolution.height);
SDL_WM_SetCaption(WINDOW_TITLE, WINDOW_TITLE);
KeyRepeat(false);
if (USE_JOYSTICK) InitJoystick();
// SDL_EnableUNICODE (1);
}