started reconstructing input...

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3292 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2009-03-23 16:06:48 +00:00
parent d0777369ea
commit b160406dd4
12 changed files with 28 additions and 146 deletions

View File

@ -1,70 +0,0 @@
// $Id: actionmap.cpp 1259 2007-09-24 12:28:19Z thebohemian $
//
// SuperTuxKart - a fun racing game with go-kart
// Copyright (C) 2007 Robert Schuster
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 3
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <map>
#include "input.hpp"
#include "actionmap.hpp"
// ----------------------------------------------------------------------------
void ActionMap::addStaticEntry(Input input, StaticAction ga)
{
inputMap[key(input)] = ga;
} // putEntry
// ----------------------------------------------------------------------------
StaticAction ActionMap::getStaticEntry(Input input)
{
return inputMap[key(input)];
} // getEntry
// ----------------------------------------------------------------------------
StaticAction ActionMap::getStaticEntry(Input::InputType type, int id0, int id1, int id2)
{
return inputMap[key(type, id0, id1, id2)];
} // getEntry
// ----------------------------------------------------------------------------
void ActionMap::clear()
{
inputMap.clear();
}
// ----------------------------------------------------------------------------
ActionMap::Key ActionMap::key(Input input)
{
return key(input.type, input.id0, input.id1, input.id2);
} // key
// ----------------------------------------------------------------------------
ActionMap::Key ActionMap::key(Input::InputType it, int id0, int id1, int id2)
{
/*
* A short reminder on the bit distribution and their usage:
* it gets 8 bits (InputType)
* id1 gets 16 bits (button, hat or axis number)
* id2 gets 8 bits (direction bit)
* id0 gets 32 bits (That is because id0 can be the keyboard key ids and
* those are unicode and unicode 4.0 is 32 bit)
*
* Assumption: int is (at least) 32 bit
*/
return Key(it << 24 | id1 << 8 | id2, id0);
} // key

View File

@ -1,51 +0,0 @@
// $Id: actionmap.hpp 1259 2007-09-24 12:28:19Z thebohemian $
//
// SuperTuxKart - a fun racing game with go-kart
// Copyright (C) 2007 Robert Schuster
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 3
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef HEADER_ACTIONMAP_H
#define HEADER_ACTIONMAP_H
#include <map>
#include "input.hpp"
/**
* This thing is named after what is put in as values.
*/
class ActionMap
{
typedef std::pair<int, int> Key;
public:
void clear();
void addStaticEntry(Input, StaticAction);
void addPlayerEntry(Input, PlayerAction);
StaticAction getStaticEntry(Input);
StaticAction getStaticEntry(Input::InputType, int, int, int);
private:
inline Key key(Input);
Key key(Input::InputType, int, int, int);
std::map<Key, StaticAction> inputMap;
};
#endif

View File

@ -3,7 +3,7 @@
#include "gui/engine.hpp"
#include "gui/widget.hpp"
#include "gui/screen.hpp"
#include "input_manager.hpp"
#include "input/input_manager.hpp"
#include "graphics/irr_driver.hpp"
#include "race_manager.hpp"
#include "network/network_manager.hpp"

View File

@ -22,11 +22,10 @@
953EAAB20F30A4410000D57D /* triangle_mesh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 953EAAB10F30A4410000D57D /* triangle_mesh.cpp */; };
953EAAB60F30A4650000D57D /* translation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 953EAAB50F30A4650000D57D /* translation.cpp */; };
953F038C0F6C880D00C77FE2 /* state_manager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 953F038B0F6C880D00C77FE2 /* state_manager.cpp */; };
95A116BF0F77D3BB00B18B3D /* input_manager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95A116BD0F77D3BB00B18B3D /* input_manager.cpp */; };
95A117350F77D7BE00B18B3D /* sdl_manager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95A117330F77D7BE00B18B3D /* sdl_manager.cpp */; };
95A1182C0F77EA3100B18B3D /* input_manager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95A1182A0F77EA3100B18B3D /* input_manager.cpp */; };
95C1E3F20F699079005D33E6 /* race_gui.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C1E3F10F699079005D33E6 /* race_gui.cpp */; };
95C1E4000F699427005D33E6 /* font.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C1E3FF0F699427005D33E6 /* font.cpp */; };
95C2B1F70F296546000D3E5D /* actionmap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AC210F296540000D3E5D /* actionmap.cpp */; };
95C2B1FB0F296546000D3E5D /* music_information.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AC280F296540000D3E5D /* music_information.cpp */; };
95C2B1FC0F296546000D3E5D /* music_ogg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AC2A0F296540000D3E5D /* music_ogg.cpp */; };
95C2B1FD0F296546000D3E5D /* sfx_manager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AC2D0F296540000D3E5D /* sfx_manager.cpp */; };
@ -271,16 +270,15 @@
953EAAB50F30A4650000D57D /* translation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = translation.cpp; path = ../../utils/translation.cpp; sourceTree = SOURCE_ROOT; };
953F038B0F6C880D00C77FE2 /* state_manager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = state_manager.cpp; path = ../../gui/state_manager.cpp; sourceTree = SOURCE_ROOT; };
953F038E0F6C8AD800C77FE2 /* state_manager.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = state_manager.hpp; path = ../../gui/state_manager.hpp; sourceTree = SOURCE_ROOT; };
95A116BD0F77D3BB00B18B3D /* input_manager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = input_manager.cpp; path = games/supertuxkart/src/input_manager.cpp; sourceTree = SYSTEM_DEVELOPER_DIR; };
95A116BE0F77D3BB00B18B3D /* input_manager.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = input_manager.hpp; path = games/supertuxkart/src/input_manager.hpp; sourceTree = SYSTEM_DEVELOPER_DIR; };
95A117330F77D7BE00B18B3D /* sdl_manager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = sdl_manager.cpp; path = games/supertuxkart/src/sdl_manager.cpp; sourceTree = SYSTEM_DEVELOPER_DIR; };
95A117340F77D7BE00B18B3D /* sdl_manager.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = sdl_manager.hpp; path = games/supertuxkart/src/sdl_manager.hpp; sourceTree = SYSTEM_DEVELOPER_DIR; };
95A117330F77D7BE00B18B3D /* sdl_manager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = sdl_manager.cpp; path = ../../sdl_manager.cpp; sourceTree = SOURCE_ROOT; };
95A117340F77D7BE00B18B3D /* sdl_manager.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = sdl_manager.hpp; path = ../../sdl_manager.hpp; sourceTree = SOURCE_ROOT; };
95A118290F77EA3100B18B3D /* input.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = input.hpp; path = ../../input/input.hpp; sourceTree = SOURCE_ROOT; };
95A1182A0F77EA3100B18B3D /* input_manager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = input_manager.cpp; path = ../../input/input_manager.cpp; sourceTree = SOURCE_ROOT; };
95A1182B0F77EA3100B18B3D /* input_manager.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = input_manager.hpp; path = ../../input/input_manager.hpp; sourceTree = SOURCE_ROOT; };
95C1E3EB0F698F23005D33E6 /* race_gui.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = race_gui.hpp; path = ../../gui/race_gui.hpp; sourceTree = SOURCE_ROOT; };
95C1E3F10F699079005D33E6 /* race_gui.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = race_gui.cpp; path = ../../gui/race_gui.cpp; sourceTree = SOURCE_ROOT; };
95C1E3FF0F699427005D33E6 /* font.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = font.cpp; path = ../../gui/font.cpp; sourceTree = SOURCE_ROOT; };
95C1E4020F69943D005D33E6 /* font.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = font.hpp; path = ../../gui/font.hpp; sourceTree = SOURCE_ROOT; };
95C2AC210F296540000D3E5D /* actionmap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = actionmap.cpp; path = ../../actionmap.cpp; sourceTree = SOURCE_ROOT; };
95C2AC220F296540000D3E5D /* actionmap.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = actionmap.hpp; path = ../../actionmap.hpp; sourceTree = SOURCE_ROOT; };
95C2AC270F296540000D3E5D /* music.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = music.hpp; path = ../../audio/music.hpp; sourceTree = SOURCE_ROOT; };
95C2AC280F296540000D3E5D /* music_information.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = music_information.cpp; path = ../../audio/music_information.cpp; sourceTree = SOURCE_ROOT; };
95C2AC290F296540000D3E5D /* music_information.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = music_information.hpp; path = ../../audio/music_information.hpp; sourceTree = SOURCE_ROOT; };
@ -575,7 +573,6 @@
95C2AEDA0F296542000D3E5D /* highscores.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = highscores.hpp; path = ../../highscores.hpp; sourceTree = SOURCE_ROOT; };
95C2AEDC0F296542000D3E5D /* history.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = history.cpp; path = ../../history.cpp; sourceTree = SOURCE_ROOT; };
95C2AEDD0F296542000D3E5D /* history.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = history.hpp; path = ../../history.hpp; sourceTree = SOURCE_ROOT; };
95C2B0EF0F296545000D3E5D /* input.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = input.hpp; path = ../../input.hpp; sourceTree = SOURCE_ROOT; };
95C2B0F00F296545000D3E5D /* isect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = isect.cpp; path = ../../isect.cpp; sourceTree = SOURCE_ROOT; };
95C2B0F10F296545000D3E5D /* isect.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = isect.hpp; path = ../../isect.hpp; sourceTree = SOURCE_ROOT; };
95C2B0F60F296545000D3E5D /* attachment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = attachment.cpp; path = ../../items/attachment.cpp; sourceTree = SOURCE_ROOT; };
@ -1218,6 +1215,17 @@
name = Frameworks;
sourceTree = "<group>";
};
95A118280F77EA3100B18B3D /* input */ = {
isa = PBXGroup;
children = (
95A118290F77EA3100B18B3D /* input.hpp */,
95A1182A0F77EA3100B18B3D /* input_manager.cpp */,
95A1182B0F77EA3100B18B3D /* input_manager.hpp */,
);
name = input;
path = games/supertuxkart/src/input;
sourceTree = SYSTEM_DEVELOPER_DIR;
};
95C2ABA60F29653F000D3E5D /* src */ = {
isa = PBXGroup;
children = (
@ -1229,6 +1237,7 @@
95C2AE870F296542000D3E5D /* graphics */,
95C65D750F532F7D00BE7BA7 /* io */,
95C2B0F50F296545000D3E5D /* items */,
95A118280F77EA3100B18B3D /* input */,
95C2B1160F296545000D3E5D /* karts */,
95C2B1290F296545000D3E5D /* lisp */,
95C2B1470F296545000D3E5D /* modes */,
@ -1238,8 +1247,6 @@
95C2B1AA0F296545000D3E5D /* robots */,
95C2B1CE0F296545000D3E5D /* tracks */,
95C2B1DF0F296546000D3E5D /* utils */,
95C2AC210F296540000D3E5D /* actionmap.cpp */,
95C2AC220F296540000D3E5D /* actionmap.hpp */,
95C2AE1C0F296541000D3E5D /* callback.hpp */,
95C2AE1D0F296541000D3E5D /* callback_manager.cpp */,
95C2AE1E0F296541000D3E5D /* callback_manager.hpp */,
@ -1255,9 +1262,6 @@
95C2AEDA0F296542000D3E5D /* highscores.hpp */,
95C2AEDC0F296542000D3E5D /* history.cpp */,
95C2AEDD0F296542000D3E5D /* history.hpp */,
95A116BD0F77D3BB00B18B3D /* input_manager.cpp */,
95A116BE0F77D3BB00B18B3D /* input_manager.hpp */,
95C2B0EF0F296545000D3E5D /* input.hpp */,
95C2B0F00F296545000D3E5D /* isect.cpp */,
95C2B0F10F296545000D3E5D /* isect.hpp */,
95C2B1330F296545000D3E5D /* loader.cpp */,
@ -2547,7 +2551,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
95C2B1F70F296546000D3E5D /* actionmap.cpp in Sources */,
95C2B1FB0F296546000D3E5D /* music_information.cpp in Sources */,
95C2B1FC0F296546000D3E5D /* music_ogg.cpp in Sources */,
95C2B1FD0F296546000D3E5D /* sfx_manager.cpp in Sources */,
@ -2760,8 +2763,8 @@
95C1E3F20F699079005D33E6 /* race_gui.cpp in Sources */,
95C1E4000F699427005D33E6 /* font.cpp in Sources */,
953F038C0F6C880D00C77FE2 /* state_manager.cpp in Sources */,
95A116BF0F77D3BB00B18B3D /* input_manager.cpp in Sources */,
95A117350F77D7BE00B18B3D /* sdl_manager.cpp in Sources */,
95A1182C0F77EA3100B18B3D /* input_manager.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -17,7 +17,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "input_manager.hpp"
#include "input/input_manager.hpp"
#include <map>
#include <vector>
@ -28,7 +28,7 @@
#include <SDL/SDL.h>
#include "input.hpp"
#include "input/input.hpp"
#include "actionmap.hpp"
#include "user_config.hpp"

View File

@ -26,7 +26,7 @@
#include <SDL/SDL.h>
#include "input.hpp"
#include "input/input.hpp"
class ActionMap;

View File

@ -22,7 +22,7 @@
#include "history.hpp"
#include "player.hpp"
#include "input_manager.hpp"
#include "input/input_manager.hpp"
#include "audio/sfx_manager.hpp"
#include "audio/sfx_base.hpp"
#include "graphics/camera.hpp"

View File

@ -49,7 +49,7 @@
#include "race_manager.hpp"
#include "main_loop.hpp"
#include "material_manager.hpp"
#include "input_manager.hpp"
#include "input/input_manager.hpp"
#include "callback_manager.hpp"
#include "history.hpp"
#include "stk_config.hpp"

View File

@ -22,7 +22,7 @@
#include <SDL/SDL.h>
#include <assert.h>
#include "history.hpp"
#include "input_manager.hpp"
#include "input/input_manager.hpp"
#include "material_manager.hpp"
#include "race_manager.hpp"
#include "audio/sound_manager.hpp"

View File

@ -2,7 +2,7 @@
#include "sdl_manager.hpp"
#include <SDL/SDL.h>
#include "user_config.hpp"
#include "input_manager.hpp"
#include "input/input_manager.hpp"
#include "gui/state_manager.hpp"
#include "history.hpp"
#include "items/item_manager.hpp"

View File

@ -45,7 +45,7 @@
#include <string>
#include <map>
#include <vector>
#include "input.hpp"
#include "input/input.hpp"
#include "player.hpp"
#include "lisp/lisp.hpp"
#include "lisp/parser.hpp"