started removing SDL from STK. Gamepad input broken, maybe keyboard a bit too. Default bindings changed because some keys on mac are ignored by irrlicht (known bug, fixed in enxt version IIRC)

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3421 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2009-04-25 17:55:39 +00:00
parent f21c7e9aa9
commit 87a274fc77
16 changed files with 267 additions and 230 deletions

View File

@ -23,6 +23,9 @@
#include <stdexcept> #include <stdexcept>
#include <algorithm> #include <algorithm>
#include <SDL/SDL.h>
#include <SDL/SDL_endian.h>
#ifdef __APPLE__ #ifdef __APPLE__
# include <OpenAL/al.h> # include <OpenAL/al.h>
# include <OpenAL/alc.h> # include <OpenAL/alc.h>

View File

@ -26,8 +26,6 @@
#else #else
# include <AL/al.h> # include <AL/al.h>
#endif #endif
#include <SDL/SDL.h>
#include <SDL/SDL_endian.h>
#include "lisp/lisp.hpp" #include "lisp/lisp.hpp"
#include "utils/vec3.hpp" #include "utils/vec3.hpp"

View File

@ -404,8 +404,8 @@ void IrrDriver::update(float dt)
// instead of calling run(), we only update the irrlicht timer (which is // instead of calling run(), we only update the irrlicht timer (which is
// necessary to get animations to work) - that's the only other operation // necessary to get animations to work) - that's the only other operation
// happening in run. // happening in run.
//if(!m_device->run()) return; if(!m_device->run()) return;
m_device->getTimer()->tick(); //m_device->getTimer()->tick();
m_device->getVideoDriver()->beginScene(true, true, video::SColor(255,100,101,140)); m_device->getVideoDriver()->beginScene(true, true, video::SColor(255,100,101,140));
m_scene_manager->drawAll(); m_scene_manager->drawAll();

View File

@ -7,6 +7,7 @@
#include "gui/widget.hpp" #include "gui/widget.hpp"
#include "io/file_manager.hpp" #include "io/file_manager.hpp"
#include "gui/state_manager.hpp" #include "gui/state_manager.hpp"
#include "input/input_manager.hpp"
namespace GUIEngine namespace GUIEngine
{ {
@ -27,6 +28,29 @@ namespace GUIEngine
{ {
return dt; return dt;
} }
class IrrlichtEventCore : public IEventReceiver
{
public:
IrrlichtEventCore()
{
}
~IrrlichtEventCore()
{
}
bool OnEvent (const SEvent &event)
{
if(event.EventType == EET_GUI_EVENT || !StateManager::isGameState())
{
if(g_current_screen == NULL) return false;
g_current_screen->OnEvent(event);
}
else
input_manager->input(event);
return false;
}
};
IrrlichtEventCore* g_irrlicht_event_core = NULL;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
IrrlichtDevice* getDevice() IrrlichtDevice* getDevice()
{ {
@ -55,7 +79,7 @@ void clear()
} }
void switchToScreen(const char* screen_name) void switchToScreen(const char* screen_name)
{ {
// clean what was left by the previous screen // clean what was left by the previous screen
g_env->clear(); g_env->clear();
if(g_current_screen != NULL) g_current_screen->elementsWereDeleted(); if(g_current_screen != NULL) g_current_screen->elementsWereDeleted();
@ -80,8 +104,16 @@ void switchToScreen(const char* screen_name)
g_current_screen = new_screen; g_current_screen = new_screen;
} }
// show screen // show screen
g_current_screen->addWidgets(); g_current_screen->addWidgets();
// set event listener
if(g_irrlicht_event_core == NULL) g_irrlicht_event_core = new IrrlichtEventCore();
g_device->setEventReceiver(g_irrlicht_event_core);
//g_env->setUserEventReceiver(g_irrlicht_event_core);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
/** to be called after e.g. a resolution switch */ /** to be called after e.g. a resolution switch */

View File

@ -7,6 +7,7 @@
#include "gui/screen.hpp" #include "gui/screen.hpp"
#include "gui/engine.hpp" #include "gui/engine.hpp"
#include "gui/widget.hpp" #include "gui/widget.hpp"
#include "gui/state_manager.hpp"
#include "io/file_manager.hpp" #include "io/file_manager.hpp"
using namespace irr; using namespace irr;
@ -190,9 +191,6 @@ void Screen::addWidgets()
if(!m_loaded) loadFromFile(); if(!m_loaded) loadFromFile();
addWidgetsRecursively( m_widgets ); addWidgetsRecursively( m_widgets );
// And tell the device to use our custom event receiver.
GUIEngine::getDevice()->setEventReceiver(this);
// select the first widget // select the first widget
Widget* w = getFirstWidget(); Widget* w = getFirstWidget();
@ -356,13 +354,16 @@ bool Screen::OnEvent(const SEvent& event)
assert(transmitEvent != NULL); assert(transmitEvent != NULL);
//if (event.EventType != EET_GUI_EVENT) return false; //if (event.EventType != EET_GUI_EVENT) return false;
if(event.EventType == EET_KEY_INPUT_EVENT && event.KeyInput.PressedDown) if(event.EventType == EET_KEY_INPUT_EVENT && event.KeyInput.PressedDown)
{ {
const int key = event.KeyInput.Key; const int key = event.KeyInput.Key;
switch(key) switch(key)
{ {
case KEY_ESCAPE :
StateManager::escapePressed();
break;
case KEY_SPACE : case KEY_SPACE :
break; break;
case KEY_LEFT: case KEY_LEFT:
@ -408,12 +409,12 @@ bool Screen::OnEvent(const SEvent& event)
IGUIElement *el, *first=NULL, *closest=NULL; IGUIElement *el, *first=NULL, *closest=NULL;
el = GUIEngine::getGUIEnv()->getFocus(); el = GUIEngine::getGUIEnv()->getFocus();
Widget* w = getWidget( el->getID() ); Widget* w = (el == NULL) ? NULL : getWidget( el->getID() );
// list widgets are a bit special, because up/down keys are also used // list widgets are a bit special, because up/down keys are also used
// to navigate between various list items, not only to navigate between // to navigate between various list items, not only to navigate between
// components // components
if(w->m_type == WTYPE_LIST) if(w != NULL && w->m_type == WTYPE_LIST)
{ {
IGUIListBox* list = dynamic_cast<IGUIListBox*>(w->m_element); IGUIListBox* list = dynamic_cast<IGUIListBox*>(w->m_element);
assert(list != NULL); assert(list != NULL);
@ -429,6 +430,7 @@ bool Screen::OnEvent(const SEvent& event)
{ {
// select the first widget // select the first widget
Widget* w = getLastWidget(); Widget* w = getLastWidget();
if(w != NULL) GUIEngine::getGUIEnv()->setFocus( w->m_element ); if(w != NULL) GUIEngine::getGUIEnv()->setFocus( w->m_element );
} }
return true; return true;
@ -438,13 +440,13 @@ bool Screen::OnEvent(const SEvent& event)
{ {
IGUIElement *el, *first = NULL, *closest = NULL; IGUIElement *el, *first = NULL, *closest = NULL;
el = GUIEngine::getGUIEnv()->getFocus(); el = GUIEngine::getGUIEnv()->getFocus();
Widget* w = getWidget( el->getID() ); Widget* w = (el == NULL) ? NULL : getWidget( el->getID() );
// list widgets are a bit special, because up/down keys are also used // list widgets are a bit special, because up/down keys are also used
// to navigate between various list items, not only to navigate between // to navigate between various list items, not only to navigate between
// components // components
if(w->m_type == WTYPE_LIST) if(w != NULL && w->m_type == WTYPE_LIST)
{ {
IGUIListBox* list = dynamic_cast<IGUIListBox*>(w->m_element); IGUIListBox* list = dynamic_cast<IGUIListBox*>(w->m_element);
assert(list != NULL); assert(list != NULL);
@ -459,7 +461,7 @@ bool Screen::OnEvent(const SEvent& event)
else else
{ {
// select the first widget // select the first widget
Widget* w = getFirstWidget(); Widget* w = getFirstWidget();
if(w != NULL) GUIEngine::getGUIEnv()->setFocus( w->m_element ); if(w != NULL) GUIEngine::getGUIEnv()->setFocus( w->m_element );
} }
return true; return true;
@ -494,7 +496,7 @@ bool Screen::OnEvent(const SEvent& event)
} }
else if(event.EventType == EET_GUI_EVENT) else if(event.EventType == EET_GUI_EVENT)
{ {
s32 id = event.GUIEvent.Caller->getID(); const s32 id = event.GUIEvent.Caller->getID();
switch(event.GUIEvent.EventType) switch(event.GUIEvent.EventType)
{ {
@ -558,7 +560,7 @@ bool Screen::OnEvent(const SEvent& event)
{ {
Widget* el = getWidget(id); Widget* el = getWidget(id);
if(el == NULL) break; if(el == NULL) break;
el->focused(); el->focused();
break; break;

View File

@ -223,6 +223,8 @@
95C65DAA0F532FD400BE7BA7 /* shadow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C65DA00F532FD400BE7BA7 /* shadow.cpp */; }; 95C65DAA0F532FD400BE7BA7 /* shadow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C65DA00F532FD400BE7BA7 /* shadow.cpp */; };
95C65DAB0F532FD400BE7BA7 /* nitro.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C65DA10F532FD400BE7BA7 /* nitro.cpp */; }; 95C65DAB0F532FD400BE7BA7 /* nitro.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C65DA10F532FD400BE7BA7 /* nitro.cpp */; };
95CA59F80F82FCB7003323DB /* physical_object.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95CA59F70F82FCB7003323DB /* physical_object.cpp */; }; 95CA59F80F82FCB7003323DB /* physical_object.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95CA59F70F82FCB7003323DB /* physical_object.cpp */; };
95D464890FA37B1B00F50CA2 /* libIrrlicht.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 95D464880FA37B1B00F50CA2 /* libIrrlicht.a */; };
95D464D30FA3801E00F50CA2 /* libSDL-1.2.0.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 95D464D20FA3801E00F50CA2 /* libSDL-1.2.0.dylib */; };
95F423130E26E3DC00692113 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 95F423120E26E3DC00692113 /* OpenGL.framework */; }; 95F423130E26E3DC00692113 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 95F423120E26E3DC00692113 /* OpenGL.framework */; };
95F4231F0E26E44800692113 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 95F4231E0E26E44800692113 /* Cocoa.framework */; }; 95F4231F0E26E44800692113 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 95F4231E0E26E44800692113 /* Cocoa.framework */; };
95F423410E26E65B00692113 /* GLUT.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 95F423400E26E65B00692113 /* GLUT.framework */; }; 95F423410E26E65B00692113 /* GLUT.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 95F423400E26E65B00692113 /* GLUT.framework */; };
@ -736,6 +738,8 @@
95C65DA10F532FD400BE7BA7 /* nitro.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = nitro.cpp; path = ../../graphics/nitro.cpp; sourceTree = SOURCE_ROOT; }; 95C65DA10F532FD400BE7BA7 /* nitro.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = nitro.cpp; path = ../../graphics/nitro.cpp; sourceTree = SOURCE_ROOT; };
95CA59F60F82FCB7003323DB /* physical_object.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = physical_object.hpp; path = ../../physics/physical_object.hpp; sourceTree = SOURCE_ROOT; }; 95CA59F60F82FCB7003323DB /* physical_object.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = physical_object.hpp; path = ../../physics/physical_object.hpp; sourceTree = SOURCE_ROOT; };
95CA59F70F82FCB7003323DB /* physical_object.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = physical_object.cpp; path = ../../physics/physical_object.cpp; sourceTree = SOURCE_ROOT; }; 95CA59F70F82FCB7003323DB /* physical_object.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = physical_object.cpp; path = ../../physics/physical_object.cpp; sourceTree = SOURCE_ROOT; };
95D464880FA37B1B00F50CA2 /* libIrrlicht.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libIrrlicht.a; path = /usr/local/lib/libIrrlicht.a; sourceTree = "<absolute>"; };
95D464D20FA3801E00F50CA2 /* libSDL-1.2.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libSDL-1.2.0.dylib"; path = "/usr/local/lib/libSDL-1.2.0.dylib"; sourceTree = "<absolute>"; };
95D538840F69D61C00B4062E /* aabbox3d.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = aabbox3d.h; path = /usr/local/include/irrlicht/aabbox3d.h; sourceTree = "<absolute>"; }; 95D538840F69D61C00B4062E /* aabbox3d.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = aabbox3d.h; path = /usr/local/include/irrlicht/aabbox3d.h; sourceTree = "<absolute>"; };
95D538850F69D61C00B4062E /* CDynamicMeshBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDynamicMeshBuffer.h; path = /usr/local/include/irrlicht/CDynamicMeshBuffer.h; sourceTree = "<absolute>"; }; 95D538850F69D61C00B4062E /* CDynamicMeshBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDynamicMeshBuffer.h; path = /usr/local/include/irrlicht/CDynamicMeshBuffer.h; sourceTree = "<absolute>"; };
95D538860F69D61C00B4062E /* CIndexBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CIndexBuffer.h; path = /usr/local/include/irrlicht/CIndexBuffer.h; sourceTree = "<absolute>"; }; 95D538860F69D61C00B4062E /* CIndexBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CIndexBuffer.h; path = /usr/local/include/irrlicht/CIndexBuffer.h; sourceTree = "<absolute>"; };
@ -1142,6 +1146,8 @@
950557580F6968860056E88C /* Carbon.framework in Frameworks */, 950557580F6968860056E88C /* Carbon.framework in Frameworks */,
950557600F6968A50056E88C /* QuickTime.framework in Frameworks */, 950557600F6968A50056E88C /* QuickTime.framework in Frameworks */,
950557650F6968BE0056E88C /* IOKit.framework in Frameworks */, 950557650F6968BE0056E88C /* IOKit.framework in Frameworks */,
95D464890FA37B1B00F50CA2 /* libIrrlicht.a in Frameworks */,
95D464D30FA3801E00F50CA2 /* libSDL-1.2.0.dylib in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -1151,6 +1157,8 @@
08FB7794FE84155DC02AAC07 /* STK_XCode */ = { 08FB7794FE84155DC02AAC07 /* STK_XCode */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
95D464880FA37B1B00F50CA2 /* libIrrlicht.a */,
95D464D20FA3801E00F50CA2 /* libSDL-1.2.0.dylib */,
95D538830F69D61C00B4062E /* irrlicht */, 95D538830F69D61C00B4062E /* irrlicht */,
95C2ABA60F29653F000D3E5D /* src */, 95C2ABA60F29653F000D3E5D /* src */,
9513B40E0F0EDE80005D29F6 /* Frameworks */, 9513B40E0F0EDE80005D29F6 /* Frameworks */,
@ -2795,10 +2803,6 @@
"$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_3)", "$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_3)",
"$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_4)", "$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_4)",
); );
LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(DEVELOPER_DIR)/games/supertuxkart/src/bullet/Demos/OpenGL\"";
LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_2 = "\"$(DEVELOPER_DIR)/games/supertuxkart/src/bullet/src\"";
LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_3 = "\"$(DEVELOPER_DIR)/games/supertuxkart/src/enet\"";
LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_4 = "\"$(DEVELOPER_DIR)/games/supertuxkart/src\"";
OTHER_CFLAGS = ( OTHER_CFLAGS = (
"-Wall", "-Wall",
"-DHAVE_OGGVORBIS=1", "-DHAVE_OGGVORBIS=1",
@ -2838,7 +2842,6 @@
"-lplibsg", "-lplibsg",
"-lplibul", "-lplibul",
"-lplibssgaux", "-lplibssgaux",
"-lirrlicht",
"-L/usr/local/lib", "-L/usr/local/lib",
"-lopenal", "-lopenal",
"-lvorbisfile", "-lvorbisfile",
@ -2849,7 +2852,6 @@
PRODUCT_NAME = SuperTuxKart; PRODUCT_NAME = SuperTuxKart;
SDKROOT = ""; SDKROOT = "";
WARNING_CFLAGS = ""; WARNING_CFLAGS = "";
ZERO_LINK = NO;
}; };
name = Debug; name = Debug;
}; };

View File

@ -142,6 +142,8 @@ bool DeviceManager::deserialize()
*/ */
bool DeviceManager::checkForGamePad(const int sdl_id) bool DeviceManager::checkForGamePad(const int sdl_id)
{ {
// FIXME - replace with non-SDL code
/*
std::string name = SDL_JoystickName(sdl_id); std::string name = SDL_JoystickName(sdl_id);
std::cout << "trying to find gamepad " << name.c_str() << std::endl; std::cout << "trying to find gamepad " << name.c_str() << std::endl;
@ -161,7 +163,7 @@ bool DeviceManager::checkForGamePad(const int sdl_id)
std::cout << "couldn't find this joystick, so creating a new one" << std::endl; std::cout << "couldn't find this joystick, so creating a new one" << std::endl;
add(new GamePadDevice(sdl_id)); add(new GamePadDevice(sdl_id));
return true; return true;
*/
} }
void DeviceManager::serialize() void DeviceManager::serialize()

View File

@ -109,6 +109,7 @@ KeyboardDevice::KeyboardDevice(irr::io::IrrXMLReader* xml)
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void KeyboardDevice::loadDefaults() void KeyboardDevice::loadDefaults()
{ {
/*
m_bindings[PA_NITRO].id = SDLK_SPACE; m_bindings[PA_NITRO].id = SDLK_SPACE;
m_bindings[PA_ACCEL].id = SDLK_UP; m_bindings[PA_ACCEL].id = SDLK_UP;
m_bindings[PA_BRAKE].id = SDLK_DOWN; m_bindings[PA_BRAKE].id = SDLK_DOWN;
@ -118,6 +119,17 @@ void KeyboardDevice::loadDefaults()
m_bindings[PA_RESCUE].id = SDLK_ESCAPE; m_bindings[PA_RESCUE].id = SDLK_ESCAPE;
m_bindings[PA_FIRE].id = SDLK_LALT; m_bindings[PA_FIRE].id = SDLK_LALT;
m_bindings[PA_LOOK_BACK].id = SDLK_b; m_bindings[PA_LOOK_BACK].id = SDLK_b;
*/
m_bindings[PA_NITRO].id = KEY_KEY_N;
m_bindings[PA_ACCEL].id = KEY_UP;
m_bindings[PA_BRAKE].id = KEY_DOWN;
m_bindings[PA_LEFT].id = KEY_LEFT;
m_bindings[PA_RIGHT].id = KEY_RIGHT;
m_bindings[PA_DRIFT].id = KEY_KEY_V;
m_bindings[PA_RESCUE].id = KEY_ESCAPE;
m_bindings[PA_FIRE].id = KEY_SPACE;
m_bindings[PA_LOOK_BACK].id = KEY_KEY_B ;
m_bindings[PA_NITRO].type = Input::IT_KEYBOARD; m_bindings[PA_NITRO].type = Input::IT_KEYBOARD;
m_bindings[PA_ACCEL].type = Input::IT_KEYBOARD; m_bindings[PA_ACCEL].type = Input::IT_KEYBOARD;
@ -159,7 +171,8 @@ bool KeyboardDevice::hasBinding(const int key_id, PlayerAction* action /* out */
GamePadDevice::GamePadDevice(irr::io::IrrXMLReader* xml) GamePadDevice::GamePadDevice(irr::io::IrrXMLReader* xml)
{ {
m_type = DT_GAMEPAD; m_type = DT_GAMEPAD;
m_sdlJoystick = NULL; // FIXME - replace with non-SDL code
// m_sdlJoystick = NULL;
m_prevAxisDirections = NULL; m_prevAxisDirections = NULL;
m_deadzone = DEADZONE_JOYSTICK; m_deadzone = DEADZONE_JOYSTICK;
@ -186,16 +199,17 @@ GamePadDevice::GamePadDevice(int sdlIndex)
open(sdlIndex); open(sdlIndex);
m_name = SDL_JoystickName(sdlIndex); // FIXME - replace with non-SDL code
// m_name = SDL_JoystickName(sdlIndex);
loadDefaults(); loadDefaults();
} // GamePadDevice } // GamePadDevice
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void GamePadDevice::open(const int sdl_id) void GamePadDevice::open(const int sdl_id)
{ {
m_sdlJoystick = SDL_JoystickOpen(sdl_id); // FIXME - replace with non-SDL code
// m_sdlJoystick = SDL_JoystickOpen(sdl_id);
const int count = SDL_JoystickNumAxes(m_sdlJoystick); const int count = 1; // SDL_JoystickNumAxes(m_sdlJoystick);
m_prevAxisDirections = new Input::AxisDirection[count]; m_prevAxisDirections = new Input::AxisDirection[count];
std::cout << "(i) This gamepad has " << count << " axes\n"; std::cout << "(i) This gamepad has " << count << " axes\n";
@ -355,5 +369,6 @@ GamePadDevice::~GamePadDevice()
{ {
delete[] m_prevAxisDirections; delete[] m_prevAxisDirections;
SDL_JoystickClose(m_sdlJoystick); // FIXME - replace with non-SDL code
// SDL_JoystickClose(m_sdlJoystick);
} // ~GamePadDevice } // ~GamePadDevice

View File

@ -1,7 +1,6 @@
#ifndef INPUT_DEVICE_HPP #ifndef INPUT_DEVICE_HPP
#define INPUT_DEVICE_HPP #define INPUT_DEVICE_HPP
#include <SDL/SDL.h>
#include <string> #include <string>
#include "input/input.hpp" #include "input/input.hpp"
#include <iostream> #include <iostream>
@ -59,7 +58,8 @@ class GamePadDevice : public InputDevice
{ {
void resetAxisDirection(const int axis, Input::AxisDirection direction, const int player); void resetAxisDirection(const int axis, Input::AxisDirection direction, const int player);
public: public:
SDL_Joystick *m_sdlJoystick; // FIXME - replace with non-SDL code
// SDL_Joystick *m_sdlJoystick;
int m_deadzone; int m_deadzone;
int m_index; int m_index;
Input::AxisDirection *m_prevAxisDirections; Input::AxisDirection *m_prevAxisDirections;

View File

@ -27,8 +27,6 @@
#include <sstream> #include <sstream>
#include <algorithm> #include <algorithm>
#include <SDL/SDL.h>
#include "input/input.hpp" #include "input/input.hpp"
//#include "actionmap.hpp" //#include "actionmap.hpp"
#include "user_config.hpp" #include "user_config.hpp"
@ -48,7 +46,7 @@
InputManager *input_manager; InputManager *input_manager;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
/** Initialise SDL. /** Initialise input
*/ */
InputManager::InputManager() InputManager::InputManager()
: m_sensed_input(0), : m_sensed_input(0),
@ -75,9 +73,9 @@ m_mode(BOOTSTRAP), m_mouse_val_x(0), m_mouse_val_y(0)
} }
// Prepare a list of connected joysticks. // Prepare a list of connected joysticks.
const int numSticks = SDL_NumJoysticks(); // FIXME - replace with non-SDL code
const int numSticks = 0; //SDL_NumJoysticks();
std::cout << "SDL detects " << numSticks << " gamepads" << std::endl; // std::cout << "SDL detects " << numSticks << " gamepads" << std::endl;
// TODO - detect if device is currently known and has an entry in the config // TODO - detect if device is currently known and has an entry in the config
// the constructor below should only be used if not // the constructor below should only be used if not
@ -195,13 +193,7 @@ InputManager::~InputManager()
{ {
delete m_device_manager; delete m_device_manager;
//const int NUM_STICKS = SDL_NumJoysticks();
//for (int i = 0; i < NUM_STICKS; i++)
// delete m_stick_infos[i];
//delete [] m_stick_infos;
// FIXME LEAK: delete m_action_map if defined // FIXME LEAK: delete m_action_map if defined
} // ~InputManager } // ~InputManager
@ -234,7 +226,7 @@ void InputManager::handleStaticAction(int key, int value)
switch (key) switch (key)
{ {
#ifdef DEBUG #ifdef DEBUG
case SDLK_F1: case KEY_F1:
if (race_manager->getNumPlayers() ==1 ) if (race_manager->getNumPlayers() ==1 )
{ {
Kart* kart = RaceManager::getWorld()->getLocalPlayerKart(0); Kart* kart = RaceManager::getWorld()->getLocalPlayerKart(0);
@ -242,14 +234,14 @@ void InputManager::handleStaticAction(int key, int value)
kart->attach(ATTACH_ANVIL, 5); kart->attach(ATTACH_ANVIL, 5);
} }
break; break;
case SDLK_F2: case KEY_F2:
if (race_manager->getNumPlayers() ==1 ) if (race_manager->getNumPlayers() ==1 )
{ {
Kart* kart = RaceManager::getPlayerKart(0); Kart* kart = RaceManager::getPlayerKart(0);
kart->setPowerup(POWERUP_PLUNGER, 10000); kart->setPowerup(POWERUP_PLUNGER, 10000);
} }
break; break;
case SDLK_F3: case KEY_F3:
if (race_manager->getNumPlayers() ==1 ) if (race_manager->getNumPlayers() ==1 )
{ {
Kart* kart = RaceManager::getPlayerKart(0); Kart* kart = RaceManager::getPlayerKart(0);
@ -257,14 +249,14 @@ void InputManager::handleStaticAction(int key, int value)
} }
break; break;
#endif #endif
case SDLK_F12: case KEY_F12:
user_config->m_display_fps = !user_config->m_display_fps; user_config->m_display_fps = !user_config->m_display_fps;
if(user_config->m_display_fps) if(user_config->m_display_fps)
{ {
getRaceGUI()->resetFPSCounter(); getRaceGUI()->resetFPSCounter();
} }
break; break;
case SDLK_F11: case KEY_F11:
glPolygonMode(GL_FRONT_AND_BACK, isWireframe ? GL_FILL : GL_LINE); glPolygonMode(GL_FRONT_AND_BACK, isWireframe ? GL_FILL : GL_LINE);
isWireframe = ! isWireframe; isWireframe = ! isWireframe;
break; break;
@ -272,16 +264,16 @@ void InputManager::handleStaticAction(int key, int value)
// For now disable F9 toggling fullscreen, since windows requires // For now disable F9 toggling fullscreen, since windows requires
// to reload all textures, display lists etc. Fullscreen can // to reload all textures, display lists etc. Fullscreen can
// be toggled from the main menu (options->display). // be toggled from the main menu (options->display).
case SDLK_F9: case KEY_F9:
SDLManager::toggleFullscreen(false); // 0: do not reset textures SDLManager::toggleFullscreen(false); // 0: do not reset textures
// Fall through to put the game into pause mode. // Fall through to put the game into pause mode.
#endif #endif
case SDLK_ESCAPE: case KEY_ESCAPE:
// TODO - show race menu // TODO - show race menu
// RaceManager::getWorld()->pause(); // RaceManager::getWorld()->pause();
//menu_manager->pushMenu(MENUID_RACEMENU); //menu_manager->pushMenu(MENUID_RACEMENU);
break; break;
case SDLK_F10: case KEY_F10:
history->Save(); history->Save();
break; break;
default: default:
@ -308,142 +300,67 @@ void InputManager::handleStaticAction(int key, int value)
void InputManager::input(Input::InputType type, int id0, int id1, int id2, void InputManager::input(Input::InputType type, int id0, int id1, int id2,
int value) int value)
{ {
int player;
PlayerAction action;
// menu navigation. TODO : enable navigation with gamepads const bool action_found = m_device_manager->mapInputToPlayerAndAction( type, id0, id1, id2, value, &player, &action );
if(!StateManager::isGameState())
{ std::cout << "Input code=" << id0 << " found=" << action_found << std::endl;
irr::SEvent::SKeyInput evt;
//GameAction ga = m_action_map->getEntry(type, id0, id1, id2);
if(type == Input::IT_KEYBOARD)
{
if(id0 == SDLK_RETURN)
evt.Key = irr::KEY_RETURN;
else if(id0 == SDLK_UP)
evt.Key = irr::KEY_UP;
else if(id0 == SDLK_DOWN)
evt.Key = irr::KEY_DOWN;
else if(id0 == SDLK_RIGHT)
evt.Key = irr::KEY_RIGHT;
else if(id0 == SDLK_LEFT)
evt.Key = irr::KEY_LEFT;
else
return; // only those keys are accepted in menus for now.
evt.PressedDown = value > MAX_VALUE/2;
}
else // allow menu navigation with gamepads and other devices too
{
int player;
PlayerAction action;
const bool action_found = m_device_manager->mapInputToPlayerAndAction( type, id0, id1, id2, value, &player, &action );
if(!action_found) return;
evt.PressedDown = abs(value) > MAX_VALUE/2;
if(action == PA_FIRE || action == PA_NITRO)
evt.Key = irr::KEY_RETURN;
else if(action == PA_ACCEL)
evt.Key = irr::KEY_UP;
else if(action == PA_BRAKE)
evt.Key = irr::KEY_DOWN;
else if(action == PA_RIGHT)
evt.Key = irr::KEY_RIGHT;
else if(action == PA_LEFT)
evt.Key = irr::KEY_LEFT;
else if(action == PA_RESCUE)
{
// escape (or 'rescue' on gamepad) is a little special
if(evt.PressedDown) StateManager::escapePressed();
return;
}
else
return; // only those bindings are accepted in menus for now.
if(type == Input::IT_STICKMOTION)
{
if(m_timer_in_use) return; // time between keys not elapsed yet
if(evt.PressedDown)
{
// minimum time between two gamepad events in menu
m_timer_in_use = true;
m_timer = 0.25;
}
} // end if (gamepad input type)
} // end if (keyboard vs gamepad)
// send event to irrLicht
irr::SEvent wrapper;
wrapper.KeyInput = evt;
wrapper.EventType = EET_KEY_INPUT_EVENT;
GUIEngine::getDevice()->postEventFromUser(wrapper);
}
// in-game event handling
else
{
int player;
PlayerAction action;
const bool action_found = m_device_manager->mapInputToPlayerAndAction( type, id0, id1, id2, value, &player, &action );
//GameAction ga = m_action_map->getEntry(type, id0, id1, id2);
#if 0 // TODO - input sensing #if 0 // TODO - input sensing
// Act different in input sensing mode. // Act different in input sensing mode.
if (m_mode >= INPUT_SENSE_PREFER_AXIS && if (m_mode >= INPUT_SENSE_PREFER_AXIS &&
m_mode <= INPUT_SENSE_PREFER_BUTTON) m_mode <= INPUT_SENSE_PREFER_BUTTON)
{
// Input sensing should be canceled.
if (ga == GA_LEAVE && m_sensed_input->type==Input::IT_KEYBOARD)
{ {
// Input sensing should be canceled. handleGameAction(GA_SENSE_CANCEL, value);
if (ga == GA_LEAVE && m_sensed_input->type==Input::IT_KEYBOARD) }
// Stores the sensed input when the button/key/axes/<whatever> is
// released only and is not used in a fixed mapping.
else if (!user_config->isFixedInput(type, id0, id1, id2) )
{
// See if the new input should be stored. This happens if:
// 1) the value is larger
// 2) nothing has been saved yet
// 3) the new event has the preferred type
// The latter is necessary since some gamepads have analog
// buttons that can return two different events when pressed
bool store_new = abs(value) > m_max_sensed_input ||
m_max_sensed_type == Input::IT_NONE ||
( m_mode == INPUT_SENSE_PREFER_AXIS &&
type == Input::IT_STICKMOTION &&
m_max_sensed_type != Input::IT_STICKMOTION ) ||
( m_mode == INPUT_SENSE_PREFER_BUTTON &&
type == Input::IT_STICKBUTTON &&
m_max_sensed_type != Input::IT_STICKBUTTON );
if(store_new)
{ {
handleGameAction(GA_SENSE_CANCEL, value); m_sensed_input->type = type;
m_sensed_input->id0 = id0;
m_sensed_input->id1 = id1;
m_sensed_input->id2 = id2;
m_max_sensed_input = abs(value);
m_max_sensed_type = type;
} }
// Stores the sensed input when the button/key/axes/<whatever> is // Notify the completion of the input sensing if the key/stick/
// released only and is not used in a fixed mapping. // ... is released.
else if (!user_config->isFixedInput(type, id0, id1, id2) ) if(value==0)
{ handleGameAction(GA_SENSE_COMPLETE, 0);
// See if the new input should be stored. This happens if: }
// 1) the value is larger } // if m_mode==INPUT_SENSE_PREFER_{AXIS,BUTTON}
// 2) nothing has been saved yet else
// 3) the new event has the preferred type
// The latter is necessary since some gamepads have analog
// buttons that can return two different events when pressed
bool store_new = abs(value) > m_max_sensed_input ||
m_max_sensed_type == Input::IT_NONE ||
( m_mode == INPUT_SENSE_PREFER_AXIS &&
type == Input::IT_STICKMOTION &&
m_max_sensed_type != Input::IT_STICKMOTION ) ||
( m_mode == INPUT_SENSE_PREFER_BUTTON &&
type == Input::IT_STICKBUTTON &&
m_max_sensed_type != Input::IT_STICKBUTTON );
if(store_new)
{
m_sensed_input->type = type;
m_sensed_input->id0 = id0;
m_sensed_input->id1 = id1;
m_sensed_input->id2 = id2;
m_max_sensed_input = abs(value);
m_max_sensed_type = type;
}
// Notify the completion of the input sensing if the key/stick/
// ... is released.
if(value==0)
handleGameAction(GA_SENSE_COMPLETE, 0);
}
} // if m_mode==INPUT_SENSE_PREFER_{AXIS,BUTTON}
else
#endif #endif
if (action_found) if (action_found)
{ {
RaceManager::getWorld()->getLocalPlayerKart(player)->action(action, abs(value)); RaceManager::getWorld()->getLocalPlayerKart(player)->action(action, abs(value));
} }
else if(type == Input::IT_KEYBOARD) else if(type == Input::IT_KEYBOARD)
{ {
// keyboard press not handled by device manager / bindings. Check static bindings... // keyboard press not handled by device manager / bindings. Check static bindings...
handleStaticAction( id0, value ); handleStaticAction( id0, value );
}
} }
} // input } // input
@ -465,6 +382,81 @@ void InputManager::input(Input::InputType type, int id0, int id1, int id2,
* flexibility (= treat 4 directions as four buttons). * flexibility (= treat 4 directions as four buttons).
* *
*/ */
void InputManager::input(const SEvent& event)
{
std::cout << "input event\n";
if(event.EventType == EET_JOYSTICK_INPUT_EVENT)
{
std::cout << "x=" << event.JoystickEvent.Axis[SEvent::SJoystickEvent::AXIS_X]
<< " y=" << event.JoystickEvent.Axis[SEvent::SJoystickEvent::AXIS_Y]
<< " 1=" << event.JoystickEvent.IsButtonPressed(0)
<< " 2=" << event.JoystickEvent.IsButtonPressed(1)
<< " 3=" << event.JoystickEvent.IsButtonPressed(2)
<< " 4=" << event.JoystickEvent.IsButtonPressed(3) << std::endl;
}
else if(event.EventType == EET_KEY_INPUT_EVENT)
{
const int key = event.KeyInput.Key;
if(event.KeyInput.PressedDown)
{
// escape is a little special
if(key == KEY_ESCAPE)
{
StateManager::escapePressed();
return;
}
input(Input::IT_KEYBOARD, key,
#ifdef HAVE_IRRLICHT
// FIXME: not sure why this happens: with plib the unicode
// value is 0. Since all values defined in user_config
// assume that the unicode value is 0, it does not work
// with irrlicht, which has proper unicode values defined
// (keydown is not recognised, but keyup is). So for now
// (till user_config is migrated to full irrlicht support)
// we pass the 0 here artifically so that keyboard handling
// works.
0,
#else
ev.key.keysym.unicode,
#endif
0, MAX_VALUE);
}
else
{
input(Input::IT_KEYBOARD, key, 0, 0, 0);
}
}
#if 0 // in case we ever use mouse in-game...
else if(event.EventType == EET_MOUSE_INPUT_EVENT)
{
const int type = event.MouseInput.Event;
if(type == EMIE_MOUSE_MOVED)
{
// m_mouse_x = event.MouseInput.X;
// m_mouse_y = event.MouseInput.Y;
//const int wheel = event.MouseInput.Wheel;
}
/*
EMIE_LMOUSE_PRESSED_DOWN Left mouse button was pressed down.
EMIE_RMOUSE_PRESSED_DOWN Right mouse button was pressed down.
EMIE_MMOUSE_PRESSED_DOWN Middle mouse button was pressed down.
EMIE_LMOUSE_LEFT_UP Left mouse button was left up.
EMIE_RMOUSE_LEFT_UP Right mouse button was left up.
EMIE_MMOUSE_LEFT_UP Middle mouse button was left up.
EMIE_MOUSE_MOVED The mouse cursor changed its position.
EMIE_MOUSE_WHEEL The mouse wheel was moved. Use Wheel value in event data to find out in what direction and how fast.
*/
}
#endif
}
/*
void InputManager::input() void InputManager::input()
{ {
SDL_Event ev; SDL_Event ev;
@ -606,6 +598,7 @@ void InputManager::input()
m_mouse_val_y = 0; m_mouse_val_y = 0;
} // input } // input
*/
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
/** Retrieves the Input instance that has been prepared in the input sense /** Retrieves the Input instance that has been prepared in the input sense
@ -701,7 +694,7 @@ void InputManager::setMode(InputDriverMode new_mode)
case LOWLEVEL: case LOWLEVEL:
// Leaving lowlevel mode. // Leaving lowlevel mode.
SDL_EnableUNICODE(SDL_DISABLE); // SDL_EnableUNICODE(SDL_DISABLE);
SDLManager::showPointer(); SDLManager::showPointer();
@ -751,7 +744,7 @@ void InputManager::setMode(InputDriverMode new_mode)
// We must be in menu mode now in order to switch. // We must be in menu mode now in order to switch.
assert (m_mode == MENU); assert (m_mode == MENU);
SDL_EnableUNICODE(SDL_ENABLE); // SDL_EnableUNICODE(SDL_ENABLE);
SDLManager::hidePointer(); SDLManager::hidePointer();

View File

@ -24,7 +24,7 @@
#include <vector> #include <vector>
#include <irrlicht.h> #include <irrlicht.h>
#include <SDL/SDL.h> // #include <SDL/SDL.h>
#include "input/input.hpp" #include "input/input.hpp"
@ -75,7 +75,10 @@ public:
InputManager(); InputManager();
~InputManager(); ~InputManager();
void initGamePadDevices(); void initGamePadDevices();
void input();
//void input();
void input(const irr::SEvent& event);
void setMode(InputDriverMode); void setMode(InputDriverMode);
bool isInMode(InputDriverMode); bool isInMode(InputDriverMode);

View File

@ -18,12 +18,6 @@
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifdef __APPLE__
// Necessary for Macs when using SDL without Xwindows: this include
// will rename main to SDLmain, and a new main program will be linked
// in from the library, causing a correct framework to be set up
# include "SDL/SDL.h"
#endif
#ifdef WIN32 #ifdef WIN32
# ifdef __CYGWIN__ # ifdef __CYGWIN__
@ -506,10 +500,6 @@ void CleanTuxKart()
//============================================================================= //=============================================================================
// FIXME - temporary, move
void eventCallback(GUIEngine::Widget* widget, std::string& name)
{
}
int main(int argc, char *argv[] ) int main(int argc, char *argv[] )
{ {

View File

@ -19,7 +19,7 @@
#include "main_loop.hpp" #include "main_loop.hpp"
#include <SDL/SDL.h> // #include <SDL/SDL.h>
#include <assert.h> #include <assert.h>
#include "history.hpp" #include "history.hpp"
#include "input/input_manager.hpp" #include "input/input_manager.hpp"
@ -43,10 +43,10 @@ int maxFPS = 0;
MainLoop::MainLoop() : MainLoop::MainLoop() :
m_abort(false), m_abort(false),
m_frame_count(0), m_frame_count(0)
m_curr_time(m_prev_time),
m_prev_time(SDL_GetTicks())
{ {
m_curr_time = 0;
m_prev_time = 0;
} // MainLoop } // MainLoop
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -54,39 +54,26 @@ MainLoop::~MainLoop()
{ {
} // ~MainLoop } // ~MainLoop
//-----------------------------------------------------------------------------
void MainLoop::loadBackgroundImages()
{
#ifndef HAVE_IRRLICHT
int ind = user_config->getBackgroundIndex();
const std::string &main = stk_config->getMainMenuPicture(ind);
m_title_screen_texture = material_manager->getMaterial(main)->getState()->getTextureHandle();
const std::string &background = stk_config->getBackgroundPicture(ind);
m_bg_texture = material_manager->getMaterial(background)->getState()->getTextureHandle();
#endif
} // loadBackgroundImages
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
/** Run the actual main loop. /** Run the actual main loop.
*/ */
void MainLoop::run() void MainLoop::run()
{ {
loadBackgroundImages(); IrrlichtDevice* device = GUIEngine::getDevice();
bool music_on = false; bool music_on = false;
m_curr_time = SDL_GetTicks(); m_curr_time = device->getTimer()->getRealTime(); // SDL_GetTicks();
float dt; float dt;
while(!m_abort) while(!m_abort)
{ {
input_manager->input(); // input_manager->input();
m_prev_time = m_curr_time; m_prev_time = m_curr_time;
while( 1 ) while( 1 )
{ {
m_curr_time = SDL_GetTicks(); m_curr_time = device->getTimer()->getRealTime();
dt =(float)(m_curr_time - m_prev_time); dt = (float)(m_curr_time - m_prev_time);
// don't allow the game to run slower than a certain amount. // don't allow the game to run slower than a certain amount.
// when the computer can't keep it up, slow down the shown time instead // when the computer can't keep it up, slow down the shown time instead
@ -102,7 +89,8 @@ void MainLoop::run()
//it might limit the frames to even 55 frames. On some cases, //it might limit the frames to even 55 frames. On some cases,
//SDL_Delay(1) will just cause the program to give up the //SDL_Delay(1) will just cause the program to give up the
//rest of it's timeslice. //rest of it's timeslice.
SDL_Delay(1); // FIXME - implement with non-SDL code
// SDL_Delay(1);
} }
else break; else break;
} }
@ -155,8 +143,8 @@ void MainLoop::run()
//FIXME: SDL_GetTicks() includes the loading time, //FIXME: SDL_GetTicks() includes the loading time,
//so the FPS will be skewed for now. //so the FPS will be skewed for now.
printf("Number of frames: %d time %f, Average FPS: %f\n", printf("Number of frames: %d time %f, Average FPS: %f\n",
m_frame_count, SDL_GetTicks() * 0.001, m_frame_count, device->getTimer()->getRealTime()*0.001,
(float)m_frame_count/(SDL_GetTicks() * 0.001)); (float)m_frame_count/(device->getTimer()->getRealTime()));
if(!history->replayHistory()) history->Save(); if(!history->replayHistory()) history->Save();
std::exit(-2); std::exit(-2);
} // if profile finished } // if profile finished

View File

@ -41,15 +41,15 @@ private:
int m_frame_count; int m_frame_count;
Uint32 m_curr_time; Uint32 m_curr_time;
Uint32 m_prev_time; Uint32 m_prev_time;
GLuint m_title_screen_texture; // GLuint m_title_screen_texture;
GLuint m_bg_texture; // GLuint m_bg_texture;
public: public:
MainLoop(); MainLoop();
~MainLoop(); ~MainLoop();
void run(); void run();
void abort(); void abort();
void loadBackgroundImages(); // void loadBackgroundImages();
}; // MainLoop }; // MainLoop
extern MainLoop* main_loop; extern MainLoop* main_loop;

View File

@ -1,6 +1,6 @@
#include "sdl_manager.hpp" #include "sdl_manager.hpp"
#include <SDL/SDL.h> // #include <SDL/SDL.h>
#include "user_config.hpp" #include "user_config.hpp"
#include "input/input_manager.hpp" #include "input/input_manager.hpp"
#include "gui/state_manager.hpp" #include "gui/state_manager.hpp"
@ -26,6 +26,7 @@ namespace SDLManager
void init() void init()
{ {
/*
if (SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_TIMER) < 0) if (SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_TIMER) < 0)
{ {
fprintf(stderr, "SDL_Init failed: %s\n", SDL_GetError()); fprintf(stderr, "SDL_Init failed: %s\n", SDL_GetError());
@ -70,6 +71,7 @@ namespace SDLManager
// setVideoMode(false); // setVideoMode(false);
SDL_JoystickEventState(SDL_ENABLE); SDL_JoystickEventState(SDL_ENABLE);
*/
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -77,7 +79,8 @@ namespace SDLManager
*/ */
void showPointer() void showPointer()
{ {
SDL_ShowCursor(SDL_ENABLE); GUIEngine::getDevice()->getCursorControl()->setVisible(true);
// SDL_ShowCursor(SDL_ENABLE);
} // showPointer } // showPointer
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -85,7 +88,8 @@ namespace SDLManager
*/ */
void hidePointer() void hidePointer()
{ {
SDL_ShowCursor(SDL_DISABLE); GUIEngine::getDevice()->getCursorControl()->setVisible(true);
// SDL_ShowCursor(SDL_DISABLE);
} // hidePointer } // hidePointer
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -93,6 +97,8 @@ namespace SDLManager
*/ */
void toggleFullscreen(bool resetTextures) void toggleFullscreen(bool resetTextures)
{ {
// TODO
/*
user_config->m_fullscreen = !user_config->m_fullscreen; user_config->m_fullscreen = !user_config->m_fullscreen;
m_flags = SDL_OPENGL | SDL_HWSURFACE; m_flags = SDL_OPENGL | SDL_HWSURFACE;
@ -113,6 +119,7 @@ namespace SDLManager
hidePointer(); hidePointer();
// setVideoMode(resetTextures); // setVideoMode(resetTextures);
*/
} // toggleFullscreen } // toggleFullscreen
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------

View File

@ -33,7 +33,7 @@
# include <direct.h> # include <direct.h>
#endif #endif
#include <SDL/SDL.h> // #include <SDL/SDL.h>
#define _WINSOCKAPI_ #define _WINSOCKAPI_
#include <plib/ul.h> #include <plib/ul.h>
@ -588,7 +588,9 @@ std::string UserConfig::getInputAsString(const Input &input)
s = _("not set"); s = _("not set");
break; break;
case Input::IT_KEYBOARD: case Input::IT_KEYBOARD:
s = SDL_GetKeyName((SDLKey) input.id0); // TODO - implement with non-SDL code
// s = SDL_GetKeyName((SDLKey) input.id0);
s = "some key";
break; break;
case Input::IT_STICKMOTION: case Input::IT_STICKMOTION:
s = StringUtils::insert_values( _("joy %d axis %d %s"), input.id0, s = StringUtils::insert_values( _("joy %d axis %d %s"), input.id0,