Add SDL game controller support (#105)
This commit is contained in:
parent
371c3d3115
commit
8c5e0cb61f
@ -25,6 +25,7 @@ MultiCraft Development Team:
|
|||||||
textures/base/pack/chat_btn.png
|
textures/base/pack/chat_btn.png
|
||||||
textures/base/pack/crack_anylength_touch.png
|
textures/base/pack/crack_anylength_touch.png
|
||||||
textures/base/pack/creative_bg.png
|
textures/base/pack/creative_bg.png
|
||||||
|
textures/base/pack/cursor.png
|
||||||
textures/base/pack/error_screenshot.png
|
textures/base/pack/error_screenshot.png
|
||||||
textures/base/pack/desc_bg.png
|
textures/base/pack/desc_bg.png
|
||||||
textures/base/pack/down_btn.png
|
textures/base/pack/down_btn.png
|
||||||
|
@ -558,7 +558,7 @@ void ClientLauncher::main_menu(MainMenuData *menudata)
|
|||||||
infostream << "Waited for other menus" << std::endl;
|
infostream << "Waited for other menus" << std::endl;
|
||||||
|
|
||||||
// Cursor can be non-visible when coming from the game
|
// Cursor can be non-visible when coming from the game
|
||||||
RenderingEngine::get_raw_device()->getCursorControl()->setVisible(true);
|
input->setCursorVisible(true);
|
||||||
|
|
||||||
/* show main menu */
|
/* show main menu */
|
||||||
GUIEngine mymenu(&input->joystick, guiroot, &g_menumgr, menudata, *kill);
|
GUIEngine mymenu(&input->joystick, guiroot, &g_menumgr, menudata, *kill);
|
||||||
|
@ -1898,8 +1898,12 @@ void Game::processUserInput(f32 dtime)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
bool doubletap_jump = m_cache_doubletap_jump;
|
||||||
|
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
||||||
|
doubletap_jump |= input->sdl_game_controller.isActive();
|
||||||
|
#endif
|
||||||
// Increase timer for double tap of "keymap_jump"
|
// Increase timer for double tap of "keymap_jump"
|
||||||
if (m_cache_doubletap_jump && runData.jump_timer <= 0.15f)
|
if (doubletap_jump && runData.jump_timer <= 0.15f)
|
||||||
runData.jump_timer += dtime;
|
runData.jump_timer += dtime;
|
||||||
|
|
||||||
processKeyInput();
|
processKeyInput();
|
||||||
@ -2189,7 +2193,12 @@ void Game::toggleFreeMove()
|
|||||||
|
|
||||||
void Game::toggleFreeMoveAlt()
|
void Game::toggleFreeMoveAlt()
|
||||||
{
|
{
|
||||||
if (m_cache_doubletap_jump && runData.jump_timer < 0.15f &&
|
bool doubletap_jump = m_cache_doubletap_jump;
|
||||||
|
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
||||||
|
doubletap_jump |= input->sdl_game_controller.isActive();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (doubletap_jump && runData.jump_timer < 0.15f &&
|
||||||
(!simple_singleplayer_mode || client->checkPrivilege("fly")))
|
(!simple_singleplayer_mode || client->checkPrivilege("fly")))
|
||||||
toggleFreeMove();
|
toggleFreeMove();
|
||||||
|
|
||||||
@ -2435,9 +2444,7 @@ void Game::updateCameraDirection(CameraOrientation *cam, float dtime)
|
|||||||
&& !isMenuActive()) || input->isRandom()) {
|
&& !isMenuActive()) || input->isRandom()) {
|
||||||
|
|
||||||
if (!input->isRandom()) {
|
if (!input->isRandom()) {
|
||||||
// Mac OSX gets upset if this is set every frame
|
input->setCursorVisible(false);
|
||||||
if (device->getCursorControl()->isVisible())
|
|
||||||
device->getCursorControl()->setVisible(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_first_loop_after_window_activation) {
|
if (m_first_loop_after_window_activation) {
|
||||||
@ -2451,10 +2458,7 @@ void Game::updateCameraDirection(CameraOrientation *cam, float dtime)
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Mac OSX gets upset if this is set every frame
|
input->setCursorVisible(true);
|
||||||
if (!device->getCursorControl()->isVisible())
|
|
||||||
device->getCursorControl()->setVisible(true);
|
|
||||||
|
|
||||||
m_first_loop_after_window_activation = true;
|
m_first_loop_after_window_activation = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -2485,8 +2489,13 @@ void Game::updateCameraOrientation(CameraOrientation *cam, float dtime)
|
|||||||
|
|
||||||
if (m_cache_enable_joysticks) {
|
if (m_cache_enable_joysticks) {
|
||||||
f32 c = m_cache_joystick_frustum_sensitivity * (1.f / 32767.f) * dtime;
|
f32 c = m_cache_joystick_frustum_sensitivity * (1.f / 32767.f) * dtime;
|
||||||
|
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
||||||
|
cam->camera_yaw -= input->sdl_game_controller.getCameraYaw() * c;
|
||||||
|
cam->camera_pitch += input->sdl_game_controller.getCameraPitch() * c;
|
||||||
|
#else
|
||||||
cam->camera_yaw -= input->joystick.getAxisWithoutDead(JA_FRUSTUM_HORIZONTAL) * c;
|
cam->camera_yaw -= input->joystick.getAxisWithoutDead(JA_FRUSTUM_HORIZONTAL) * c;
|
||||||
cam->camera_pitch += input->joystick.getAxisWithoutDead(JA_FRUSTUM_VERTICAL) * c;
|
cam->camera_pitch += input->joystick.getAxisWithoutDead(JA_FRUSTUM_VERTICAL) * c;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
cam->camera_pitch = rangelim(cam->camera_pitch, -89.5, 89.5);
|
cam->camera_pitch = rangelim(cam->camera_pitch, -89.5, 89.5);
|
||||||
@ -2514,8 +2523,13 @@ void Game::updatePlayerControl(const CameraOrientation &cam)
|
|||||||
isKeyDown(KeyType::PLACE),
|
isKeyDown(KeyType::PLACE),
|
||||||
cam.camera_pitch,
|
cam.camera_pitch,
|
||||||
cam.camera_yaw,
|
cam.camera_yaw,
|
||||||
|
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
||||||
|
input->sdl_game_controller.getMoveSideward(),
|
||||||
|
input->sdl_game_controller.getMoveForward()
|
||||||
|
#else
|
||||||
input->joystick.getAxisWithoutDead(JA_SIDEWARD_MOVE),
|
input->joystick.getAxisWithoutDead(JA_SIDEWARD_MOVE),
|
||||||
input->joystick.getAxisWithoutDead(JA_FORWARD_MOVE)
|
input->joystick.getAxisWithoutDead(JA_FORWARD_MOVE)
|
||||||
|
#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
u32 keypress_bits = (
|
u32 keypress_bits = (
|
||||||
|
@ -23,12 +23,17 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include "gui/guiChatConsole.h"
|
#include "gui/guiChatConsole.h"
|
||||||
#include "gui/mainmenumanager.h"
|
#include "gui/mainmenumanager.h"
|
||||||
#include "hud.h"
|
#include "hud.h"
|
||||||
|
#include "settings.h"
|
||||||
|
|
||||||
#ifdef __IOS__
|
#ifdef __IOS__
|
||||||
#include "porting_ios.h"
|
#include "porting_ios.h"
|
||||||
extern "C" void external_pause_game();
|
extern "C" void external_pause_game();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
||||||
|
#include <SDL.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
void KeyCache::populate_nonchanging()
|
void KeyCache::populate_nonchanging()
|
||||||
{
|
{
|
||||||
key[KeyType::ESC] = EscapeKey;
|
key[KeyType::ESC] = EscapeKey;
|
||||||
@ -103,19 +108,43 @@ void KeyCache::populate()
|
|||||||
|
|
||||||
bool MyEventReceiver::OnEvent(const SEvent &event)
|
bool MyEventReceiver::OnEvent(const SEvent &event)
|
||||||
{
|
{
|
||||||
|
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
||||||
|
if (event.EventType == irr::EET_SDL_CONTROLLER_BUTTON_EVENT ||
|
||||||
|
event.EventType == irr::EET_SDL_CONTROLLER_AXIS_EVENT) {
|
||||||
|
if (g_settings->getBool("enable_joysticks")) {
|
||||||
|
sdl_game_controller->translateEvent(event);
|
||||||
|
input->setCursorVisible(sdl_game_controller->isCursorVisible());
|
||||||
|
}
|
||||||
|
} else if ((event.EventType == irr::EET_MOUSE_INPUT_EVENT &&
|
||||||
|
event.MouseInput.Event == irr::EMIE_MOUSE_MOVED) ||
|
||||||
|
event.EventType == irr::EET_TOUCH_INPUT_EVENT) {
|
||||||
|
if (!sdl_game_controller->isFakeEvent() &&
|
||||||
|
sdl_game_controller->isActive()) {
|
||||||
|
sdl_game_controller->setActive(false);
|
||||||
|
input->setCursorVisible(sdl_game_controller->isCursorVisible());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_TOUCHSCREENGUI
|
#ifdef HAVE_TOUCHSCREENGUI
|
||||||
if (event.EventType == irr::EET_TOUCH_INPUT_EVENT) {
|
if (event.EventType == irr::EET_TOUCH_INPUT_EVENT) {
|
||||||
TouchScreenGUI::setActive(true);
|
TouchScreenGUI::setActive(true);
|
||||||
if (m_touchscreengui && !isMenuActive())
|
if (m_touchscreengui && !isMenuActive())
|
||||||
m_touchscreengui->show();
|
m_touchscreengui->show();
|
||||||
} else if (event.EventType == irr::EET_MOUSE_INPUT_EVENT &&
|
} else if ((event.EventType == irr::EET_MOUSE_INPUT_EVENT &&
|
||||||
event.MouseInput.Event == irr::EMIE_MOUSE_MOVED) {
|
event.MouseInput.Event == irr::EMIE_MOUSE_MOVED) ||
|
||||||
|
sdl_game_controller->isActive()) {
|
||||||
TouchScreenGUI::setActive(false);
|
TouchScreenGUI::setActive(false);
|
||||||
if (m_touchscreengui && !isMenuActive())
|
if (m_touchscreengui && !isMenuActive())
|
||||||
m_touchscreengui->hide();
|
m_touchscreengui->hide();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
||||||
|
if (event.EventType == irr::EET_SDL_CONTROLLER_BUTTON_EVENT)
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
|
|
||||||
GUIChatConsole* chat_console = GUIChatConsole::getChatConsole();
|
GUIChatConsole* chat_console = GUIChatConsole::getChatConsole();
|
||||||
if (chat_console && chat_console->isOpen()) {
|
if (chat_console && chat_console->isOpen()) {
|
||||||
bool result = chat_console->preprocessEvent(event);
|
bool result = chat_console->preprocessEvent(event);
|
||||||
|
@ -193,6 +193,11 @@ public:
|
|||||||
|
|
||||||
JoystickController *joystick = nullptr;
|
JoystickController *joystick = nullptr;
|
||||||
|
|
||||||
|
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
||||||
|
SDLGameController* sdl_game_controller = nullptr;
|
||||||
|
InputHandler* input = nullptr;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_TOUCHSCREENGUI
|
#ifdef HAVE_TOUCHSCREENGUI
|
||||||
TouchScreenGUI *m_touchscreengui;
|
TouchScreenGUI *m_touchscreengui;
|
||||||
#endif
|
#endif
|
||||||
@ -255,8 +260,13 @@ public:
|
|||||||
|
|
||||||
virtual void clear() {}
|
virtual void clear() {}
|
||||||
|
|
||||||
|
virtual void setCursorVisible(bool visible) {};
|
||||||
|
|
||||||
JoystickController joystick;
|
JoystickController joystick;
|
||||||
KeyCache keycache;
|
KeyCache keycache;
|
||||||
|
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
||||||
|
SDLGameController sdl_game_controller;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
/*
|
/*
|
||||||
Separated input handler
|
Separated input handler
|
||||||
@ -268,6 +278,10 @@ public:
|
|||||||
RealInputHandler(MyEventReceiver *receiver) : m_receiver(receiver)
|
RealInputHandler(MyEventReceiver *receiver) : m_receiver(receiver)
|
||||||
{
|
{
|
||||||
m_receiver->joystick = &joystick;
|
m_receiver->joystick = &joystick;
|
||||||
|
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
||||||
|
m_receiver->sdl_game_controller = &sdl_game_controller;
|
||||||
|
m_receiver->input = this;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
virtual bool isKeyDown(GameKeyType k)
|
virtual bool isKeyDown(GameKeyType k)
|
||||||
{
|
{
|
||||||
@ -326,6 +340,22 @@ public:
|
|||||||
|
|
||||||
virtual s32 getMouseWheel() { return m_receiver->getMouseWheel(); }
|
virtual s32 getMouseWheel() { return m_receiver->getMouseWheel(); }
|
||||||
|
|
||||||
|
virtual void setCursorVisible(bool visible)
|
||||||
|
{
|
||||||
|
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
||||||
|
sdl_game_controller.setCursorVisible(visible);
|
||||||
|
|
||||||
|
if (sdl_game_controller.isActive())
|
||||||
|
visible = false;
|
||||||
|
#endif
|
||||||
|
IrrlichtDevice *device = RenderingEngine::get_raw_device();
|
||||||
|
|
||||||
|
if (device->getCursorControl()) {
|
||||||
|
if (visible != device->getCursorControl()->isVisible())
|
||||||
|
device->getCursorControl()->setVisible(visible);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void clear()
|
void clear()
|
||||||
{
|
{
|
||||||
joystick.clear();
|
joystick.clear();
|
||||||
|
@ -20,9 +20,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include "joystick_controller.h"
|
#include "joystick_controller.h"
|
||||||
#include "irrlichttypes_extrabloated.h"
|
#include "irrlichttypes_extrabloated.h"
|
||||||
#include "keys.h"
|
#include "keys.h"
|
||||||
|
#include "keycode.h"
|
||||||
|
#include "gui/mainmenumanager.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "gettime.h"
|
#include "gettime.h"
|
||||||
#include "porting.h"
|
#include "porting.h"
|
||||||
|
#include "renderingengine.h"
|
||||||
#include "util/string.h"
|
#include "util/string.h"
|
||||||
|
|
||||||
bool JoystickButtonCmb::isTriggered(const irr::SEvent::SJoystickEvent &ev) const
|
bool JoystickButtonCmb::isTriggered(const irr::SEvent::SJoystickEvent &ev) const
|
||||||
@ -258,3 +261,352 @@ s16 JoystickController::getAxisWithoutDead(JoystickAxis axis)
|
|||||||
return 0;
|
return 0;
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
||||||
|
bool SDLGameController::m_active = false;
|
||||||
|
bool SDLGameController::m_cursor_visible = false;
|
||||||
|
|
||||||
|
void SDLGameController::handleMouseMovement(int x, int y)
|
||||||
|
{
|
||||||
|
IrrlichtDevice* device = RenderingEngine::get_raw_device();
|
||||||
|
|
||||||
|
bool changed = false;
|
||||||
|
|
||||||
|
u32 current_time = device->getTimer()->getRealTime();
|
||||||
|
v2s32 mouse_pos = device->getCursorControl()->getPosition();
|
||||||
|
int deadzone = g_settings->getU16("joystick_deadzone");
|
||||||
|
|
||||||
|
if (x > deadzone || x < -deadzone) {
|
||||||
|
s32 dt = current_time - m_mouse_time;
|
||||||
|
|
||||||
|
mouse_pos.X += (x * dt / 30000);
|
||||||
|
if (mouse_pos.X < 0)
|
||||||
|
mouse_pos.X = 0;
|
||||||
|
if (mouse_pos.X > device->getVideoDriver()->getScreenSize().Width)
|
||||||
|
mouse_pos.X = device->getVideoDriver()->getScreenSize().Width;
|
||||||
|
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (y > deadzone || y < -deadzone) {
|
||||||
|
s32 dt = current_time - m_mouse_time;
|
||||||
|
|
||||||
|
mouse_pos.Y += (y * dt / 30000);
|
||||||
|
if (mouse_pos.Y < 0)
|
||||||
|
mouse_pos.Y = 0;
|
||||||
|
if (mouse_pos.Y > device->getVideoDriver()->getScreenSize().Height)
|
||||||
|
mouse_pos.Y = device->getVideoDriver()->getScreenSize().Height;
|
||||||
|
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (changed) {
|
||||||
|
SEvent translated_event;
|
||||||
|
translated_event.EventType = irr::EET_MOUSE_INPUT_EVENT;
|
||||||
|
translated_event.MouseInput.Event = irr::EMIE_MOUSE_MOVED;
|
||||||
|
translated_event.MouseInput.X = mouse_pos.X;
|
||||||
|
translated_event.MouseInput.Y = mouse_pos.Y;
|
||||||
|
translated_event.MouseInput.Control = false;
|
||||||
|
translated_event.MouseInput.Shift = false;
|
||||||
|
translated_event.MouseInput.ButtonStates = m_button_states;
|
||||||
|
|
||||||
|
sendEvent(translated_event);
|
||||||
|
device->getCursorControl()->setPosition(mouse_pos.X, mouse_pos.Y);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_mouse_time = current_time;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SDLGameController::handleTriggerLeft(s16 value)
|
||||||
|
{
|
||||||
|
IrrlichtDevice* device = RenderingEngine::get_raw_device();
|
||||||
|
|
||||||
|
int deadzone = g_settings->getU16("joystick_deadzone");
|
||||||
|
|
||||||
|
SEvent translated_event;
|
||||||
|
translated_event.EventType = irr::EET_KEY_INPUT_EVENT;
|
||||||
|
translated_event.KeyInput.Char = 0;
|
||||||
|
translated_event.KeyInput.Key = getKeySetting("keymap_hotbar_previous").getKeyCode();
|
||||||
|
translated_event.KeyInput.Shift = false;
|
||||||
|
translated_event.KeyInput.Control = false;
|
||||||
|
|
||||||
|
if (value <= deadzone && m_trigger_left_value > deadzone) {
|
||||||
|
translated_event.KeyInput.PressedDown = false;
|
||||||
|
sendEvent(translated_event);
|
||||||
|
} else if (value > deadzone && m_trigger_left_value <= deadzone) {
|
||||||
|
translated_event.KeyInput.PressedDown = true;
|
||||||
|
sendEvent(translated_event);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_trigger_left_value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SDLGameController::handleTriggerRight(s16 value)
|
||||||
|
{
|
||||||
|
IrrlichtDevice* device = RenderingEngine::get_raw_device();
|
||||||
|
|
||||||
|
int deadzone = g_settings->getU16("joystick_deadzone");
|
||||||
|
|
||||||
|
SEvent translated_event;
|
||||||
|
translated_event.EventType = irr::EET_KEY_INPUT_EVENT;
|
||||||
|
translated_event.KeyInput.Char = 0;
|
||||||
|
translated_event.KeyInput.Key = getKeySetting("keymap_hotbar_next").getKeyCode();
|
||||||
|
translated_event.KeyInput.Shift = false;
|
||||||
|
translated_event.KeyInput.Control = false;
|
||||||
|
|
||||||
|
if (value <= deadzone && m_trigger_right_value > deadzone) {
|
||||||
|
translated_event.KeyInput.PressedDown = false;
|
||||||
|
sendEvent(translated_event);
|
||||||
|
} else if (value > deadzone && m_trigger_right_value <= deadzone) {
|
||||||
|
translated_event.KeyInput.PressedDown = true;
|
||||||
|
sendEvent(translated_event);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_trigger_right_value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SDLGameController::handleMouseClickLeft(bool pressed)
|
||||||
|
{
|
||||||
|
IrrlichtDevice* device = RenderingEngine::get_raw_device();
|
||||||
|
|
||||||
|
v2s32 mouse_pos = device->getCursorControl()->getPosition();
|
||||||
|
|
||||||
|
if (pressed)
|
||||||
|
m_button_states |= irr::EMBSM_LEFT;
|
||||||
|
else
|
||||||
|
m_button_states &= ~irr::EMBSM_LEFT;
|
||||||
|
|
||||||
|
SEvent translated_event;
|
||||||
|
translated_event.EventType = irr::EET_MOUSE_INPUT_EVENT;
|
||||||
|
translated_event.MouseInput.Event = pressed ? irr::EMIE_LMOUSE_PRESSED_DOWN : irr::EMIE_LMOUSE_LEFT_UP;
|
||||||
|
translated_event.MouseInput.X = mouse_pos.X;
|
||||||
|
translated_event.MouseInput.Y = mouse_pos.Y;
|
||||||
|
translated_event.MouseInput.Control = false;
|
||||||
|
translated_event.MouseInput.Shift = false;
|
||||||
|
translated_event.MouseInput.ButtonStates = m_button_states;
|
||||||
|
|
||||||
|
sendEvent(translated_event);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SDLGameController::handleMouseClickRight(bool pressed)
|
||||||
|
{
|
||||||
|
IrrlichtDevice* device = RenderingEngine::get_raw_device();
|
||||||
|
|
||||||
|
v2s32 mouse_pos = device->getCursorControl()->getPosition();
|
||||||
|
|
||||||
|
if (pressed)
|
||||||
|
m_button_states |= irr::EMBSM_RIGHT;
|
||||||
|
else
|
||||||
|
m_button_states &= ~irr::EMBSM_RIGHT;
|
||||||
|
|
||||||
|
SEvent translated_event;
|
||||||
|
translated_event.EventType = irr::EET_MOUSE_INPUT_EVENT;
|
||||||
|
translated_event.MouseInput.Event = pressed ? irr::EMIE_RMOUSE_PRESSED_DOWN : irr::EMIE_RMOUSE_LEFT_UP;
|
||||||
|
translated_event.MouseInput.X = mouse_pos.X;
|
||||||
|
translated_event.MouseInput.Y = mouse_pos.Y;
|
||||||
|
translated_event.MouseInput.Control = false;
|
||||||
|
translated_event.MouseInput.Shift = false;
|
||||||
|
translated_event.MouseInput.ButtonStates = m_button_states;
|
||||||
|
|
||||||
|
sendEvent(translated_event);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SDLGameController::handleButton(const SEvent &event)
|
||||||
|
{
|
||||||
|
irr::EKEY_CODE key = KEY_UNKNOWN;
|
||||||
|
|
||||||
|
switch (event.SDLControllerButtonEvent.Button) {
|
||||||
|
case SDL_CONTROLLER_BUTTON_A:
|
||||||
|
key = getKeySetting("keymap_jump").getKeyCode();
|
||||||
|
break;
|
||||||
|
case SDL_CONTROLLER_BUTTON_B:
|
||||||
|
key = getKeySetting("keymap_sneak").getKeyCode();
|
||||||
|
break;
|
||||||
|
case SDL_CONTROLLER_BUTTON_X:
|
||||||
|
key = getKeySetting("keymap_special1").getKeyCode();
|
||||||
|
break;
|
||||||
|
case SDL_CONTROLLER_BUTTON_Y:
|
||||||
|
key = getKeySetting("keymap_minimap").getKeyCode();
|
||||||
|
break;
|
||||||
|
case SDL_CONTROLLER_BUTTON_BACK:
|
||||||
|
key = getKeySetting("keymap_chat").getKeyCode();
|
||||||
|
break;
|
||||||
|
case SDL_CONTROLLER_BUTTON_GUIDE:
|
||||||
|
break;
|
||||||
|
case SDL_CONTROLLER_BUTTON_START:
|
||||||
|
key = KEY_ESCAPE;
|
||||||
|
break;
|
||||||
|
case SDL_CONTROLLER_BUTTON_LEFTSTICK:
|
||||||
|
key = getKeySetting("keymap_camera_mode").getKeyCode();
|
||||||
|
break;
|
||||||
|
case SDL_CONTROLLER_BUTTON_RIGHTSTICK:
|
||||||
|
key = KEY_LBUTTON;
|
||||||
|
break;
|
||||||
|
case SDL_CONTROLLER_BUTTON_LEFTSHOULDER:
|
||||||
|
key = KEY_LBUTTON;
|
||||||
|
break;
|
||||||
|
case SDL_CONTROLLER_BUTTON_RIGHTSHOULDER:
|
||||||
|
key = KEY_RBUTTON;
|
||||||
|
break;
|
||||||
|
case SDL_CONTROLLER_BUTTON_DPAD_UP:
|
||||||
|
key = getKeySetting("keymap_rangeselect").getKeyCode();
|
||||||
|
break;
|
||||||
|
case SDL_CONTROLLER_BUTTON_DPAD_DOWN:
|
||||||
|
key = getKeySetting("keymap_drop").getKeyCode();
|
||||||
|
break;
|
||||||
|
case SDL_CONTROLLER_BUTTON_DPAD_LEFT:
|
||||||
|
key = KEY_ESCAPE;
|
||||||
|
break;
|
||||||
|
case SDL_CONTROLLER_BUTTON_DPAD_RIGHT:
|
||||||
|
key = getKeySetting("keymap_inventory").getKeyCode();
|
||||||
|
break;
|
||||||
|
case SDL_CONTROLLER_BUTTON_MISC1:
|
||||||
|
case SDL_CONTROLLER_BUTTON_PADDLE1:
|
||||||
|
case SDL_CONTROLLER_BUTTON_PADDLE2:
|
||||||
|
case SDL_CONTROLLER_BUTTON_PADDLE3:
|
||||||
|
case SDL_CONTROLLER_BUTTON_PADDLE4:
|
||||||
|
case SDL_CONTROLLER_BUTTON_TOUCHPAD:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (key != KEY_UNKNOWN) {
|
||||||
|
SEvent translated_event;
|
||||||
|
translated_event.EventType = irr::EET_KEY_INPUT_EVENT;
|
||||||
|
translated_event.KeyInput.Char = 0;
|
||||||
|
translated_event.KeyInput.Key = key;
|
||||||
|
translated_event.KeyInput.PressedDown = event.SDLControllerButtonEvent.Pressed;
|
||||||
|
translated_event.KeyInput.Shift = false;
|
||||||
|
translated_event.KeyInput.Control = false;
|
||||||
|
|
||||||
|
sendEvent(translated_event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SDLGameController::handleButtonInMenu(const SEvent &event)
|
||||||
|
{
|
||||||
|
irr::EKEY_CODE key = KEY_UNKNOWN;
|
||||||
|
|
||||||
|
// Just used game mapping for escape key for now
|
||||||
|
switch (event.SDLControllerButtonEvent.Button) {
|
||||||
|
case SDL_CONTROLLER_BUTTON_A:
|
||||||
|
case SDL_CONTROLLER_BUTTON_B:
|
||||||
|
case SDL_CONTROLLER_BUTTON_X:
|
||||||
|
case SDL_CONTROLLER_BUTTON_Y:
|
||||||
|
case SDL_CONTROLLER_BUTTON_BACK:
|
||||||
|
case SDL_CONTROLLER_BUTTON_GUIDE:
|
||||||
|
break;
|
||||||
|
case SDL_CONTROLLER_BUTTON_START:
|
||||||
|
key = KEY_ESCAPE;
|
||||||
|
break;
|
||||||
|
case SDL_CONTROLLER_BUTTON_LEFTSTICK:
|
||||||
|
case SDL_CONTROLLER_BUTTON_RIGHTSTICK:
|
||||||
|
case SDL_CONTROLLER_BUTTON_LEFTSHOULDER:
|
||||||
|
case SDL_CONTROLLER_BUTTON_RIGHTSHOULDER:
|
||||||
|
case SDL_CONTROLLER_BUTTON_DPAD_UP:
|
||||||
|
case SDL_CONTROLLER_BUTTON_DPAD_DOWN:
|
||||||
|
break;
|
||||||
|
case SDL_CONTROLLER_BUTTON_DPAD_LEFT:
|
||||||
|
key = KEY_ESCAPE;
|
||||||
|
break;
|
||||||
|
case SDL_CONTROLLER_BUTTON_DPAD_RIGHT:
|
||||||
|
case SDL_CONTROLLER_BUTTON_MISC1:
|
||||||
|
case SDL_CONTROLLER_BUTTON_PADDLE1:
|
||||||
|
case SDL_CONTROLLER_BUTTON_PADDLE2:
|
||||||
|
case SDL_CONTROLLER_BUTTON_PADDLE3:
|
||||||
|
case SDL_CONTROLLER_BUTTON_PADDLE4:
|
||||||
|
case SDL_CONTROLLER_BUTTON_TOUCHPAD:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (key != KEY_UNKNOWN) {
|
||||||
|
SEvent translated_event;
|
||||||
|
translated_event.EventType = irr::EET_KEY_INPUT_EVENT;
|
||||||
|
translated_event.KeyInput.Char = 0;
|
||||||
|
translated_event.KeyInput.Key = key;
|
||||||
|
translated_event.KeyInput.PressedDown = event.SDLControllerButtonEvent.Pressed;
|
||||||
|
translated_event.KeyInput.Shift = false;
|
||||||
|
translated_event.KeyInput.Control = false;
|
||||||
|
|
||||||
|
sendEvent(translated_event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SDLGameController::handlePlayerMovement(int x, int y)
|
||||||
|
{
|
||||||
|
int deadzone = g_settings->getU16("joystick_deadzone");
|
||||||
|
|
||||||
|
m_move_sideward = x;
|
||||||
|
if (m_move_sideward < deadzone && m_move_sideward > -deadzone)
|
||||||
|
m_move_sideward = 0;
|
||||||
|
else
|
||||||
|
m_active = true;
|
||||||
|
|
||||||
|
m_move_forward = y;
|
||||||
|
if (m_move_forward < deadzone && m_move_forward > -deadzone)
|
||||||
|
m_move_forward = 0;
|
||||||
|
else
|
||||||
|
m_active = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SDLGameController::handleCameraOrientation(int x, int y)
|
||||||
|
{
|
||||||
|
int deadzone = g_settings->getU16("joystick_deadzone");
|
||||||
|
|
||||||
|
m_camera_yaw = x;
|
||||||
|
if (m_camera_yaw < deadzone && m_camera_yaw > -deadzone)
|
||||||
|
m_camera_yaw = 0;
|
||||||
|
else
|
||||||
|
m_active = true;
|
||||||
|
|
||||||
|
m_camera_pitch = y;
|
||||||
|
if (m_camera_pitch < deadzone && m_camera_pitch > -deadzone)
|
||||||
|
m_camera_pitch = 0;
|
||||||
|
else
|
||||||
|
m_active = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SDLGameController::sendEvent(const SEvent &event)
|
||||||
|
{
|
||||||
|
m_active = true;
|
||||||
|
m_is_fake_event = true;
|
||||||
|
IrrlichtDevice* device = RenderingEngine::get_raw_device();
|
||||||
|
device->postEventFromUser(event);
|
||||||
|
m_is_fake_event = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SDLGameController::translateEvent(const SEvent &event)
|
||||||
|
{
|
||||||
|
if (event.EventType == irr::EET_SDL_CONTROLLER_BUTTON_EVENT) {
|
||||||
|
if (isMenuActive()) {
|
||||||
|
if (event.SDLControllerButtonEvent.Button == SDL_CONTROLLER_BUTTON_LEFTSTICK ||
|
||||||
|
event.SDLControllerButtonEvent.Button == SDL_CONTROLLER_BUTTON_LEFTSHOULDER) {
|
||||||
|
handleMouseClickLeft(event.SDLControllerButtonEvent.Pressed);
|
||||||
|
} else if (event.SDLControllerButtonEvent.Button == SDL_CONTROLLER_BUTTON_LEFTSHOULDER) {
|
||||||
|
handleMouseClickRight(event.SDLControllerButtonEvent.Pressed);
|
||||||
|
} else {
|
||||||
|
handleButtonInMenu(event);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (event.SDLControllerButtonEvent.Button == SDL_CONTROLLER_BUTTON_RIGHTSTICK ||
|
||||||
|
event.SDLControllerButtonEvent.Button == SDL_CONTROLLER_BUTTON_LEFTSHOULDER) {
|
||||||
|
handleMouseClickLeft(event.SDLControllerButtonEvent.Pressed);
|
||||||
|
} else if (event.SDLControllerButtonEvent.Button == SDL_CONTROLLER_BUTTON_LEFTSHOULDER) {
|
||||||
|
handleMouseClickRight(event.SDLControllerButtonEvent.Pressed);
|
||||||
|
} else {
|
||||||
|
handleButton(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (event.EventType == irr::EET_SDL_CONTROLLER_AXIS_EVENT) {
|
||||||
|
const s16* value = event.SDLControllerAxisEvent.Value;
|
||||||
|
|
||||||
|
if (isMenuActive()) {
|
||||||
|
handleMouseMovement(value[SDL_CONTROLLER_AXIS_LEFTX], value[SDL_CONTROLLER_AXIS_LEFTY]);
|
||||||
|
} else {
|
||||||
|
handleTriggerLeft(value[SDL_CONTROLLER_AXIS_TRIGGERLEFT]);
|
||||||
|
handleTriggerRight(value[SDL_CONTROLLER_AXIS_TRIGGERRIGHT]);
|
||||||
|
handlePlayerMovement(value[SDL_CONTROLLER_AXIS_LEFTX], value[SDL_CONTROLLER_AXIS_LEFTY]);
|
||||||
|
handleCameraOrientation(value[SDL_CONTROLLER_AXIS_RIGHTX], value[SDL_CONTROLLER_AXIS_RIGHTY]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
@ -167,3 +167,47 @@ private:
|
|||||||
std::bitset<KeyType::INTERNAL_ENUM_COUNT> m_past_keys_pressed;
|
std::bitset<KeyType::INTERNAL_ENUM_COUNT> m_past_keys_pressed;
|
||||||
std::bitset<KeyType::INTERNAL_ENUM_COUNT> m_keys_released;
|
std::bitset<KeyType::INTERNAL_ENUM_COUNT> m_keys_released;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
||||||
|
class SDLGameController
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
void handleMouseMovement(int x, int y);
|
||||||
|
void handleTriggerLeft(s16 value);
|
||||||
|
void handleTriggerRight(s16 value);
|
||||||
|
void handleMouseClickLeft(bool pressed);
|
||||||
|
void handleMouseClickRight(bool pressed);
|
||||||
|
void handleButton(const SEvent &event);
|
||||||
|
void handleButtonInMenu(const SEvent &event);
|
||||||
|
void handlePlayerMovement(int x, int y);
|
||||||
|
void handleCameraOrientation(int x, int y);
|
||||||
|
void sendEvent(const SEvent &event);
|
||||||
|
|
||||||
|
int m_button_states = 0;
|
||||||
|
u32 m_mouse_time = 0;
|
||||||
|
s16 m_trigger_left_value = 0;
|
||||||
|
s16 m_trigger_right_value = 0;
|
||||||
|
s16 m_move_sideward = 0;
|
||||||
|
s16 m_move_forward = 0;
|
||||||
|
s16 m_camera_yaw = 0;
|
||||||
|
s16 m_camera_pitch = 0;
|
||||||
|
|
||||||
|
static bool m_active;
|
||||||
|
static bool m_cursor_visible;
|
||||||
|
bool m_is_fake_event = false;
|
||||||
|
|
||||||
|
public:
|
||||||
|
void translateEvent(const SEvent &event);
|
||||||
|
|
||||||
|
s16 getMoveSideward() { return m_move_sideward; }
|
||||||
|
s16 getMoveForward() { return m_move_forward; }
|
||||||
|
s16 getCameraYaw() { return m_camera_yaw; }
|
||||||
|
s16 getCameraPitch() { return m_camera_pitch; }
|
||||||
|
|
||||||
|
void setActive(bool value) { m_active = value; }
|
||||||
|
static bool isActive() { return m_active; }
|
||||||
|
void setCursorVisible(bool visible) { m_cursor_visible = visible; }
|
||||||
|
static bool isCursorVisible() { return m_cursor_visible; }
|
||||||
|
bool isFakeEvent() { return m_is_fake_event; }
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
@ -44,6 +44,8 @@ public:
|
|||||||
const char *sym() const;
|
const char *sym() const;
|
||||||
const char *name() const;
|
const char *name() const;
|
||||||
|
|
||||||
|
irr::EKEY_CODE getKeyCode() { return Key; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static bool valid_kcode(irr::EKEY_CODE k)
|
static bool valid_kcode(irr::EKEY_CODE k)
|
||||||
{
|
{
|
||||||
|
@ -27,6 +27,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include "map.h"
|
#include "map.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "content_cao.h"
|
#include "content_cao.h"
|
||||||
|
#include "client/joystick_controller.h"
|
||||||
|
#include "gui/touchscreengui.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
LocalPlayer
|
LocalPlayer
|
||||||
@ -293,7 +295,7 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
|
|||||||
(touching_ground ? m_cao->getStepHeight() : (0.2f * BS));
|
(touching_ground ? m_cao->getStepHeight() : (0.2f * BS));
|
||||||
|
|
||||||
#ifdef HAVE_TOUCHSCREENGUI
|
#ifdef HAVE_TOUCHSCREENGUI
|
||||||
if (touching_ground)
|
if (TouchScreenGUI::isActive() && touching_ground)
|
||||||
player_stepheight += (0.6f * BS);
|
player_stepheight += (0.6f * BS);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -934,6 +936,7 @@ void LocalPlayer::old_move(f32 dtime, Environment *env, f32 pos_max_d,
|
|||||||
float player_stepheight = touching_ground ? (BS * 0.6f) : (BS * 0.2f);
|
float player_stepheight = touching_ground ? (BS * 0.6f) : (BS * 0.2f);
|
||||||
|
|
||||||
#ifdef HAVE_TOUCHSCREENGUI
|
#ifdef HAVE_TOUCHSCREENGUI
|
||||||
|
if (TouchScreenGUI::isActive())
|
||||||
player_stepheight += (0.6 * BS);
|
player_stepheight += (0.6 * BS);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1167,8 +1170,21 @@ void LocalPlayer::handleAutojump(f32 dtime, Environment *env,
|
|||||||
const collisionMoveResult &result, const v3f &initial_position,
|
const collisionMoveResult &result, const v3f &initial_position,
|
||||||
const v3f &initial_speed, f32 pos_max_d)
|
const v3f &initial_speed, f32 pos_max_d)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_TOUCHSCREENGUI
|
||||||
|
// Touchscreen uses player_stepheight for autojump
|
||||||
|
if (TouchScreenGUI::isActive())
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
PlayerSettings &player_settings = getPlayerSettings();
|
PlayerSettings &player_settings = getPlayerSettings();
|
||||||
if (!player_settings.autojump)
|
bool autojump_enabled = player_settings.autojump;
|
||||||
|
|
||||||
|
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
||||||
|
// Force autojump on gamepad
|
||||||
|
autojump_enabled |= SDLGameController::isActive();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!autojump_enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_autojump)
|
if (m_autojump)
|
||||||
|
@ -290,7 +290,7 @@ void set_default_settings()
|
|||||||
settings->setDefault("always_fly_fast", "true");
|
settings->setDefault("always_fly_fast", "true");
|
||||||
settings->setDefault("autojump", "false");
|
settings->setDefault("autojump", "false");
|
||||||
settings->setDefault("continuous_forward", "false");
|
settings->setDefault("continuous_forward", "false");
|
||||||
settings->setDefault("enable_joysticks", "false");
|
settings->setDefault("enable_joysticks", "true");
|
||||||
settings->setDefault("joystick_id", "0");
|
settings->setDefault("joystick_id", "0");
|
||||||
settings->setDefault("joystick_type", "");
|
settings->setDefault("joystick_type", "");
|
||||||
settings->setDefault("repeat_joystick_button_time", "0.17");
|
settings->setDefault("repeat_joystick_button_time", "0.17");
|
||||||
|
@ -20,13 +20,17 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include "modalMenu.h"
|
#include "modalMenu.h"
|
||||||
|
#include "client/guiscalingfilter.h"
|
||||||
|
#include "client/joystick_controller.h"
|
||||||
|
#include "client/renderingengine.h"
|
||||||
|
#include "client/tile.h"
|
||||||
|
#include "filesys.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "porting.h"
|
#include "porting.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
#ifdef HAVE_TOUCHSCREENGUI
|
#ifdef HAVE_TOUCHSCREENGUI
|
||||||
#include "touchscreengui.h"
|
#include "touchscreengui.h"
|
||||||
#include "client/renderingengine.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _IRR_COMPILE_WITH_SDL_DEVICE_
|
#ifdef _IRR_COMPILE_WITH_SDL_DEVICE_
|
||||||
@ -93,8 +97,54 @@ void GUIModalMenu::draw()
|
|||||||
}
|
}
|
||||||
|
|
||||||
drawMenu();
|
drawMenu();
|
||||||
|
|
||||||
|
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
||||||
|
if (SDLGameController::isActive() && SDLGameController::isCursorVisible())
|
||||||
|
drawCursor();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
||||||
|
void GUIModalMenu::drawCursor()
|
||||||
|
{
|
||||||
|
video::IVideoDriver *driver = Environment->getVideoDriver();
|
||||||
|
irr::IrrlichtDevice *device = RenderingEngine::get_raw_device();
|
||||||
|
v2s32 pointer = device->getCursorControl()->getPosition();
|
||||||
|
|
||||||
|
v3f crosshair_color = g_settings->getV3F("crosshair_color");
|
||||||
|
u32 cross_r = rangelim(myround(crosshair_color.X), 0, 255);
|
||||||
|
u32 cross_g = rangelim(myround(crosshair_color.Y), 0, 255);
|
||||||
|
u32 cross_b = rangelim(myround(crosshair_color.Z), 0, 255);
|
||||||
|
u32 cross_a = rangelim(g_settings->getS32("crosshair_alpha"), 0, 255);
|
||||||
|
video::SColor crosshair_argb = video::SColor(cross_a, cross_r, cross_g, cross_b);
|
||||||
|
|
||||||
|
const int cursor_line_size = 16;
|
||||||
|
float hud_scaling = g_settings->getFloat("hud_scaling");
|
||||||
|
float scale_factor = hud_scaling * RenderingEngine::getDisplayDensity();
|
||||||
|
int cursor_size = (int)(cursor_line_size * scale_factor);
|
||||||
|
|
||||||
|
std::string sprite_path = porting::path_share + DIR_DELIM + "textures" +
|
||||||
|
DIR_DELIM + "base" + DIR_DELIM + "pack" + DIR_DELIM +
|
||||||
|
"cursor.png";
|
||||||
|
video::ITexture *cursor = driver->getTexture(sprite_path.c_str());
|
||||||
|
|
||||||
|
if (cursor) {
|
||||||
|
core::rect<s32> rect(pointer.X - cursor_size, pointer.Y - cursor_size,
|
||||||
|
pointer.X + cursor_size, pointer.Y + cursor_size);
|
||||||
|
video::SColor crosshair_color[] = {crosshair_argb, crosshair_argb,
|
||||||
|
crosshair_argb, crosshair_argb};
|
||||||
|
draw2DImageFilterScaled(driver, cursor, rect,
|
||||||
|
core::rect<s32>({0, 0}, cursor->getOriginalSize()),
|
||||||
|
nullptr, crosshair_color, true);
|
||||||
|
} else {
|
||||||
|
driver->draw2DLine(pointer - v2s32(cursor_size, 0),
|
||||||
|
pointer + v2s32(cursor_size, 0), crosshair_argb);
|
||||||
|
driver->draw2DLine(pointer - v2s32(0, cursor_size),
|
||||||
|
pointer + v2s32(0, cursor_size), crosshair_argb);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This should be called when the menu wants to quit.
|
This should be called when the menu wants to quit.
|
||||||
|
|
||||||
|
@ -46,6 +46,9 @@ public:
|
|||||||
void allowFocusRemoval(bool allow);
|
void allowFocusRemoval(bool allow);
|
||||||
bool canTakeFocus(gui::IGUIElement *e);
|
bool canTakeFocus(gui::IGUIElement *e);
|
||||||
void draw();
|
void draw();
|
||||||
|
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
||||||
|
void drawCursor();
|
||||||
|
#endif
|
||||||
void quitMenu();
|
void quitMenu();
|
||||||
void removeChildren();
|
void removeChildren();
|
||||||
|
|
||||||
|
BIN
textures/base/pack/cursor.png
Normal file
BIN
textures/base/pack/cursor.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 339 B |
Loading…
x
Reference in New Issue
Block a user