mirror of
https://github.com/AxioDL/boo.git
synced 2025-12-18 01:15:26 +00:00
Major scoped-enum refactor
This commit is contained in:
@@ -29,18 +29,18 @@ class IApplication
|
||||
public:
|
||||
virtual ~IApplication() {}
|
||||
|
||||
enum EPlatformType
|
||||
enum class EPlatformType : uint8_t
|
||||
{
|
||||
PLAT_AUTO = 0,
|
||||
PLAT_WAYLAND = 1,
|
||||
PLAT_XLIB = 2,
|
||||
PLAT_ANDROID = 3,
|
||||
PLAT_COCOA = 4,
|
||||
PLAT_COCOA_TOUCH = 5,
|
||||
PLAT_WIN32 = 6,
|
||||
PLAT_WINRT = 7,
|
||||
PLAT_REVOLUTION = 8,
|
||||
PLAT_CAFE = 9
|
||||
Auto = 0,
|
||||
Wayland = 1,
|
||||
Xlib = 2,
|
||||
Android = 3,
|
||||
Cocoa = 4,
|
||||
CocoaTouch = 5,
|
||||
Win32 = 6,
|
||||
WinRT = 7,
|
||||
Revolution = 8,
|
||||
Cafe = 9
|
||||
};
|
||||
virtual EPlatformType getPlatformType() const=0;
|
||||
|
||||
|
||||
@@ -17,27 +17,27 @@ class IGraphicsContext
|
||||
|
||||
public:
|
||||
|
||||
enum EGraphicsAPI
|
||||
enum class EGraphicsAPI
|
||||
{
|
||||
API_NONE = 0,
|
||||
API_OPENGL_3_3 = 1,
|
||||
API_OPENGL_4_2 = 2,
|
||||
API_OPENGLES_3 = 3,
|
||||
API_VULKAN = 4,
|
||||
API_D3D11 = 5,
|
||||
API_D3D12 = 6,
|
||||
API_METAL = 7,
|
||||
API_GX = 8,
|
||||
API_GX2 = 9
|
||||
None = 0,
|
||||
OpenGL3_3 = 1,
|
||||
OpenGL4_2 = 2,
|
||||
OpenGLES3 = 3,
|
||||
Vulkan = 4,
|
||||
D3D11 = 5,
|
||||
D3D12 = 6,
|
||||
Metal = 7,
|
||||
GX = 8,
|
||||
GX2 = 9
|
||||
};
|
||||
|
||||
enum EPixelFormat
|
||||
enum class EPixelFormat
|
||||
{
|
||||
PF_NONE = 0,
|
||||
PF_RGBA8 = 1, /* Default */
|
||||
PF_RGBA8_Z24 = 2,
|
||||
PF_RGBAF32 = 3,
|
||||
PF_RGBAF32_Z24 = 4
|
||||
None = 0,
|
||||
RGBA8 = 1, /* Default */
|
||||
RGBA8_Z24 = 2,
|
||||
RGBAF32 = 3,
|
||||
RGBAF32_Z24 = 4
|
||||
};
|
||||
|
||||
virtual ~IGraphicsContext() {}
|
||||
|
||||
@@ -8,14 +8,14 @@ namespace boo
|
||||
struct IGraphicsCommandQueue;
|
||||
struct IGraphicsDataFactory;
|
||||
|
||||
enum EMouseButton
|
||||
enum class EMouseButton
|
||||
{
|
||||
BUTTON_NONE = 0,
|
||||
BUTTON_PRIMARY = 1,
|
||||
BUTTON_SECONDARY = 2,
|
||||
BUTTON_MIDDLE = 3,
|
||||
BUTTON_AUX1 = 4,
|
||||
BUTTON_AUX2 = 5
|
||||
None = 0,
|
||||
Primary = 1,
|
||||
Secondary = 2,
|
||||
Middle = 3,
|
||||
Aux1 = 4,
|
||||
Aux2 = 5
|
||||
};
|
||||
|
||||
struct SWindowRect
|
||||
@@ -48,45 +48,70 @@ struct SScrollDelta
|
||||
void zeroOut() {delta[0] = 0.0; delta[1] = 0.0;}
|
||||
};
|
||||
|
||||
enum ESpecialKey
|
||||
enum class ESpecialKey
|
||||
{
|
||||
KEY_NONE = 0,
|
||||
KEY_F1 = 1,
|
||||
KEY_F2 = 2,
|
||||
KEY_F3 = 3,
|
||||
KEY_F4 = 4,
|
||||
KEY_F5 = 5,
|
||||
KEY_F6 = 6,
|
||||
KEY_F7 = 7,
|
||||
KEY_F8 = 8,
|
||||
KEY_F9 = 9,
|
||||
KEY_F10 = 10,
|
||||
KEY_F11 = 11,
|
||||
KEY_F12 = 12,
|
||||
KEY_ESC = 13,
|
||||
KEY_ENTER = 14,
|
||||
KEY_BACKSPACE = 15,
|
||||
KEY_INSERT = 16,
|
||||
KEY_DELETE = 17,
|
||||
KEY_HOME = 18,
|
||||
KEY_END = 19,
|
||||
KEY_PGUP = 20,
|
||||
KEY_PGDOWN = 21,
|
||||
KEY_LEFT = 22,
|
||||
KEY_RIGHT = 23,
|
||||
KEY_UP = 24,
|
||||
KEY_DOWN = 25
|
||||
None = 0,
|
||||
F1 = 1,
|
||||
F2 = 2,
|
||||
F3 = 3,
|
||||
F4 = 4,
|
||||
F5 = 5,
|
||||
F6 = 6,
|
||||
F7 = 7,
|
||||
F8 = 8,
|
||||
F9 = 9,
|
||||
F10 = 10,
|
||||
F11 = 11,
|
||||
F12 = 12,
|
||||
Esc = 13,
|
||||
Enter = 14,
|
||||
Backspace = 15,
|
||||
Insert = 16,
|
||||
Delete = 17,
|
||||
Home = 18,
|
||||
End = 19,
|
||||
PgUp = 20,
|
||||
PgDown = 21,
|
||||
Left = 22,
|
||||
Right = 23,
|
||||
Up = 24,
|
||||
Down = 25
|
||||
};
|
||||
|
||||
enum EModifierKey
|
||||
enum class EModifierKey
|
||||
{
|
||||
MKEY_NONE = 0,
|
||||
MKEY_CTRL = 1<<0,
|
||||
MKEY_ALT = 1<<2,
|
||||
MKEY_SHIFT = 1<<3,
|
||||
MKEY_COMMAND = 1<<4
|
||||
None = 0,
|
||||
Ctrl = 1<<0,
|
||||
Alt = 1<<2,
|
||||
Shift = 1<<3,
|
||||
Command = 1<<4
|
||||
};
|
||||
|
||||
inline EModifierKey operator|(EModifierKey a, EModifierKey b)
|
||||
{
|
||||
using T = std::underlying_type_t<EModifierKey>;
|
||||
return EModifierKey(static_cast<T>(a) | static_cast<T>(b));
|
||||
}
|
||||
|
||||
inline EModifierKey operator&(EModifierKey a, EModifierKey b)
|
||||
{
|
||||
using T = std::underlying_type_t<EModifierKey>;
|
||||
return EModifierKey(static_cast<T>(a) & static_cast<T>(b));
|
||||
}
|
||||
|
||||
inline EModifierKey& operator|=(EModifierKey& a, const EModifierKey& b)
|
||||
{
|
||||
using T = std::underlying_type_t<EModifierKey>;
|
||||
a = EModifierKey(static_cast<T>(a) | static_cast<T>(b));
|
||||
return a;
|
||||
}
|
||||
|
||||
inline EModifierKey operator~(const EModifierKey& key)
|
||||
{
|
||||
using T = std::underlying_type_t<EModifierKey>;
|
||||
return EModifierKey(~static_cast<T>(key));
|
||||
}
|
||||
|
||||
class IWindowCallback
|
||||
{
|
||||
public:
|
||||
@@ -132,23 +157,35 @@ public:
|
||||
{}
|
||||
};
|
||||
|
||||
enum ETouchType
|
||||
enum class ETouchType
|
||||
{
|
||||
TOUCH_NONE = 0,
|
||||
TOUCH_DISPLAY = 1,
|
||||
TOUCH_TRACKPAD = 2
|
||||
None = 0,
|
||||
Display = 1,
|
||||
Trackpad = 2
|
||||
};
|
||||
|
||||
enum EWindowStyle
|
||||
enum class EWindowStyle
|
||||
{
|
||||
STYLE_NONE = 0,
|
||||
STYLE_TITLEBAR = 1<<0,
|
||||
STYLE_RESIZE = 1<<1,
|
||||
STYLE_CLOSE = 1<<2,
|
||||
None = 0,
|
||||
Titlebar = 1<<0,
|
||||
Resize = 1<<1,
|
||||
Close = 1<<2,
|
||||
|
||||
STYLE_DEFAULT = STYLE_TITLEBAR | STYLE_RESIZE | STYLE_CLOSE
|
||||
Default = Titlebar | Resize | Close
|
||||
};
|
||||
|
||||
inline EWindowStyle operator|(EWindowStyle a, EWindowStyle b)
|
||||
{
|
||||
using T = std::underlying_type_t<EWindowStyle>;
|
||||
return EWindowStyle(static_cast<T>(a) | static_cast<T>(b));
|
||||
}
|
||||
|
||||
inline EWindowStyle operator&(EWindowStyle a, EWindowStyle b)
|
||||
{
|
||||
using T = std::underlying_type_t<EWindowStyle>;
|
||||
return EWindowStyle(static_cast<T>(a) & static_cast<T>(b));
|
||||
}
|
||||
|
||||
class IWindow
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -3,6 +3,35 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#define ENABLE_BITWISE_ENUM(type)\
|
||||
inline type operator|(type a, type b)\
|
||||
{\
|
||||
using T = std::underlying_type_t<type>;\
|
||||
return type(static_cast<T>(a) | static_cast<T>(b));\
|
||||
}\
|
||||
inline type operator&(type a, type b)\
|
||||
{\
|
||||
using T = std::underlying_type_t<type>;\
|
||||
return type(static_cast<T>(a) & static_cast<T>(b));\
|
||||
}\
|
||||
inline type& operator|=(type& a, const type& b)\
|
||||
{\
|
||||
using T = std::underlying_type_t<type>;\
|
||||
a = type(static_cast<T>(a) | static_cast<T>(b));\
|
||||
return a;\
|
||||
}\
|
||||
inline type& operator&=(type& a, const type& b)\
|
||||
{\
|
||||
using T = std::underlying_type_t<type>;\
|
||||
a = type(static_cast<T>(a) & static_cast<T>(b));\
|
||||
return a;\
|
||||
}\
|
||||
inline type operator~(const type& key)\
|
||||
{\
|
||||
using T = std::underlying_type_t<type>;\
|
||||
return type(~static_cast<T>(key));\
|
||||
}
|
||||
|
||||
namespace boo
|
||||
{
|
||||
|
||||
@@ -28,4 +57,4 @@ template <class T>
|
||||
using ComPtr = Microsoft::WRL::ComPtr<T>;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -20,7 +20,7 @@ public:
|
||||
GLDataFactory(IGraphicsContext* parent);
|
||||
~GLDataFactory() {}
|
||||
|
||||
Platform platform() const {return PlatformOGL;}
|
||||
Platform platform() const {return Platform::OGL;}
|
||||
const SystemChar* platformName() const {return _S("OGL");}
|
||||
|
||||
IGraphicsBufferS* newStaticBuffer(BufferUse use, const void* data, size_t stride, size_t count);
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
|
||||
namespace boo
|
||||
{
|
||||
enum Primitive
|
||||
enum class Primitive
|
||||
{
|
||||
PrimitiveTriangles,
|
||||
PrimitiveTriStrips
|
||||
Triangles,
|
||||
TriStrips
|
||||
};
|
||||
|
||||
struct IGraphicsCommandQueue
|
||||
|
||||
@@ -35,32 +35,27 @@ protected:
|
||||
};
|
||||
|
||||
/** Supported buffer uses */
|
||||
enum BufferUse
|
||||
enum class BufferUse
|
||||
{
|
||||
BufferUseNull,
|
||||
BufferUseVertex,
|
||||
BufferUseIndex,
|
||||
BufferUseUniform
|
||||
Null,
|
||||
Vertex,
|
||||
Index,
|
||||
Uniform
|
||||
};
|
||||
|
||||
enum TextureType
|
||||
enum class TextureType
|
||||
{
|
||||
TextureStatic,
|
||||
Texture
|
||||
Static,
|
||||
Dynamic,
|
||||
Render
|
||||
};
|
||||
|
||||
struct ITexture
|
||||
{
|
||||
enum Type
|
||||
{
|
||||
TextureStatic,
|
||||
TextureDynamic,
|
||||
TextureRender
|
||||
};
|
||||
Type type() const {return m_type;}
|
||||
TextureType type() const {return m_type;}
|
||||
protected:
|
||||
Type m_type;
|
||||
ITexture(Type type) : m_type(type) {}
|
||||
TextureType m_type;
|
||||
ITexture(TextureType type) : m_type(type) {}
|
||||
virtual ~ITexture() {}
|
||||
};
|
||||
|
||||
@@ -68,7 +63,7 @@ protected:
|
||||
struct ITextureS : ITexture
|
||||
{
|
||||
protected:
|
||||
ITextureS() : ITexture(TextureStatic) {}
|
||||
ITextureS() : ITexture(TextureType::Static) {}
|
||||
};
|
||||
|
||||
/** Dynamic resource buffer for textures */
|
||||
@@ -78,22 +73,22 @@ struct ITextureD : ITexture
|
||||
virtual void* map(size_t sz)=0;
|
||||
virtual void unmap()=0;
|
||||
protected:
|
||||
ITextureD() : ITexture(TextureDynamic) {}
|
||||
ITextureD() : ITexture(TextureType::Dynamic) {}
|
||||
};
|
||||
|
||||
/** Resource buffer for render-target textures */
|
||||
struct ITextureR : ITexture
|
||||
{
|
||||
protected:
|
||||
ITextureR() : ITexture(TextureRender) {}
|
||||
ITextureR() : ITexture(TextureType::Render) {}
|
||||
};
|
||||
|
||||
/** Supported texture formats */
|
||||
enum TextureFormat
|
||||
enum class TextureFormat
|
||||
{
|
||||
TextureFormatRGBA8,
|
||||
TextureFormatDXT1,
|
||||
TextureFormatPVRTC4
|
||||
RGBA8,
|
||||
DXT1,
|
||||
PVRTC4
|
||||
};
|
||||
|
||||
/** Opaque token for representing the data layout of a vertex
|
||||
@@ -102,13 +97,13 @@ enum TextureFormat
|
||||
struct IVertexFormat {};
|
||||
|
||||
/** Types of vertex attributes */
|
||||
enum VertexSemantic
|
||||
enum class VertexSemantic
|
||||
{
|
||||
VertexSemanticPosition,
|
||||
VertexSemanticNormal,
|
||||
VertexSemanticColor,
|
||||
VertexSemanticUV,
|
||||
VertexSemanticWeight
|
||||
Position,
|
||||
Normal,
|
||||
Color,
|
||||
UV,
|
||||
Weight
|
||||
};
|
||||
|
||||
/** Used to create IVertexFormat */
|
||||
@@ -140,18 +135,18 @@ struct IGraphicsData
|
||||
};
|
||||
|
||||
/** Used by platform shader pipeline constructors */
|
||||
enum BlendFactor
|
||||
enum class BlendFactor
|
||||
{
|
||||
BlendFactorZero,
|
||||
BlendFactorOne,
|
||||
BlendFactorSrcColor,
|
||||
BlendFactorInvSrcColor,
|
||||
BlendFactorDstColor,
|
||||
BlendFactorInvDstColor,
|
||||
BlendFactorSrcAlpha,
|
||||
BlendFactorInvSrcAlpha,
|
||||
BlendFactorDstAlpha,
|
||||
BlendFactorInvDstAlpha
|
||||
Zero,
|
||||
One,
|
||||
SrcColor,
|
||||
InvSrcColor,
|
||||
DstColor,
|
||||
InvDstColor,
|
||||
SrcAlpha,
|
||||
InvSrcAlpha,
|
||||
DstAlpha,
|
||||
InvDstAlpha
|
||||
};
|
||||
|
||||
/** Factory object for creating batches of resources as an IGraphicsData token */
|
||||
@@ -159,15 +154,15 @@ struct IGraphicsDataFactory
|
||||
{
|
||||
virtual ~IGraphicsDataFactory() {}
|
||||
|
||||
enum Platform
|
||||
enum class Platform
|
||||
{
|
||||
PlatformNull,
|
||||
PlatformOGL,
|
||||
PlatformD3D11,
|
||||
PlatformD3D12,
|
||||
PlatformMetal,
|
||||
PlatformGX,
|
||||
PlatformGX2
|
||||
Null,
|
||||
OGL,
|
||||
D3D11,
|
||||
D3D12,
|
||||
Metal,
|
||||
GX,
|
||||
GX2
|
||||
};
|
||||
virtual Platform platform() const=0;
|
||||
virtual const SystemChar* platformName() const=0;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "../System.hpp"
|
||||
|
||||
namespace boo
|
||||
{
|
||||
|
||||
@@ -11,16 +11,16 @@ namespace boo
|
||||
class DeviceToken
|
||||
{
|
||||
public:
|
||||
enum TDeviceType
|
||||
enum class DeviceType
|
||||
{
|
||||
DEVTYPE_NONE = 0,
|
||||
DEVTYPE_USB = 1,
|
||||
DEVTYPE_BLUETOOTH = 2,
|
||||
DEVTYPE_GENERICHID = 3
|
||||
None = 0,
|
||||
USB = 1,
|
||||
Bluetooth = 2,
|
||||
GenericHID = 3
|
||||
};
|
||||
|
||||
private:
|
||||
TDeviceType m_devType;
|
||||
DeviceType m_devType;
|
||||
unsigned m_vendorId;
|
||||
unsigned m_productId;
|
||||
std::string m_vendorName;
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
m_devPath(other.m_devPath),
|
||||
m_connectedDev(other.m_connectedDev)
|
||||
{}
|
||||
inline DeviceToken(enum TDeviceType devType, unsigned vid, unsigned pid, const char* vname, const char* pname, const char* path)
|
||||
inline DeviceToken(DeviceType devType, unsigned vid, unsigned pid, const char* vname, const char* pname, const char* path)
|
||||
: m_devType(devType),
|
||||
m_vendorId(vid),
|
||||
m_productId(pid),
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
m_productName = pname;
|
||||
}
|
||||
|
||||
inline TDeviceType getDeviceType() const {return m_devType;}
|
||||
inline DeviceType getDeviceType() const {return m_devType;}
|
||||
inline unsigned getVendorId() const {return m_vendorId;}
|
||||
inline unsigned getProductId() const {return m_productId;}
|
||||
inline const std::string& getVendorName() const {return m_vendorName;}
|
||||
|
||||
@@ -7,28 +7,30 @@
|
||||
namespace boo
|
||||
{
|
||||
|
||||
enum EDolphinControllerType
|
||||
enum class EDolphinControllerType
|
||||
{
|
||||
DOL_TYPE_NONE = 0,
|
||||
DOL_TYPE_NORMAL = 0x10,
|
||||
DOL_TYPE_WAVEBIRD = 0x20,
|
||||
None = 0,
|
||||
Normal = 0x10,
|
||||
Wavebird = 0x20,
|
||||
};
|
||||
ENABLE_BITWISE_ENUM(EDolphinControllerType)
|
||||
|
||||
enum EDolphinControllerButtons
|
||||
enum class EDolphinControllerButtons
|
||||
{
|
||||
DOL_START = 1<<0,
|
||||
DOL_Z = 1<<1,
|
||||
DOL_L = 1<<2,
|
||||
DOL_R = 1<<3,
|
||||
DOL_A = 1<<8,
|
||||
DOL_B = 1<<9,
|
||||
DOL_X = 1<<10,
|
||||
DOL_Y = 1<<11,
|
||||
DOL_LEFT = 1<<12,
|
||||
DOL_RIGHT = 1<<13,
|
||||
DOL_DOWN = 1<<14,
|
||||
DOL_UP = 1<<15
|
||||
Start = 1<<0,
|
||||
Z = 1<<1,
|
||||
L = 1<<2,
|
||||
R = 1<<3,
|
||||
A = 1<<8,
|
||||
B = 1<<9,
|
||||
X = 1<<10,
|
||||
Y = 1<<11,
|
||||
Left = 1<<12,
|
||||
Right = 1<<13,
|
||||
Down = 1<<14,
|
||||
Up = 1<<15
|
||||
};
|
||||
ENABLE_BITWISE_ENUM(EDolphinControllerButtons)
|
||||
|
||||
struct DolphinControllerState
|
||||
{
|
||||
|
||||
@@ -39,40 +39,43 @@ union DualshockOutReport
|
||||
uint8_t buf[36];
|
||||
};
|
||||
|
||||
enum EDualshockPadButtons
|
||||
enum class EDualshockPadButtons
|
||||
{
|
||||
DS3_SELECT = 1<< 0,
|
||||
DS3_L3 = 1<< 1,
|
||||
DS3_R3 = 1<< 2,
|
||||
DS3_START = 1<< 3,
|
||||
DS3_UP = 1<< 4,
|
||||
DS3_RIGHT = 1<< 5,
|
||||
DS3_DOWN = 1<< 6,
|
||||
DS3_LEFT = 1<< 7,
|
||||
DS3_L2 = 1<< 8,
|
||||
DS3_R2 = 1<< 9,
|
||||
DS3_L1 = 1<<10,
|
||||
DS3_R1 = 1<<11,
|
||||
DS3_TRIANGLE = 1<<12,
|
||||
DS3_CIRCLE = 1<<13,
|
||||
DS3_CROSS = 1<<14,
|
||||
DS3_SQUARE = 1<<15
|
||||
Select = 1<< 0,
|
||||
L3 = 1<< 1,
|
||||
R3 = 1<< 2,
|
||||
Start = 1<< 3,
|
||||
Up = 1<< 4,
|
||||
Right = 1<< 5,
|
||||
Down = 1<< 6,
|
||||
Left = 1<< 7,
|
||||
L2 = 1<< 8,
|
||||
R2 = 1<< 9,
|
||||
L1 = 1<<10,
|
||||
R1 = 1<<11,
|
||||
Triangle = 1<<12,
|
||||
Circle = 1<<13,
|
||||
Cross = 1<<14,
|
||||
Square = 1<<15
|
||||
};
|
||||
|
||||
enum EDualshockMotor : int
|
||||
enum class EDualshockMotor : uint8_t
|
||||
{
|
||||
DS3_MOTOR_RIGHT = 1<<0,
|
||||
DS3_MOTOR_LEFT = 1<<1,
|
||||
None = 0,
|
||||
Right = 1<<0,
|
||||
Left = 1<<1,
|
||||
};
|
||||
ENABLE_BITWISE_ENUM(EDualshockMotor)
|
||||
|
||||
enum EDualshockLED
|
||||
enum class EDualshockLED
|
||||
{
|
||||
DS3_LED_OFF = 0,
|
||||
DS3_LED_1 = 1<<1,
|
||||
DS3_LED_2 = 1<<2,
|
||||
DS3_LED_3 = 1<<3,
|
||||
DS3_LED_4 = 1<<4
|
||||
LED_OFF = 0,
|
||||
LED_1 = 1<<1,
|
||||
LED_2 = 1<<2,
|
||||
LED_3 = 1<<3,
|
||||
LED_4 = 1<<4
|
||||
};
|
||||
ENABLE_BITWISE_ENUM(EDualshockLED)
|
||||
|
||||
struct DualshockPadState
|
||||
{
|
||||
@@ -120,11 +123,11 @@ struct IDualshockPadCallback
|
||||
class DualshockPad final : public DeviceBase
|
||||
{
|
||||
IDualshockPadCallback* m_callback;
|
||||
uint8_t m_rumbleRequest;
|
||||
uint8_t m_rumbleState;
|
||||
EDualshockMotor m_rumbleRequest;
|
||||
EDualshockMotor m_rumbleState;
|
||||
uint8_t m_rumbleDuration[2];
|
||||
uint8_t m_rumbleIntensity[2];
|
||||
uint8_t m_led;
|
||||
EDualshockLED m_led;
|
||||
DualshockOutReport m_report;
|
||||
uint8_t m_btAddress[6];
|
||||
void deviceDisconnected();
|
||||
@@ -135,45 +138,45 @@ public:
|
||||
DualshockPad(DeviceToken* token);
|
||||
~DualshockPad();
|
||||
|
||||
inline void setCallback(IDualshockPadCallback* cb)
|
||||
void setCallback(IDualshockPadCallback* cb)
|
||||
{ m_callback = cb; if (m_callback) m_callback->ctrl = this; }
|
||||
|
||||
inline void startRumble(int motor, uint8_t duration = 254, uint8_t intensity=255)
|
||||
void startRumble(EDualshockMotor motor, uint8_t duration = 254, uint8_t intensity=255)
|
||||
{
|
||||
m_rumbleRequest |= motor;
|
||||
if (motor & DS3_MOTOR_LEFT)
|
||||
if ((EDualshockMotor(motor) & EDualshockMotor::Left) != EDualshockMotor::None)
|
||||
{
|
||||
m_rumbleDuration[0] = duration;
|
||||
m_rumbleIntensity[0] = intensity;
|
||||
}
|
||||
if (motor & DS3_MOTOR_RIGHT)
|
||||
if ((EDualshockMotor(motor) & EDualshockMotor::Right) != EDualshockMotor::None)
|
||||
{
|
||||
m_rumbleDuration[1] = duration;
|
||||
m_rumbleIntensity[1] = intensity;
|
||||
}
|
||||
}
|
||||
|
||||
inline void stopRumble(int motor)
|
||||
void stopRumble(int motor)
|
||||
{
|
||||
m_rumbleRequest &= ~motor;
|
||||
m_rumbleRequest &= ~EDualshockMotor(motor);
|
||||
}
|
||||
|
||||
inline int getLED()
|
||||
EDualshockLED getLED()
|
||||
{
|
||||
return m_led;
|
||||
}
|
||||
|
||||
inline void setLED(int led, bool on = true)
|
||||
void setLED(EDualshockLED led, bool on = true)
|
||||
{
|
||||
if (on)
|
||||
m_led |= led;
|
||||
else
|
||||
m_led &= ~led;
|
||||
|
||||
setRawLED(led);
|
||||
setRawLED(int(led));
|
||||
}
|
||||
|
||||
inline void setRawLED(int led)
|
||||
void setRawLED(int led)
|
||||
{
|
||||
m_report.leds = led;
|
||||
sendHIDReport(m_report.buf, sizeof(m_report), 0x0201);
|
||||
|
||||
Reference in New Issue
Block a user