Refactorization: Removed useless parameter 'unsigned int mod' and 'bool special'

Bugfix: Fixed key events are counted twice in main menu

git-svn-id: https://svn.code.sf.net/p/extremetuxracer/code/branches/SFML2@504 0420edf4-82e4-42fc-9478-35b55e6d67a3
master
pkeus 2014-04-05 16:35:47 +00:00
parent a6f5aecdb1
commit 1a058f4f00
40 changed files with 64 additions and 65 deletions

View File

@ -93,7 +93,7 @@ void SetConfig() {
State::manager.RequestEnterState(*State::manager.PreviousState());
}
void CGameConfig::Keyb(sf::Keyboard::Key key, bool special, bool release, int x, int y) {
void CGameConfig::Keyb(sf::Keyboard::Key key, bool release, int x, int y) {
if (release) return;
switch (key) {
@ -110,7 +110,7 @@ void CGameConfig::Keyb(sf::Keyboard::Key key, bool special, bool release, int x,
SetConfig();
break;
default:
KeyGUI(key, 0, release);
KeyGUI(key, release);
break;
}
}

View File

@ -23,7 +23,7 @@ GNU General Public License for more details.
class CGameConfig : public State {
void Enter();
void Loop(float time_step);
void Keyb(sf::Keyboard::Key key, bool special, bool release, int x, int y);
void Keyb(sf::Keyboard::Key key, bool release, int x, int y);
void Mouse(int button, int state, int x, int y);
void Motion(int x, int y);
void Exit();

View File

@ -93,7 +93,7 @@ void CCredits::DrawCreditsText(float time_step) {
if (offs < TOP_Y) y_offset = 0;
}
void CCredits::Keyb(sf::Keyboard::Key key, bool special, bool release, int x, int y) {
void CCredits::Keyb(sf::Keyboard::Key key, bool release, int x, int y) {
if (release) return;
switch (key) {
case sf::Keyboard::M:

View File

@ -38,7 +38,7 @@ class CCredits : public State {
void Enter();
void Exit();
void Loop(float time_step);
void Keyb(sf::Keyboard::Key key, bool special, bool release, int x, int y);
void Keyb(sf::Keyboard::Key key, bool release, int x, int y);
void Mouse(int button, int state, int x, int y);
void Motion(int x, int y);
public:

View File

@ -64,7 +64,7 @@ void StartRace() {
State::manager.RequestEnterState(Loading);
}
void CEvent::Keyb(sf::Keyboard::Key key, bool special, bool release, int x, int y) {
void CEvent::Keyb(sf::Keyboard::Key key, bool release, int x, int y) {
if (release) return;
switch (key) {
case sf::Keyboard::Return:
@ -78,7 +78,7 @@ void CEvent::Keyb(sf::Keyboard::Key key, bool special, bool release, int x, int
param.ui_snow = !param.ui_snow;
break;
default:
KeyGUI(key, 0, release);
KeyGUI(key, release);
}
}

View File

@ -24,7 +24,7 @@ GNU General Public License for more details.
class CEvent : public State {
void Enter();
void Loop(float time_step);
void Keyb(sf::Keyboard::Key key, bool special, bool release, int x, int y);
void Keyb(sf::Keyboard::Key key, bool release, int x, int y);
void Mouse(int button, int state, int x, int y);
void Motion(int x, int y);
public:

View File

@ -49,7 +49,7 @@ void EnterEvent() {
State::manager.RequestEnterState(Event);
}
void CEventSelect::Keyb(sf::Keyboard::Key key, bool special, bool release, int x, int y) {
void CEventSelect::Keyb(sf::Keyboard::Key key, bool release, int x, int y) {
if (release) return;
switch (key) {
case sf::Keyboard::Escape:
@ -66,7 +66,7 @@ void CEventSelect::Keyb(sf::Keyboard::Key key, bool special, bool release, int x
param.ui_snow = !param.ui_snow;
break;
default:
KeyGUI(key, 0, release);
KeyGUI(key, release);
}
}

View File

@ -24,7 +24,7 @@ GNU General Public License for more details.
class CEventSelect : public State {
void Enter();
void Loop(float time_step);
void Keyb(sf::Keyboard::Key key, bool special, bool release, int x, int y);
void Keyb(sf::Keyboard::Key key, bool release, int x, int y);
void Mouse(int button, int state, int x, int y);
void Motion(int x, int y);
public:

View File

@ -53,7 +53,7 @@ void QuitGameOver() {
}
}
void CGameOver::Keyb(sf::Keyboard::Key key, bool special, bool release, int x, int y) {
void CGameOver::Keyb(sf::Keyboard::Key key, bool release, int x, int y) {
if (release) return;
if (key == 13 || key == sf::Keyboard::Escape) QuitGameOver();
}

View File

@ -24,7 +24,7 @@ GNU General Public License for more details.
class CGameOver : public State {
void Enter();
void Loop(float time_step);
void Keyb(sf::Keyboard::Key key, bool special, bool release, int x, int y);
void Keyb(sf::Keyboard::Key key, bool release, int x, int y);
void Mouse(int button, int state, int x, int y);
public:
};

View File

@ -69,10 +69,9 @@ void CGameTypeSelect::Mouse(int button, int state, int x, int y) {
}
}
void CGameTypeSelect::Keyb(sf::Keyboard::Key key, bool special, bool release, int x, int y) {
void CGameTypeSelect::Keyb(sf::Keyboard::Key key, bool release, int x, int y) {
if (release) return;
KeyGUI(key, 0, release);
switch (key) {
case sf::Keyboard::U:
param.ui_snow = !param.ui_snow;
@ -87,7 +86,7 @@ void CGameTypeSelect::Keyb(sf::Keyboard::Key key, bool special, bool release, in
Music.FreeMusics();
break;
default:
KeyGUI(key, 0, release);
KeyGUI(key, release);
break;
}
}

View File

@ -24,7 +24,7 @@ GNU General Public License for more details.
class CGameTypeSelect : public State {
void Enter();
void Loop(float time_step);
void Keyb(sf::Keyboard::Key key, bool special, bool release, int x, int y);
void Keyb(sf::Keyboard::Key key, bool release, int x, int y);
void Mouse(int button, int state, int x, int y);
void Motion(int x, int y);
public:

View File

@ -230,7 +230,7 @@ void TTextField::SetCursorPos(size_t new_pos) {
cursorShape.setPosition(x, mouseRect.top + 9);
}
void TTextField::Key(sf::Keyboard::Key key, unsigned int mod, bool released) {
void TTextField::Key(sf::Keyboard::Key key, bool released) {
switch (key) {
case sf::Keyboard::Delete:
if (cursorPos < text.getSize()) text.erase(cursorPos, 1);
@ -306,7 +306,7 @@ bool TCheckbox::Click(int x, int y) {
return false;
}
void TCheckbox::Key(sf::Keyboard::Key key, unsigned int mod, bool released) {
void TCheckbox::Key(sf::Keyboard::Key key, bool released) {
if (released) return;
if (key == sf::Keyboard::Space || key == sf::Keyboard::Return) {
@ -374,7 +374,7 @@ bool TIconButton::Click(int x, int y) {
return false;
}
void TIconButton::Key(sf::Keyboard::Key key, unsigned int mod, bool released) {
void TIconButton::Key(sf::Keyboard::Key key, bool released) {
if (released) return;
if (key == sf::Keyboard::Down || key == sf::Keyboard::Left) { // Arrow down/left
@ -464,7 +464,7 @@ bool TUpDown::Click(int x, int y) {
return false;
}
void TUpDown::Key(sf::Keyboard::Key key, unsigned int mod, bool released) {
void TUpDown::Key(sf::Keyboard::Key key, bool released) {
if (released) return;
if (key == sf::Keyboard::Up) { // Arrow up
@ -652,7 +652,7 @@ TWidget* MouseMoveGUI(int x, int y) {
return Widgets[focussed];
}
TWidget* KeyGUI(sf::Keyboard::Key key, unsigned int mod, bool released) {
TWidget* KeyGUI(sf::Keyboard::Key key, bool released) {
if (!released) {
switch (key) {
case sf::Keyboard::Tab:
@ -683,7 +683,7 @@ TWidget* KeyGUI(sf::Keyboard::Key key, unsigned int mod, bool released) {
}
if (focussed == -1)
return 0;
Widgets[focussed]->Key(key, mod, released);
Widgets[focussed]->Key(key, released);
return Widgets[focussed];
}

View File

@ -57,7 +57,7 @@ public:
virtual void Draw() const = 0;
virtual bool Click(int x, int y);
virtual void TextEnter(char text) {}
virtual void Key(sf::Keyboard::Key key, unsigned int mod, bool released) {}
virtual void Key(sf::Keyboard::Key key, bool released) {}
virtual void MouseMove(int x, int y);
virtual void Focussed() {}
virtual void Activated() {}
@ -114,7 +114,7 @@ public:
TTextField(int x, int y, int width, int height, const sf::String& text_);
void Draw() const;
void TextEnter(char text);
void Key(sf::Keyboard::Key key, unsigned int mod, bool released);
void Key(sf::Keyboard::Key key, bool released);
void UpdateCursor(float timestep);
const sf::String& Text() const { return text; }
};
@ -132,7 +132,7 @@ public:
void SetChecked(bool c) { checked = c; }
void Focussed();
bool Click(int x, int y);
void Key(sf::Keyboard::Key key, unsigned int mod, bool released);
void Key(sf::Keyboard::Key key, bool released);
};
TCheckbox* AddCheckbox(int x, int y, int width, const sf::String& tag);
@ -147,7 +147,7 @@ public:
void SetValue(int _value);
void Draw() const;
bool Click(int x, int y);
void Key(sf::Keyboard::Key key, unsigned int mod, bool released);
void Key(sf::Keyboard::Key key, bool released);
};
TIconButton* AddIconButton(int x, int y, const sf::Texture& texture, double size, int maximum, int value);
@ -177,7 +177,7 @@ public:
void SetMaximum(int max_);
void Draw() const;
bool Click(int x, int y);
void Key(sf::Keyboard::Key key, unsigned int mod, bool released);
void Key(sf::Keyboard::Key key, bool released);
void MouseMove(int x, int y);
};
TUpDown* AddUpDown(int x, int y, int minimum, int maximum, int value, int distance = 2);
@ -187,7 +187,7 @@ TUpDown* AddUpDown(int x, int y, int minimum, int maximum, int value, int distan
void DrawGUI();
TWidget* ClickGUI(int x, int y);
TWidget* MouseMoveGUI(int x, int y);
TWidget* KeyGUI(sf::Keyboard::Key key, unsigned int mod, bool released);
TWidget* KeyGUI(sf::Keyboard::Key key, bool released);
TWidget* TextEnterGUI(char text);
void SetFocus(TWidget* widget);
void IncreaseFocus();

View File

@ -35,7 +35,7 @@ TLabel* headline;
TLabel* texts[TEXT_LINES];
TLabel* footnote;
void CHelp::Keyb(sf::Keyboard::Key key, bool special, bool release, int x, int y) {
void CHelp::Keyb(sf::Keyboard::Key key, bool release, int x, int y) {
State::manager.RequestEnterState(*State::manager.PreviousState());
}

View File

@ -24,7 +24,7 @@ GNU General Public License for more details.
class CHelp : public State {
void Enter();
void Loop(float time_step);
void Keyb(sf::Keyboard::Key key, bool special, bool release, int x, int y);
void Keyb(sf::Keyboard::Key key, bool release, int x, int y);
void Mouse(int button, int state, int x, int y);
void Motion(int x, int y);
public:

View File

@ -129,7 +129,7 @@ void CIntro::Loop(float time_step) {
}
// -----------------------------------------------------------------------
void CIntro::Keyb(sf::Keyboard::Key key, bool special, bool release, int x, int y) {
void CIntro::Keyb(sf::Keyboard::Key key, bool release, int x, int y) {
if (release)
return;

View File

@ -24,7 +24,7 @@ GNU General Public License for more details.
class CIntro : public State {
void Enter();
void Loop(float time_step);
void Keyb(sf::Keyboard::Key key, bool special, bool release, int x, int y);
void Keyb(sf::Keyboard::Key key, bool release, int x, int y);
public:
};

View File

@ -45,10 +45,10 @@ void QuitAndAddPlayer() {
State::manager.RequestEnterState(Regist);
}
void CNewPlayer::Keyb(sf::Keyboard::Key key, bool special, bool release, int x, int y) {
void CNewPlayer::Keyb(sf::Keyboard::Key key, bool release, int x, int y) {
if (release) return;
KeyGUI(key, 0, release);
KeyGUI(key, release);
switch (key) {
case sf::Keyboard::Escape:
State::manager.RequestEnterState(Regist);

View File

@ -24,7 +24,7 @@ GNU General Public License for more details.
class CNewPlayer : public State {
void Enter();
void Loop(float time_step);
void Keyb(sf::Keyboard::Key key, bool special, bool release, int x, int y);
void Keyb(sf::Keyboard::Key key, bool release, int x, int y);
void TextEntered(char text);
void Mouse(int button, int state, int x, int y);
void Motion(int x, int y);

View File

@ -43,7 +43,7 @@ void SetTestLight() {
}
void COglTest::Keyb(sf::Keyboard::Key key, bool special, bool release, int x, int y) {
void COglTest::Keyb(sf::Keyboard::Key key, bool release, int x, int y) {
if (release) return;
switch (key) {
case sf::Keyboard::Escape:

View File

@ -24,7 +24,7 @@ GNU General Public License for more details.
class COglTest : public State {
void Enter();
void Loop(float time_step);
void Keyb(sf::Keyboard::Key key, bool special, bool release, int x, int y);
void Keyb(sf::Keyboard::Key key, bool release, int x, int y);
public:
};

View File

@ -42,7 +42,7 @@ static bool fog = true;
static bool terr = true;
static bool trees = true;
void CPaused::Keyb(sf::Keyboard::Key key, bool special, bool release, int x, int y) {
void CPaused::Keyb(sf::Keyboard::Key key, bool release, int x, int y) {
if (release) return;
switch (key) {
case sf::Keyboard::S:

View File

@ -23,7 +23,7 @@ GNU General Public License for more details.
class CPaused : public State {
void Loop(float time_step);
void Keyb(sf::Keyboard::Key key, bool special, bool release, int x, int y);
void Keyb(sf::Keyboard::Key key, bool release, int x, int y);
void Mouse(int button, int state, int x, int y);
public:
};

View File

@ -103,9 +103,9 @@ void CRaceSelect::Mouse(int button, int state, int x, int y) {
}
}
void CRaceSelect::Keyb(sf::Keyboard::Key key, bool special, bool release, int x, int y) {
void CRaceSelect::Keyb(sf::Keyboard::Key key, bool release, int x, int y) {
if (release) return;
KeyGUI(key, 0, release);
KeyGUI(key, release);
switch (key) {
case sf::Keyboard::Escape:
State::manager.RequestEnterState(GameTypeSelect);

View File

@ -24,7 +24,7 @@ GNU General Public License for more details.
class CRaceSelect : public State {
void Enter();
void Loop(float time_step);
void Keyb(sf::Keyboard::Key key, bool special, bool release, int x, int y);
void Keyb(sf::Keyboard::Key key, bool release, int x, int y);
void Mouse(int button, int state, int x, int y);
void Motion(int x, int y);
public:

View File

@ -66,7 +66,7 @@ static bool trees = true;
static int newsound = -1;
static int lastsound = -1;
void CRacing::Keyb(sf::Keyboard::Key key, bool special, bool release, int x, int y) {
void CRacing::Keyb(sf::Keyboard::Key key, bool release, int x, int y) {
switch (key) {
// steering flipflops
case sf::Keyboard::Up:

View File

@ -24,7 +24,7 @@ GNU General Public License for more details.
class CRacing : public State {
void Enter();
void Loop(float time_step);
void Keyb(sf::Keyboard::Key key, bool special, bool release, int x, int y);
void Keyb(sf::Keyboard::Key key, bool release, int x, int y);
void Jaxis(int axis, float value);
void Jbutt(int button, int state);
void Exit();

View File

@ -48,8 +48,8 @@ void QuitRegistration() {
State::manager.RequestEnterState(GameTypeSelect);
}
void CRegist::Keyb(sf::Keyboard::Key key, bool special, bool release, int x, int y) {
TWidget* focussed = KeyGUI(key, 0, release);
void CRegist::Keyb(sf::Keyboard::Key key, bool release, int x, int y) {
TWidget* focussed = KeyGUI(key, release);
if (release) return;
switch (key) {
case sf::Keyboard::Escape:

View File

@ -24,7 +24,7 @@ GNU General Public License for more details.
class CRegist : public State {
void Enter();
void Loop(float time_step);
void Keyb(sf::Keyboard::Key key, bool special, bool release, int x, int y);
void Keyb(sf::Keyboard::Key key, bool release, int x, int y);
void Mouse(int button, int state, int x, int y);
void Motion(int x, int y);
public:

View File

@ -173,8 +173,8 @@ static TWidget* textbutton;
static TFramedText* courseName;
static TLabel* headline;
void CScore::Keyb(sf::Keyboard::Key key, bool special, bool release, int x, int y) {
KeyGUI(key, 0, release);
void CScore::Keyb(sf::Keyboard::Key key, bool release, int x, int y) {
KeyGUI(key, release);
if (release) return;
switch (key) {
case sf::Keyboard::Escape:

View File

@ -42,7 +42,7 @@ private:
void Enter();
void Loop(float time_step);
void Keyb(sf::Keyboard::Key key, bool special, bool release, int x, int y);
void Keyb(sf::Keyboard::Key key, bool release, int x, int y);
void Mouse(int button, int state, int x, int y);
void Motion(int x, int y);
public:

View File

@ -61,12 +61,12 @@ void State::Manager::PollEvent() {
switch (event.type) {
case sf::Event::KeyPressed:
key = event.key.code;
current->Keyb(key, key >= 256, false, sf::Mouse::getPosition().x, sf::Mouse::getPosition().y);
current->Keyb(key, false, sf::Mouse::getPosition().x, sf::Mouse::getPosition().y);
break;
case sf::Event::KeyReleased:
key = event.key.code;
current->Keyb(key, key >= 256, true, sf::Mouse::getPosition().x, sf::Mouse::getPosition().y);
current->Keyb(key, true, sf::Mouse::getPosition().x, sf::Mouse::getPosition().y);
break;
case sf::Event::TextEntered:

View File

@ -57,7 +57,7 @@ public:
virtual void Enter() {}
virtual void Loop(float time_step) {}
virtual void Keyb(sf::Keyboard::Key key, bool special, bool release, int x, int y) {}
virtual void Keyb(sf::Keyboard::Key key, bool release, int x, int y) {}
virtual void Mouse(int button, int state, int x, int y) {}
virtual void Motion(int x, int y) {}
virtual void Jaxis(int axis, float value) {}

View File

@ -120,7 +120,7 @@ void SetRotation(double x, double y, double z) {
zrotation = z;
}
void CharKeys(sf::Keyboard::Key key, bool special, bool release, int x, int y) {
void CharKeys(sf::Keyboard::Key key, bool release, int x, int y) {
must_render = true;
if (ToolsFinalStage()) {

View File

@ -23,7 +23,7 @@ GNU General Public License for more details.
struct TCharAction;
void InitCharTools();
void CharKeys(sf::Keyboard::Key key, bool special, bool release, int x, int y);
void CharKeys(sf::Keyboard::Key key, bool release, int x, int y);
void CharMouse(int button, int state, int x, int y);
void CharMotion(int x, int y);
void RenderChar(float timestep);

View File

@ -49,7 +49,7 @@ void InitFrameTools() {
last_joint = TestFrame.GetNumJoints() -1;
}
void SingleFrameKeys(sf::Keyboard::Key key, bool special, bool release, int x, int y) {
void SingleFrameKeys(sf::Keyboard::Key key, bool release, int x, int y) {
//PrintInt (key);
must_render = true;
int keyfact;
@ -286,7 +286,7 @@ void RenderSingleFrame(float timestep) {
// frame sequence
// --------------------------------------------------------------------
void SequenceKeys(sf::Keyboard::Key key, bool special, bool release, int x, int y) {
void SequenceKeys(sf::Keyboard::Key key, bool release, int x, int y) {
if (release) return;
switch (key) {
case sf::Keyboard::Return:

View File

@ -21,7 +21,7 @@ GNU General Public License for more details.
#include "bh.h"
void InitFrameTools();
void SingleFrameKeys(sf::Keyboard::Key key, bool special, bool release, int x, int y);
void SingleFrameKeys(sf::Keyboard::Key key, bool release, int x, int y);
void SingleFrameMouse(int button, int state, int x, int y);
void SingleFrameMotion(int x, int y);
void RenderSingleFrame(float timestep);
@ -30,7 +30,7 @@ void RenderSingleFrame(float timestep);
// frame sequence
// --------------------------------------------------------------------
void SequenceKeys(sf::Keyboard::Key key, bool special, bool release, int x, int y);
void SequenceKeys(sf::Keyboard::Key key, bool release, int x, int y);
void SequenceMouse(int button, int state, int x, int y);
void SequenceMotion(int x, int y);
void RenderSequence(float timestep);

View File

@ -239,16 +239,16 @@ void CTools::Enter() {
Winsys.KeyRepeat(true);
}
void CTools::Keyb(sf::Keyboard::Key key, bool special, bool release, int x, int y) {
void CTools::Keyb(sf::Keyboard::Key key, bool release, int x, int y) {
switch (tool_mode) {
case 0:
CharKeys(key, special, release, x, y);
CharKeys(key, release, x, y);
break;
case 1:
SingleFrameKeys(key, special, release, x, y);
SingleFrameKeys(key, release, x, y);
break;
case 2:
SequenceKeys(key, special, release, x, y);
SequenceKeys(key, release, x, y);
break;
}
}

View File

@ -88,7 +88,7 @@ void DrawChanged();
class CTools : public State {
void Loop(float time_step);
void Keyb(sf::Keyboard::Key key, bool special, bool release, int x, int y);
void Keyb(sf::Keyboard::Key key, bool release, int x, int y);
void Mouse(int button, int state, int x, int y);
void Motion(int x, int y);
public: