Merge pull request #2406 from devnexen/master
better alternative OSes handling + tiny C++ fix
This commit is contained in:
commit
82032ca6c9
@ -99,8 +99,10 @@
|
||||
|
||||
#if !defined(_IRR_WINDOWS_API_) && !defined(_IRR_OSX_PLATFORM_)
|
||||
#ifndef _IRR_SOLARIS_PLATFORM_
|
||||
#if !defined(__linux__) && !defined(__FreeBSD__)
|
||||
#define _IRR_LINUX_PLATFORM_
|
||||
#endif
|
||||
#endif
|
||||
#define _IRR_POSIX_API_
|
||||
#define _IRR_COMPILE_WITH_X11_DEVICE_
|
||||
#endif
|
||||
|
@ -2028,7 +2028,7 @@ public:
|
||||
{
|
||||
u32 tmp;
|
||||
sscanf(text, "0x%x", &tmp);
|
||||
Value = (void *) tmp;
|
||||
Value = reinterpret_cast<void *>(tmp);
|
||||
}
|
||||
|
||||
virtual E_ATTRIBUTE_TYPE getType() const
|
||||
|
@ -39,7 +39,7 @@ extern bool GLContextDebugBit;
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <sys/joystick.h>
|
||||
#else
|
||||
#elif defined(__linux__)
|
||||
|
||||
// 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.
|
||||
@ -2185,7 +2185,7 @@ bool CIrrDeviceLinux::activateJoysticks(core::array<SJoystickInfo> & joystickInf
|
||||
#ifdef __FreeBSD__
|
||||
info.axes=2;
|
||||
info.buttons=2;
|
||||
#else
|
||||
#elif defined(__linux__)
|
||||
ioctl( info.fd, JSIOCGAXES, &(info.axes) );
|
||||
ioctl( info.fd, JSIOCGBUTTONS, &(info.buttons) );
|
||||
fcntl( info.fd, F_SETFL, O_NONBLOCK );
|
||||
@ -2207,7 +2207,7 @@ bool CIrrDeviceLinux::activateJoysticks(core::array<SJoystickInfo> & joystickInf
|
||||
returnInfo.Axes = info.axes;
|
||||
returnInfo.Buttons = info.buttons;
|
||||
|
||||
#ifndef __FreeBSD__
|
||||
#if !defined(__FreeBSD__) && !defined(__OpenBSD__)
|
||||
char name[80];
|
||||
ioctl( info.fd, JSIOCGNAME(80), name);
|
||||
returnInfo.Name = name;
|
||||
@ -2252,7 +2252,7 @@ void CIrrDeviceLinux::pollJoysticks()
|
||||
info.persistentData.JoystickEvent.Axis[0] = js.x; /* X axis */
|
||||
info.persistentData.JoystickEvent.Axis[1] = js.y; /* Y axis */
|
||||
}
|
||||
#else
|
||||
#elif defined(__linux__)
|
||||
struct js_event event;
|
||||
while (sizeof(event) == read(info.fd, &event, sizeof(event)))
|
||||
{
|
||||
|
@ -478,7 +478,7 @@ bool CIrrDeviceSDL::run()
|
||||
joyevent.JoystickEvent.ButtonStates |= (SDL_JoystickGetButton(joystick, j)<<j);
|
||||
|
||||
// query all axes, already in correct range
|
||||
const int numAxes = core::min_(SDL_JoystickNumAxes(joystick), SEvent::SJoystickEvent::NUMBER_OF_AXES);
|
||||
const int numAxes = core::min_(SDL_JoystickNumAxes(joystick), static_cast<int>(SEvent::SJoystickEvent::NUMBER_OF_AXES));
|
||||
joyevent.JoystickEvent.Axis[SEvent::SJoystickEvent::AXIS_X]=0;
|
||||
joyevent.JoystickEvent.Axis[SEvent::SJoystickEvent::AXIS_Y]=0;
|
||||
joyevent.JoystickEvent.Axis[SEvent::SJoystickEvent::AXIS_Z]=0;
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#if !defined(_IRR_SOLARIS_PLATFORM_) && !defined(__CYGWIN__)
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
|
@ -22,10 +22,14 @@
|
||||
#include <libkern/OSByteOrder.h>
|
||||
#define bswap_16(X) OSReadSwapInt16(&X,0)
|
||||
#define bswap_32(X) OSReadSwapInt32(&X,0)
|
||||
#elif defined(__FreeBSD__) || defined(__OpenBSD__)
|
||||
#elif defined(__FreeBSD__)
|
||||
#include <sys/endian.h>
|
||||
#define bswap_16(X) bswap16(X)
|
||||
#define bswap_32(X) bswap32(X)
|
||||
#elif defined(__OpenBSD__)
|
||||
#include <endian.h>
|
||||
#define bswap_16(X) swap16(X)
|
||||
#define bswap_32(X) swap32(X)
|
||||
#elif !defined(_IRR_SOLARIS_PLATFORM_) && !defined(__PPC__) && !defined(_IRR_WINDOWS_API_)
|
||||
#include <byteswap.h>
|
||||
#else
|
||||
|
Loading…
Reference in New Issue
Block a user