mirror of
https://github.com/minetest/irrlicht.git
synced 2025-06-28 06:20:21 +02:00
Add optional multitouch support to X11.
Thanks @TheBrokenRail for a patch proposal based on example code from esjeon (patch #322). See https://sourceforge.net/p/irrlicht/patches/322 Original example code here: https://github.com/esjeon/xinput2-touch Users have to enable _IRR_LINUX_X11_XINPUT2_ in IrrCompileConfig and link with Xi to make this work. I rewrote the patch a bit and have no system for testing here, so this still needs some testing. I also backported EET_TOUCH_INPUT_EVENT for this from the ogl-es branch. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6178 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
@ -34,6 +34,9 @@ namespace irr
|
||||
IrrlichtDevice::postEventFromUser. They take the same path as mouse events. */
|
||||
EET_KEY_INPUT_EVENT,
|
||||
|
||||
//! A touch input event.
|
||||
EET_TOUCH_INPUT_EVENT,
|
||||
|
||||
//! A joystick (joypad, gamepad) input event.
|
||||
/** Joystick events are created by polling all connected joysticks once per
|
||||
device run() and then passing the events to IrrlichtDevice::postEventFromUser.
|
||||
@ -142,6 +145,22 @@ namespace irr
|
||||
EMBSM_FORCE_32_BIT = 0x7fffffff
|
||||
};
|
||||
|
||||
//! Enumeration for all touch input events
|
||||
enum ETOUCH_INPUT_EVENT
|
||||
{
|
||||
//! Touch was pressed down.
|
||||
ETIE_PRESSED_DOWN = 0,
|
||||
|
||||
//! Touch was left up.
|
||||
ETIE_LEFT_UP,
|
||||
|
||||
//! The touch changed its position.
|
||||
ETIE_MOVED,
|
||||
|
||||
//! No real event. Just for convenience to get number of events
|
||||
ETIE_COUNT
|
||||
};
|
||||
|
||||
namespace gui
|
||||
{
|
||||
|
||||
@ -275,6 +294,22 @@ struct SEvent
|
||||
|
||||
};
|
||||
|
||||
//! Any kind of touch event.
|
||||
struct STouchInput
|
||||
{
|
||||
// Touch ID.
|
||||
size_t ID;
|
||||
|
||||
// X position of simple touch.
|
||||
s32 X;
|
||||
|
||||
// Y position of simple touch.
|
||||
s32 Y;
|
||||
|
||||
//! Type of touch event.
|
||||
ETOUCH_INPUT_EVENT Event;
|
||||
};
|
||||
|
||||
//! Any kind of mouse event.
|
||||
struct SMouseInput
|
||||
{
|
||||
@ -331,6 +366,7 @@ struct SEvent
|
||||
bool Control:1;
|
||||
};
|
||||
|
||||
|
||||
//! A joystick event.
|
||||
/** Unlike other events, joystick events represent the result of polling
|
||||
* each connected joystick once per run() of the device. Joystick events will
|
||||
@ -417,6 +453,7 @@ struct SEvent
|
||||
struct SGUIEvent GUIEvent;
|
||||
struct SMouseInput MouseInput;
|
||||
struct SKeyInput KeyInput;
|
||||
struct STouchInput TouchInput;
|
||||
struct SJoystickEvent JoystickEvent;
|
||||
struct SLogEvent LogEvent;
|
||||
struct SUserEvent UserEvent;
|
||||
|
@ -216,18 +216,22 @@ define out. */
|
||||
#undef _IRR_COMPILE_WITH_X11_
|
||||
#endif
|
||||
|
||||
//! On some Linux systems the XF86 vidmode extension or X11 RandR are missing. Use these flags
|
||||
//! to remove the dependencies such that Irrlicht will compile on those systems, too.
|
||||
//! If you don't need colored cursors you can also disable the Xcursor extension
|
||||
//! On some Linux systems the XF86 vidmode extension, X11 RandR, or XInput2 are missing.
|
||||
//! Use these defines to add/remove support for those dependencies as needed.
|
||||
//! XInput2 (library called Xi) is currently only used to support touch-input.
|
||||
#if defined(_IRR_LINUX_PLATFORM_) && defined(_IRR_COMPILE_WITH_X11_)
|
||||
#define _IRR_LINUX_X11_VIDMODE_
|
||||
//#define _IRR_LINUX_X11_RANDR_
|
||||
//#define _IRR_LINUX_X11_XINPUT2_
|
||||
#ifdef NO_IRR_LINUX_X11_VIDMODE_
|
||||
#undef _IRR_LINUX_X11_VIDMODE_
|
||||
#endif
|
||||
#ifdef NO_IRR_LINUX_X11_RANDR_
|
||||
#undef _IRR_LINUX_X11_RANDR_
|
||||
#endif
|
||||
#ifdef NO_IRR_LINUX_X11_XINPUT2_
|
||||
#undef _IRR_LINUX_X11_XINPUT2_
|
||||
#endif
|
||||
|
||||
//! X11 has by default only monochrome cursors, but using the Xcursor library we can also get color cursor support.
|
||||
//! If you have the need for custom color cursors on X11 then enable this and make sure you also link
|
||||
|
Reference in New Issue
Block a user