mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-11 17:51:04 +00:00
Remove irr
namespace (#16309)
This commit is contained in:
parent
7e22c72492
commit
61551cfc3a
381 changed files with 680 additions and 1632 deletions
|
@ -58,7 +58,7 @@
|
|||
#else
|
||||
|
||||
// linux/joystick.h includes linux/input.h, which #defines values for various KEY_FOO keys.
|
||||
// These override the irr::KEY_FOO equivalents, which stops key handling from working.
|
||||
// These override the KEY_FOO equivalents, which stops key handling from working.
|
||||
// As a workaround, defining _INPUT_H stops linux/input.h from being included; it
|
||||
// doesn't actually seem to be necessary except to pull in sys/ioctl.h.
|
||||
#define _INPUT_H
|
||||
|
@ -88,8 +88,6 @@ int XI_EXTENSIONS_OPCODE;
|
|||
#endif
|
||||
}
|
||||
|
||||
namespace irr
|
||||
{
|
||||
//! constructor
|
||||
CIrrDeviceLinux::CIrrDeviceLinux(const SIrrlichtCreationParameters ¶m) :
|
||||
CIrrDeviceStub(param),
|
||||
|
@ -738,17 +736,17 @@ bool CIrrDeviceLinux::run()
|
|||
break;
|
||||
|
||||
case MotionNotify:
|
||||
irrevent.EventType = irr::EET_MOUSE_INPUT_EVENT;
|
||||
irrevent.MouseInput.Event = irr::EMIE_MOUSE_MOVED;
|
||||
irrevent.EventType = EET_MOUSE_INPUT_EVENT;
|
||||
irrevent.MouseInput.Event = EMIE_MOUSE_MOVED;
|
||||
irrevent.MouseInput.X = event.xbutton.x;
|
||||
irrevent.MouseInput.Y = event.xbutton.y;
|
||||
irrevent.MouseInput.Control = (event.xkey.state & ControlMask) != 0;
|
||||
irrevent.MouseInput.Shift = (event.xkey.state & ShiftMask) != 0;
|
||||
|
||||
// mouse button states
|
||||
irrevent.MouseInput.ButtonStates = (event.xbutton.state & Button1Mask) ? irr::EMBSM_LEFT : 0;
|
||||
irrevent.MouseInput.ButtonStates |= (event.xbutton.state & Button3Mask) ? irr::EMBSM_RIGHT : 0;
|
||||
irrevent.MouseInput.ButtonStates |= (event.xbutton.state & Button2Mask) ? irr::EMBSM_MIDDLE : 0;
|
||||
irrevent.MouseInput.ButtonStates = (event.xbutton.state & Button1Mask) ? EMBSM_LEFT : 0;
|
||||
irrevent.MouseInput.ButtonStates |= (event.xbutton.state & Button3Mask) ? EMBSM_RIGHT : 0;
|
||||
irrevent.MouseInput.ButtonStates |= (event.xbutton.state & Button2Mask) ? EMBSM_MIDDLE : 0;
|
||||
|
||||
postEventFromUser(irrevent);
|
||||
break;
|
||||
|
@ -756,7 +754,7 @@ bool CIrrDeviceLinux::run()
|
|||
case ButtonPress:
|
||||
case ButtonRelease:
|
||||
|
||||
irrevent.EventType = irr::EET_MOUSE_INPUT_EVENT;
|
||||
irrevent.EventType = EET_MOUSE_INPUT_EVENT;
|
||||
irrevent.MouseInput.X = event.xbutton.x;
|
||||
irrevent.MouseInput.Y = event.xbutton.y;
|
||||
irrevent.MouseInput.Control = (event.xkey.state & ControlMask) != 0;
|
||||
|
@ -766,29 +764,29 @@ bool CIrrDeviceLinux::run()
|
|||
// This sets the state which the buttons had _prior_ to the event.
|
||||
// So unlike on Windows the button which just got changed has still the old state here.
|
||||
// We handle that below by flipping the corresponding bit later.
|
||||
irrevent.MouseInput.ButtonStates = (event.xbutton.state & Button1Mask) ? irr::EMBSM_LEFT : 0;
|
||||
irrevent.MouseInput.ButtonStates |= (event.xbutton.state & Button3Mask) ? irr::EMBSM_RIGHT : 0;
|
||||
irrevent.MouseInput.ButtonStates |= (event.xbutton.state & Button2Mask) ? irr::EMBSM_MIDDLE : 0;
|
||||
irrevent.MouseInput.ButtonStates = (event.xbutton.state & Button1Mask) ? EMBSM_LEFT : 0;
|
||||
irrevent.MouseInput.ButtonStates |= (event.xbutton.state & Button3Mask) ? EMBSM_RIGHT : 0;
|
||||
irrevent.MouseInput.ButtonStates |= (event.xbutton.state & Button2Mask) ? EMBSM_MIDDLE : 0;
|
||||
|
||||
irrevent.MouseInput.Event = irr::EMIE_COUNT;
|
||||
irrevent.MouseInput.Event = EMIE_COUNT;
|
||||
|
||||
switch (event.xbutton.button) {
|
||||
case Button1:
|
||||
irrevent.MouseInput.Event =
|
||||
(event.type == ButtonPress) ? irr::EMIE_LMOUSE_PRESSED_DOWN : irr::EMIE_LMOUSE_LEFT_UP;
|
||||
irrevent.MouseInput.ButtonStates ^= irr::EMBSM_LEFT;
|
||||
(event.type == ButtonPress) ? EMIE_LMOUSE_PRESSED_DOWN : EMIE_LMOUSE_LEFT_UP;
|
||||
irrevent.MouseInput.ButtonStates ^= EMBSM_LEFT;
|
||||
break;
|
||||
|
||||
case Button3:
|
||||
irrevent.MouseInput.Event =
|
||||
(event.type == ButtonPress) ? irr::EMIE_RMOUSE_PRESSED_DOWN : irr::EMIE_RMOUSE_LEFT_UP;
|
||||
irrevent.MouseInput.ButtonStates ^= irr::EMBSM_RIGHT;
|
||||
(event.type == ButtonPress) ? EMIE_RMOUSE_PRESSED_DOWN : EMIE_RMOUSE_LEFT_UP;
|
||||
irrevent.MouseInput.ButtonStates ^= EMBSM_RIGHT;
|
||||
break;
|
||||
|
||||
case Button2:
|
||||
irrevent.MouseInput.Event =
|
||||
(event.type == ButtonPress) ? irr::EMIE_MMOUSE_PRESSED_DOWN : irr::EMIE_MMOUSE_LEFT_UP;
|
||||
irrevent.MouseInput.ButtonStates ^= irr::EMBSM_MIDDLE;
|
||||
(event.type == ButtonPress) ? EMIE_MMOUSE_PRESSED_DOWN : EMIE_MMOUSE_LEFT_UP;
|
||||
irrevent.MouseInput.ButtonStates ^= EMBSM_MIDDLE;
|
||||
break;
|
||||
|
||||
case Button4:
|
||||
|
@ -806,7 +804,7 @@ bool CIrrDeviceLinux::run()
|
|||
break;
|
||||
}
|
||||
|
||||
if (irrevent.MouseInput.Event != irr::EMIE_COUNT) {
|
||||
if (irrevent.MouseInput.Event != EMIE_COUNT) {
|
||||
postEventFromUser(irrevent);
|
||||
|
||||
if (irrevent.MouseInput.Event >= EMIE_LMOUSE_PRESSED_DOWN && irrevent.MouseInput.Event <= EMIE_MMOUSE_PRESSED_DOWN) {
|
||||
|
@ -842,7 +840,7 @@ bool CIrrDeviceLinux::run()
|
|||
}
|
||||
}
|
||||
|
||||
irrevent.EventType = irr::EET_KEY_INPUT_EVENT;
|
||||
irrevent.EventType = EET_KEY_INPUT_EVENT;
|
||||
irrevent.KeyInput.PressedDown = false;
|
||||
irrevent.KeyInput.Char = 0; // on release that's undefined
|
||||
irrevent.KeyInput.Control = (event.xkey.state & ControlMask) != 0;
|
||||
|
@ -864,7 +862,7 @@ bool CIrrDeviceLinux::run()
|
|||
if (strLen > 0 && (status == XLookupChars || status == XLookupBoth)) {
|
||||
if (strLen > 1) {
|
||||
// Multiple characters: send string event
|
||||
irrevent.EventType = irr::EET_STRING_INPUT_EVENT;
|
||||
irrevent.EventType = EET_STRING_INPUT_EVENT;
|
||||
irrevent.StringInput.Str = new core::stringw(buf);
|
||||
postEventFromUser(irrevent);
|
||||
delete irrevent.StringInput.Str;
|
||||
|
@ -899,7 +897,7 @@ bool CIrrDeviceLinux::run()
|
|||
irrevent.KeyInput.Char = tmp.wbuf[0];
|
||||
}
|
||||
|
||||
irrevent.EventType = irr::EET_KEY_INPUT_EVENT;
|
||||
irrevent.EventType = EET_KEY_INPUT_EVENT;
|
||||
irrevent.KeyInput.PressedDown = true;
|
||||
irrevent.KeyInput.Control = (event.xkey.state & ControlMask) != 0;
|
||||
irrevent.KeyInput.Shift = (event.xkey.state & ShiftMask) != 0;
|
||||
|
@ -913,7 +911,7 @@ bool CIrrDeviceLinux::run()
|
|||
Close = true;
|
||||
} else {
|
||||
// we assume it's a user message
|
||||
irrevent.EventType = irr::EET_USER_EVENT;
|
||||
irrevent.EventType = EET_USER_EVENT;
|
||||
irrevent.UserEvent.UserData1 = static_cast<size_t>(event.xclient.data.l[0]);
|
||||
irrevent.UserEvent.UserData2 = static_cast<size_t>(event.xclient.data.l[1]);
|
||||
postEventFromUser(irrevent);
|
||||
|
@ -1232,7 +1230,7 @@ void CIrrDeviceLinux::setResizable(bool resize)
|
|||
}
|
||||
|
||||
//! Resize the render window.
|
||||
void CIrrDeviceLinux::setWindowSize(const irr::core::dimension2d<u32> &size)
|
||||
void CIrrDeviceLinux::setWindowSize(const core::dimension2d<u32> &size)
|
||||
{
|
||||
#ifdef _IRR_COMPILE_WITH_X11_
|
||||
if (CreationParams.DriverType == video::EDT_NULL || CreationParams.Fullscreen)
|
||||
|
@ -1563,7 +1561,7 @@ bool CIrrDeviceLinux::activateJoysticks(core::array<SJoystickInfo> &joystickInfo
|
|||
fcntl(info.fd, F_SETFL, O_NONBLOCK);
|
||||
#endif
|
||||
|
||||
info.persistentData.EventType = irr::EET_JOYSTICK_INPUT_EVENT;
|
||||
info.persistentData.EventType = EET_JOYSTICK_INPUT_EVENT;
|
||||
info.persistentData.JoystickEvent.Joystick = ActiveJoysticks.size();
|
||||
|
||||
// There's no obvious way to determine which (if any) axes represent a POV
|
||||
|
@ -1732,7 +1730,7 @@ const c8 *CIrrDeviceLinux::getTextFromSelection(Atom selection, core::stringc &t
|
|||
bytesLeft, 0, AnyPropertyType, &type, &format,
|
||||
&numItems, &dummy, &data);
|
||||
if (result == Success)
|
||||
text_buffer = (irr::c8 *)data;
|
||||
text_buffer = (c8 *)data;
|
||||
XFree(data);
|
||||
}
|
||||
|
||||
|
@ -1909,7 +1907,7 @@ void CIrrDeviceLinux::initXInput2()
|
|||
|
||||
#ifdef _IRR_COMPILE_WITH_X11_
|
||||
|
||||
Cursor CIrrDeviceLinux::TextureToMonochromeCursor(irr::video::ITexture *tex, const core::rect<s32> &sourceRect, const core::position2d<s32> &hotspot)
|
||||
Cursor CIrrDeviceLinux::TextureToMonochromeCursor(video::ITexture *tex, const core::rect<s32> &sourceRect, const core::position2d<s32> &hotspot)
|
||||
{
|
||||
XImage *sourceImage = XCreateImage(XDisplay, VisualInfo->visual,
|
||||
1, // depth,
|
||||
|
@ -1994,7 +1992,7 @@ Cursor CIrrDeviceLinux::TextureToMonochromeCursor(irr::video::ITexture *tex, con
|
|||
}
|
||||
|
||||
#ifdef _IRR_LINUX_XCURSOR_
|
||||
Cursor CIrrDeviceLinux::TextureToARGBCursor(irr::video::ITexture *tex, const core::rect<s32> &sourceRect, const core::position2d<s32> &hotspot)
|
||||
Cursor CIrrDeviceLinux::TextureToARGBCursor(video::ITexture *tex, const core::rect<s32> &sourceRect, const core::position2d<s32> &hotspot)
|
||||
{
|
||||
XcursorImage *image = XcursorImageCreate(sourceRect.getWidth(), sourceRect.getHeight());
|
||||
image->xhot = hotspot.X;
|
||||
|
@ -2030,7 +2028,7 @@ Cursor CIrrDeviceLinux::TextureToARGBCursor(irr::video::ITexture *tex, const cor
|
|||
}
|
||||
#endif // #ifdef _IRR_LINUX_XCURSOR_
|
||||
|
||||
Cursor CIrrDeviceLinux::TextureToCursor(irr::video::ITexture *tex, const core::rect<s32> &sourceRect, const core::position2d<s32> &hotspot)
|
||||
Cursor CIrrDeviceLinux::TextureToCursor(video::ITexture *tex, const core::rect<s32> &sourceRect, const core::position2d<s32> &hotspot)
|
||||
{
|
||||
#ifdef _IRR_LINUX_XCURSOR_
|
||||
return TextureToARGBCursor(tex, sourceRect, hotspot);
|
||||
|
@ -2165,9 +2163,9 @@ gui::ECURSOR_ICON CIrrDeviceLinux::CCursorControl::addIcon(const gui::SCursorSpr
|
|||
CursorX11 cX11;
|
||||
cX11.FrameTime = icon.SpriteBank->getSprites()[icon.SpriteId].frameTime;
|
||||
for (u32 i = 0; i < icon.SpriteBank->getSprites()[icon.SpriteId].Frames.size(); ++i) {
|
||||
irr::u32 texId = icon.SpriteBank->getSprites()[icon.SpriteId].Frames[i].textureNumber;
|
||||
irr::u32 rectId = icon.SpriteBank->getSprites()[icon.SpriteId].Frames[i].rectNumber;
|
||||
irr::core::rect<s32> rectIcon = icon.SpriteBank->getPositions()[rectId];
|
||||
u32 texId = icon.SpriteBank->getSprites()[icon.SpriteId].Frames[i].textureNumber;
|
||||
u32 rectId = icon.SpriteBank->getSprites()[icon.SpriteId].Frames[i].rectNumber;
|
||||
core::rect<s32> rectIcon = icon.SpriteBank->getPositions()[rectId];
|
||||
Cursor cursor = Device->TextureToCursor(icon.SpriteBank->getTexture(texId), rectIcon, icon.HotSpot);
|
||||
cX11.Frames.push_back(CursorFrameX11(cursor));
|
||||
}
|
||||
|
@ -2194,9 +2192,9 @@ void CIrrDeviceLinux::CCursorControl::changeIcon(gui::ECURSOR_ICON iconId, const
|
|||
CursorX11 cX11;
|
||||
cX11.FrameTime = icon.SpriteBank->getSprites()[icon.SpriteId].frameTime;
|
||||
for (u32 i = 0; i < icon.SpriteBank->getSprites()[icon.SpriteId].Frames.size(); ++i) {
|
||||
irr::u32 texId = icon.SpriteBank->getSprites()[icon.SpriteId].Frames[i].textureNumber;
|
||||
irr::u32 rectId = icon.SpriteBank->getSprites()[icon.SpriteId].Frames[i].rectNumber;
|
||||
irr::core::rect<s32> rectIcon = icon.SpriteBank->getPositions()[rectId];
|
||||
u32 texId = icon.SpriteBank->getSprites()[icon.SpriteId].Frames[i].textureNumber;
|
||||
u32 rectId = icon.SpriteBank->getSprites()[icon.SpriteId].Frames[i].rectNumber;
|
||||
core::rect<s32> rectIcon = icon.SpriteBank->getPositions()[rectId];
|
||||
Cursor cursor = Device->TextureToCursor(icon.SpriteBank->getTexture(texId), rectIcon, icon.HotSpot);
|
||||
cX11.Frames.push_back(CursorFrameX11(cursor));
|
||||
}
|
||||
|
@ -2206,7 +2204,7 @@ void CIrrDeviceLinux::CCursorControl::changeIcon(gui::ECURSOR_ICON iconId, const
|
|||
#endif
|
||||
}
|
||||
|
||||
irr::core::dimension2di CIrrDeviceLinux::CCursorControl::getSupportedIconSize() const
|
||||
core::dimension2di CIrrDeviceLinux::CCursorControl::getSupportedIconSize() const
|
||||
{
|
||||
// this returns the closest match that is smaller or same size, so we just pass a value which should be large enough for cursors
|
||||
unsigned int width = 0, height = 0;
|
||||
|
@ -2216,6 +2214,4 @@ irr::core::dimension2di CIrrDeviceLinux::CCursorControl::getSupportedIconSize()
|
|||
return core::dimension2di(width, height);
|
||||
}
|
||||
|
||||
} // end namespace
|
||||
|
||||
#endif // _IRR_COMPILE_WITH_X11_DEVICE_
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue