mirror of https://github.com/AxioDL/boo.git
Major scoped-enum refactor
This commit is contained in:
parent
62fae60042
commit
c9edf8dd85
|
@ -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
|
||||
{
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -40,7 +40,7 @@ class GLGraphicsBufferS : public IGraphicsBufferS
|
|||
GLenum m_target;
|
||||
GLGraphicsBufferS(BufferUse use, const void* data, size_t sz)
|
||||
{
|
||||
m_target = USE_TABLE[use];
|
||||
m_target = USE_TABLE[int(use)];
|
||||
glGenBuffers(1, &m_buf);
|
||||
glBindBuffer(m_target, m_buf);
|
||||
glBufferData(m_target, sz, data, GL_STATIC_DRAW);
|
||||
|
@ -68,7 +68,7 @@ class GLGraphicsBufferD : public IGraphicsBufferD
|
|||
GLGraphicsBufferD(GLCommandQueue* q, BufferUse use)
|
||||
: m_q(q)
|
||||
{
|
||||
m_target = USE_TABLE[use];
|
||||
m_target = USE_TABLE[int(use)];
|
||||
glGenBuffers(3, m_bufs);
|
||||
}
|
||||
public:
|
||||
|
@ -105,7 +105,7 @@ class GLTextureS : public ITextureS
|
|||
friend class GLDataFactory;
|
||||
GLuint m_tex;
|
||||
GLTextureS(size_t width, size_t height, size_t mips,
|
||||
TextureFormat fmt, const void* data, size_t sz)
|
||||
TextureFormat fmt, const void* data, size_t sz)
|
||||
{
|
||||
const uint8_t* dataIt = static_cast<const uint8_t*>(data);
|
||||
glGenTextures(1, &m_tex);
|
||||
|
@ -115,7 +115,7 @@ class GLTextureS : public ITextureS
|
|||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
|
||||
else
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
if (fmt == TextureFormatRGBA8)
|
||||
if (fmt == TextureFormat::RGBA8)
|
||||
{
|
||||
for (size_t i=0 ; i<mips ; ++i)
|
||||
{
|
||||
|
@ -326,8 +326,8 @@ IShaderPipeline* GLDataFactory::newShaderPipeline
|
|||
Log.report(LogVisor::Error, "unable to create shader objects\n");
|
||||
return nullptr;
|
||||
}
|
||||
shader.m_sfactor = BLEND_FACTOR_TABLE[srcFac];
|
||||
shader.m_dfactor = BLEND_FACTOR_TABLE[dstFac];
|
||||
shader.m_sfactor = BLEND_FACTOR_TABLE[int(srcFac)];
|
||||
shader.m_dfactor = BLEND_FACTOR_TABLE[int(dstFac)];
|
||||
shader.m_depthTest = depthTest;
|
||||
shader.m_depthWrite = depthWrite;
|
||||
shader.m_backfaceCulling = backfaceCulling;
|
||||
|
@ -456,9 +456,9 @@ struct GLShaderDataBinding : IShaderDataBinding
|
|||
for (size_t i=0 ; i<m_texCount ; ++i)
|
||||
{
|
||||
ITexture* tex = m_texs[i];
|
||||
if (tex->type() == ITexture::TextureDynamic)
|
||||
if (tex->type() == TextureType::Dynamic)
|
||||
static_cast<GLTextureD*>(tex)->bind(i);
|
||||
else if (tex->type() == ITexture::TextureStatic)
|
||||
else if (tex->type() == TextureType::Static)
|
||||
static_cast<GLTextureS*>(tex)->bind(i);
|
||||
}
|
||||
}
|
||||
|
@ -541,25 +541,25 @@ static const GLenum SEMANTIC_TYPE_TABLE[] =
|
|||
|
||||
struct GLCommandQueue : IGraphicsCommandQueue
|
||||
{
|
||||
Platform platform() const {return IGraphicsDataFactory::PlatformOGL;}
|
||||
Platform platform() const {return IGraphicsDataFactory::Platform::OGL;}
|
||||
const SystemChar* platformName() const {return _S("OGL");}
|
||||
IGraphicsContext* m_parent = nullptr;
|
||||
|
||||
struct Command
|
||||
{
|
||||
enum Op
|
||||
enum class Op
|
||||
{
|
||||
OpSetShaderDataBinding,
|
||||
OpSetRenderTarget,
|
||||
OpSetViewport,
|
||||
OpSetClearColor,
|
||||
OpClearTarget,
|
||||
OpSetDrawPrimitive,
|
||||
OpDraw,
|
||||
OpDrawIndexed,
|
||||
OpDrawInstances,
|
||||
OpDrawInstancesIndexed,
|
||||
OpPresent
|
||||
SetShaderDataBinding,
|
||||
SetRenderTarget,
|
||||
SetViewport,
|
||||
SetClearColor,
|
||||
ClearTarget,
|
||||
SetDrawPrimitive,
|
||||
Draw,
|
||||
DrawIndexed,
|
||||
DrawInstances,
|
||||
DrawInstancesIndexed,
|
||||
Present
|
||||
} m_op;
|
||||
union
|
||||
{
|
||||
|
@ -614,7 +614,7 @@ struct GLCommandQueue : IGraphicsCommandQueue
|
|||
for (size_t i=0 ; i<fmt->m_elementCount ; ++i)
|
||||
{
|
||||
const VertexElementDescriptor* desc = &fmt->m_elements[i];
|
||||
stride += SEMANTIC_SIZE_TABLE[desc->semantic];
|
||||
stride += SEMANTIC_SIZE_TABLE[int(desc->semantic)];
|
||||
}
|
||||
|
||||
size_t offset = 0;
|
||||
|
@ -641,9 +641,9 @@ struct GLCommandQueue : IGraphicsCommandQueue
|
|||
static_cast<const GLGraphicsBufferS*>(lastEBO)->bindIndex();
|
||||
}
|
||||
glEnableVertexAttribArray(i);
|
||||
glVertexAttribPointer(i, SEMANTIC_COUNT_TABLE[desc->semantic],
|
||||
SEMANTIC_TYPE_TABLE[desc->semantic], GL_TRUE, stride, (void*)offset);
|
||||
offset += SEMANTIC_SIZE_TABLE[desc->semantic];
|
||||
glVertexAttribPointer(i, SEMANTIC_COUNT_TABLE[int(desc->semantic)],
|
||||
SEMANTIC_TYPE_TABLE[int(desc->semantic)], GL_TRUE, stride, (void*)offset);
|
||||
offset += SEMANTIC_SIZE_TABLE[int(desc->semantic)];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -715,10 +715,10 @@ struct GLCommandQueue : IGraphicsCommandQueue
|
|||
{
|
||||
switch (cmd.m_op)
|
||||
{
|
||||
case Command::OpSetShaderDataBinding:
|
||||
case Command::Op::SetShaderDataBinding:
|
||||
static_cast<const GLShaderDataBinding*>(cmd.binding)->bind();
|
||||
break;
|
||||
case Command::OpSetRenderTarget:
|
||||
case Command::Op::SetRenderTarget:
|
||||
{
|
||||
const GLTextureR* tex = static_cast<const GLTextureR*>(cmd.target);
|
||||
if (!tex)
|
||||
|
@ -727,32 +727,32 @@ struct GLCommandQueue : IGraphicsCommandQueue
|
|||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, tex->m_fbo);
|
||||
break;
|
||||
}
|
||||
case Command::OpSetViewport:
|
||||
case Command::Op::SetViewport:
|
||||
glViewport(cmd.rect.location[0], cmd.rect.location[1],
|
||||
cmd.rect.size[0], cmd.rect.size[1]);
|
||||
break;
|
||||
case Command::OpSetClearColor:
|
||||
case Command::Op::SetClearColor:
|
||||
glClearColor(cmd.rgba[0], cmd.rgba[1], cmd.rgba[2], cmd.rgba[3]);
|
||||
break;
|
||||
case Command::OpClearTarget:
|
||||
case Command::Op::ClearTarget:
|
||||
glClear(cmd.flags);
|
||||
break;
|
||||
case Command::OpSetDrawPrimitive:
|
||||
case Command::Op::SetDrawPrimitive:
|
||||
prim = cmd.prim;
|
||||
break;
|
||||
case Command::OpDraw:
|
||||
case Command::Op::Draw:
|
||||
glDrawArrays(prim, cmd.start, cmd.count);
|
||||
break;
|
||||
case Command::OpDrawIndexed:
|
||||
case Command::Op::DrawIndexed:
|
||||
glDrawElements(prim, cmd.count, GL_UNSIGNED_INT, (void*)cmd.start);
|
||||
break;
|
||||
case Command::OpDrawInstances:
|
||||
case Command::Op::DrawInstances:
|
||||
glDrawArraysInstanced(prim, cmd.start, cmd.count, cmd.instCount);
|
||||
break;
|
||||
case Command::OpDrawInstancesIndexed:
|
||||
case Command::Op::DrawInstancesIndexed:
|
||||
glDrawElementsInstanced(prim, cmd.count, GL_UNSIGNED_INT, (void*)cmd.start, cmd.instCount);
|
||||
break;
|
||||
case Command::OpPresent:
|
||||
case Command::Op::Present:
|
||||
{
|
||||
const GLTextureR* tex = static_cast<const GLTextureR*>(cmd.source);
|
||||
if (tex)
|
||||
|
@ -791,21 +791,21 @@ struct GLCommandQueue : IGraphicsCommandQueue
|
|||
void setShaderDataBinding(IShaderDataBinding* binding)
|
||||
{
|
||||
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
||||
cmds.emplace_back(Command::OpSetShaderDataBinding);
|
||||
cmds.emplace_back(Command::Op::SetShaderDataBinding);
|
||||
cmds.back().binding = binding;
|
||||
}
|
||||
|
||||
void setRenderTarget(ITextureR* target)
|
||||
{
|
||||
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
||||
cmds.emplace_back(Command::OpSetRenderTarget);
|
||||
cmds.emplace_back(Command::Op::SetRenderTarget);
|
||||
cmds.back().target = target;
|
||||
}
|
||||
|
||||
void setViewport(const SWindowRect& rect)
|
||||
{
|
||||
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
||||
cmds.emplace_back(Command::OpSetViewport);
|
||||
cmds.emplace_back(Command::Op::SetViewport);
|
||||
cmds.back().rect = rect;
|
||||
}
|
||||
|
||||
|
@ -824,7 +824,7 @@ struct GLCommandQueue : IGraphicsCommandQueue
|
|||
void setClearColor(const float rgba[4])
|
||||
{
|
||||
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
||||
cmds.emplace_back(Command::OpSetClearColor);
|
||||
cmds.emplace_back(Command::Op::SetClearColor);
|
||||
cmds.back().rgba[0] = rgba[0];
|
||||
cmds.back().rgba[1] = rgba[1];
|
||||
cmds.back().rgba[2] = rgba[2];
|
||||
|
@ -834,7 +834,7 @@ struct GLCommandQueue : IGraphicsCommandQueue
|
|||
void clearTarget(bool render=true, bool depth=true)
|
||||
{
|
||||
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
||||
cmds.emplace_back(Command::OpClearTarget);
|
||||
cmds.emplace_back(Command::Op::ClearTarget);
|
||||
cmds.back().flags = 0;
|
||||
if (render)
|
||||
cmds.back().flags |= GL_COLOR_BUFFER_BIT;
|
||||
|
@ -845,17 +845,17 @@ struct GLCommandQueue : IGraphicsCommandQueue
|
|||
void setDrawPrimitive(Primitive prim)
|
||||
{
|
||||
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
||||
cmds.emplace_back(Command::OpSetDrawPrimitive);
|
||||
if (prim == PrimitiveTriangles)
|
||||
cmds.emplace_back(Command::Op::SetDrawPrimitive);
|
||||
if (prim == Primitive::Triangles)
|
||||
cmds.back().prim = GL_TRIANGLES;
|
||||
else if (prim == PrimitiveTriStrips)
|
||||
else if (prim == Primitive::TriStrips)
|
||||
cmds.back().prim = GL_TRIANGLE_STRIP;
|
||||
}
|
||||
|
||||
void draw(size_t start, size_t count)
|
||||
{
|
||||
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
||||
cmds.emplace_back(Command::OpDraw);
|
||||
cmds.emplace_back(Command::Op::Draw);
|
||||
cmds.back().start = start;
|
||||
cmds.back().count = count;
|
||||
}
|
||||
|
@ -863,7 +863,7 @@ struct GLCommandQueue : IGraphicsCommandQueue
|
|||
void drawIndexed(size_t start, size_t count)
|
||||
{
|
||||
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
||||
cmds.emplace_back(Command::OpDrawIndexed);
|
||||
cmds.emplace_back(Command::Op::DrawIndexed);
|
||||
cmds.back().start = start;
|
||||
cmds.back().count = count;
|
||||
}
|
||||
|
@ -871,7 +871,7 @@ struct GLCommandQueue : IGraphicsCommandQueue
|
|||
void drawInstances(size_t start, size_t count, size_t instCount)
|
||||
{
|
||||
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
||||
cmds.emplace_back(Command::OpDrawInstances);
|
||||
cmds.emplace_back(Command::Op::DrawInstances);
|
||||
cmds.back().start = start;
|
||||
cmds.back().count = count;
|
||||
cmds.back().instCount = instCount;
|
||||
|
@ -880,7 +880,7 @@ struct GLCommandQueue : IGraphicsCommandQueue
|
|||
void drawInstancesIndexed(size_t start, size_t count, size_t instCount)
|
||||
{
|
||||
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
||||
cmds.emplace_back(Command::OpDrawInstancesIndexed);
|
||||
cmds.emplace_back(Command::Op::DrawInstancesIndexed);
|
||||
cmds.back().start = start;
|
||||
cmds.back().count = count;
|
||||
cmds.back().instCount = instCount;
|
||||
|
@ -889,7 +889,7 @@ struct GLCommandQueue : IGraphicsCommandQueue
|
|||
void resolveDisplay(ITextureR* source)
|
||||
{
|
||||
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
||||
cmds.emplace_back(Command::OpPresent);
|
||||
cmds.emplace_back(Command::Op::Present);
|
||||
cmds.back().source = source;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ extern const DeviceSignature BOO_DEVICE_SIGS[];
|
|||
|
||||
bool DeviceSignature::DeviceMatchToken(const DeviceToken& token, const TDeviceSignatureSet& sigSet)
|
||||
{
|
||||
if (token.getDeviceType() == DeviceToken::DEVTYPE_GENERICHID)
|
||||
if (token.getDeviceType() == DeviceToken::DeviceType::GenericHID)
|
||||
return true;
|
||||
for (const DeviceSignature* sig : sigSet)
|
||||
{
|
||||
|
@ -27,7 +27,7 @@ DeviceBase* DeviceSignature::DeviceNew(DeviceToken& token)
|
|||
DeviceBase* retval = NULL;
|
||||
|
||||
/* Early-return for generic HID devices */
|
||||
if (token.getDeviceType() == DeviceToken::DEVTYPE_GENERICHID)
|
||||
if (token.getDeviceType() == DeviceToken::DeviceType::GenericHID)
|
||||
{
|
||||
retval = new GenericPad(&token);
|
||||
if (!retval)
|
||||
|
|
|
@ -20,14 +20,15 @@ DolphinSmashAdapter::~DolphinSmashAdapter()
|
|||
|
||||
static inline EDolphinControllerType parseType(unsigned char status)
|
||||
{
|
||||
unsigned char type = status & (DOL_TYPE_NORMAL | DOL_TYPE_WAVEBIRD);
|
||||
EDolphinControllerType type = EDolphinControllerType(status) &
|
||||
(EDolphinControllerType::Normal | EDolphinControllerType::Wavebird);
|
||||
switch (type)
|
||||
{
|
||||
case DOL_TYPE_NORMAL:
|
||||
case DOL_TYPE_WAVEBIRD:
|
||||
return (EDolphinControllerType)type;
|
||||
case EDolphinControllerType::Normal:
|
||||
case EDolphinControllerType::Wavebird:
|
||||
return type;
|
||||
default:
|
||||
return DOL_TYPE_NONE;
|
||||
return EDolphinControllerType::None;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,12 +78,12 @@ void DolphinSmashAdapter::transferCycle()
|
|||
DolphinControllerState state;
|
||||
bool rumble = false;
|
||||
EDolphinControllerType type = parseState(&state, controller, rumble);
|
||||
if (type && !(m_knownControllers & 1<<i))
|
||||
if (type != EDolphinControllerType::None && !(m_knownControllers & 1<<i))
|
||||
{
|
||||
m_knownControllers |= 1<<i;
|
||||
m_callback->controllerConnected(i, type);
|
||||
}
|
||||
else if (!type && (m_knownControllers & 1<<i))
|
||||
else if (type == EDolphinControllerType::None && (m_knownControllers & 1<<i))
|
||||
{
|
||||
m_knownControllers &= ~(1<<i);
|
||||
m_callback->controllerDisconnected(i);
|
||||
|
|
|
@ -49,8 +49,8 @@ static const uint8_t defaultReport[35] = {
|
|||
DualshockPad::DualshockPad(DeviceToken* token)
|
||||
: DeviceBase(token),
|
||||
m_callback(nullptr),
|
||||
m_rumbleRequest(0),
|
||||
m_rumbleState(0)
|
||||
m_rumbleRequest(EDualshockMotor::None),
|
||||
m_rumbleState(EDualshockMotor::None)
|
||||
{
|
||||
memcpy(m_report.buf, defaultReport, 35);
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ void DualshockPad::transferCycle()
|
|||
|
||||
if (m_rumbleRequest != m_rumbleState)
|
||||
{
|
||||
if (m_rumbleRequest & DS3_MOTOR_LEFT)
|
||||
if ((m_rumbleRequest & EDualshockMotor::Left) != EDualshockMotor::None)
|
||||
{
|
||||
m_report.rumble.leftDuration = m_rumbleDuration[0];
|
||||
m_report.rumble.leftForce = m_rumbleIntensity[0];
|
||||
|
@ -107,7 +107,7 @@ void DualshockPad::transferCycle()
|
|||
m_report.rumble.leftForce = 0;
|
||||
}
|
||||
|
||||
if (m_rumbleRequest & DS3_MOTOR_RIGHT)
|
||||
if ((m_rumbleRequest & EDualshockMotor::Right) != EDualshockMotor::None)
|
||||
{
|
||||
m_report.rumble.rightDuration = m_rumbleDuration[0];
|
||||
m_report.rumble.rightOn = true;
|
||||
|
@ -123,9 +123,9 @@ void DualshockPad::transferCycle()
|
|||
else
|
||||
{
|
||||
if (state.m_reserved5[8] & 0x80)
|
||||
m_rumbleRequest &= ~DS3_MOTOR_RIGHT;
|
||||
m_rumbleRequest &= ~EDualshockMotor::Right;
|
||||
if (state.m_reserved5[7] & 0x01)
|
||||
m_rumbleRequest &= ~DS3_MOTOR_LEFT;
|
||||
m_rumbleRequest &= ~EDualshockMotor::Left;
|
||||
m_rumbleState = m_rumbleRequest;
|
||||
const double zeroG = 511.5; // 1.65/3.3*1023 (1,65V);
|
||||
float accXval = -((double)state.m_accelerometer[0] - zeroG);
|
||||
|
|
|
@ -243,12 +243,12 @@ public:
|
|||
{
|
||||
devImp.m_hidDev = this;
|
||||
std::unique_lock<std::mutex> lk(m_initMutex);
|
||||
DeviceToken::TDeviceType dType = token.getDeviceType();
|
||||
if (dType == DeviceToken::DEVTYPE_USB)
|
||||
DeviceToken::DeviceType dType = token.getDeviceType();
|
||||
if (dType == DeviceToken::DeviceType::USB)
|
||||
m_thread = new std::thread(_threadProcUSBLL, this);
|
||||
else if (dType == DeviceToken::DEVTYPE_BLUETOOTH)
|
||||
else if (dType == DeviceToken::DeviceType::Bluetooth)
|
||||
m_thread = new std::thread(_threadProcBTLL, this);
|
||||
else if (dType == DeviceToken::DEVTYPE_GENERICHID)
|
||||
else if (dType == DeviceToken::DeviceType::GenericHID)
|
||||
m_thread = new std::thread(_threadProcHID, this);
|
||||
else
|
||||
{
|
||||
|
|
|
@ -34,11 +34,11 @@ class HIDListenerUdev final : public IHIDListener
|
|||
|
||||
/* Filter to USB/BT */
|
||||
const char* dt = udev_device_get_devtype(device);
|
||||
DeviceToken::TDeviceType type;
|
||||
DeviceToken::DeviceType type;
|
||||
if (!strcmp(dt, "usb_device"))
|
||||
type = DeviceToken::DEVTYPE_USB;
|
||||
type = DeviceToken::DeviceType::USB;
|
||||
else if (!strcmp(dt, "bluetooth_device"))
|
||||
type = DeviceToken::DEVTYPE_BLUETOOTH;
|
||||
type = DeviceToken::DeviceType::Bluetooth;
|
||||
else
|
||||
return;
|
||||
|
||||
|
@ -82,9 +82,9 @@ class HIDListenerUdev final : public IHIDListener
|
|||
{
|
||||
/* Matched-insertion failed; see if generic HID interface is available */
|
||||
udev_list_entry* devInterfaces = nullptr;
|
||||
if (type == DeviceToken::DEVTYPE_USB)
|
||||
if (type == DeviceToken::DeviceType::USB)
|
||||
devInterfaces = udev_list_entry_get_by_name(attrs, "ID_USB_INTERFACES");
|
||||
else if (type == DeviceToken::DEVTYPE_BLUETOOTH)
|
||||
else if (type == DeviceToken::DeviceType::Bluetooth)
|
||||
devInterfaces = udev_list_entry_get_by_name(attrs, "ID_BLUETOOTH_INTERFACES");
|
||||
if (devInterfaces)
|
||||
{
|
||||
|
@ -101,7 +101,7 @@ class HIDListenerUdev final : public IHIDListener
|
|||
{
|
||||
const char* hidPath = udev_list_entry_get_name(hidEnt);
|
||||
if (!listener->m_finder._hasToken(hidPath))
|
||||
listener->m_finder._insertToken(DeviceToken(DeviceToken::DEVTYPE_GENERICHID,
|
||||
listener->m_finder._insertToken(DeviceToken(DeviceToken::DeviceType::GenericHID,
|
||||
vid, pid, manuf, product, hidPath));
|
||||
}
|
||||
udev_enumerate_unref(hidEnum);
|
||||
|
|
|
@ -58,10 +58,10 @@ int ApplicationRun(IApplication::EPlatformType platform,
|
|||
{
|
||||
if (APP)
|
||||
return 1;
|
||||
if (platform == IApplication::PLAT_WAYLAND)
|
||||
if (platform == IApplication::EPlatformType::Wayland)
|
||||
APP = new ApplicationWayland(cb, uniqueName, friendlyName, pname, args, singleInstance);
|
||||
else if (platform == IApplication::PLAT_XLIB ||
|
||||
platform == IApplication::PLAT_AUTO)
|
||||
else if (platform == IApplication::EPlatformType::Xlib ||
|
||||
platform == IApplication::EPlatformType::Auto)
|
||||
APP = new ApplicationXlib(cb, uniqueName, friendlyName, pname, args, singleInstance);
|
||||
else
|
||||
return 1;
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
|
||||
EPlatformType getPlatformType() const
|
||||
{
|
||||
return PLAT_WAYLAND;
|
||||
return EPlatformType::Wayland;
|
||||
}
|
||||
|
||||
int run()
|
||||
|
|
|
@ -220,7 +220,7 @@ public:
|
|||
|
||||
EPlatformType getPlatformType() const
|
||||
{
|
||||
return PLAT_XLIB;
|
||||
return EPlatformType::Xlib;
|
||||
}
|
||||
|
||||
/* Empty handler for SIGINT */
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "boo/IGraphicsContext.hpp"
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#undef None
|
||||
|
||||
namespace boo
|
||||
{
|
||||
|
@ -18,7 +19,7 @@ public:
|
|||
|
||||
GraphicsContextWayland(EGraphicsAPI api, IWindow* parentWindow)
|
||||
: m_api(api),
|
||||
m_pf(PF_RGBA8),
|
||||
m_pf(EPixelFormat::RGBA8),
|
||||
m_parentWindow(parentWindow)
|
||||
{}
|
||||
|
||||
|
@ -44,7 +45,7 @@ public:
|
|||
|
||||
void setPixelFormat(EPixelFormat pf)
|
||||
{
|
||||
if (pf > PF_RGBAF32_Z24)
|
||||
if (pf > EPixelFormat::RGBAF32_Z24)
|
||||
return;
|
||||
m_pf = pf;
|
||||
}
|
||||
|
@ -93,7 +94,7 @@ struct WindowWayland : IWindow
|
|||
GraphicsContextWayland m_gfxCtx;
|
||||
|
||||
WindowWayland(const std::string& title)
|
||||
: m_gfxCtx(IGraphicsContext::API_OPENGL_3_3, this)
|
||||
: m_gfxCtx(IGraphicsContext::EGraphicsAPI::OpenGL3_3, this)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -163,7 +164,7 @@ struct WindowWayland : IWindow
|
|||
|
||||
EWindowStyle getStyle() const
|
||||
{
|
||||
return STYLE_NONE;
|
||||
return EWindowStyle::None;
|
||||
}
|
||||
|
||||
bool isFullscreen() const
|
||||
|
@ -187,7 +188,7 @@ struct WindowWayland : IWindow
|
|||
|
||||
ETouchType getTouchType() const
|
||||
{
|
||||
return TOUCH_NONE;
|
||||
return ETouchType::None;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#define MWM_FUNC_MAXIMIZE (1L<<4)
|
||||
#define MWM_FUNC_CLOSE (1L<<5)
|
||||
|
||||
#undef None
|
||||
|
||||
typedef GLXContext (*glXCreateContextAttribsARBProc)(Display*, GLXFBConfig, GLXContext, Bool, const int*);
|
||||
static glXCreateContextAttribsARBProc glXCreateContextAttribsARB = 0;
|
||||
|
@ -54,7 +55,7 @@ static const int ContextAttribs[] =
|
|||
GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
|
||||
//GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_DEBUG_BIT_ARB,
|
||||
//GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,
|
||||
None
|
||||
0
|
||||
};
|
||||
|
||||
namespace boo
|
||||
|
@ -67,75 +68,78 @@ void GLXEnableVSync(Display* disp, GLXWindow drawable);
|
|||
|
||||
extern int XINPUT_OPCODE;
|
||||
|
||||
static uint32_t translateKeysym(KeySym sym, int& specialSym, int& modifierSym)
|
||||
static uint32_t translateKeysym(KeySym sym, ESpecialKey& specialSym, EModifierKey& modifierSym)
|
||||
{
|
||||
specialSym = KEY_NONE;
|
||||
modifierSym = MKEY_NONE;
|
||||
specialSym = ESpecialKey::None;
|
||||
modifierSym = EModifierKey::None;
|
||||
if (sym >= XK_F1 && sym <= XK_F12)
|
||||
specialSym = KEY_F1 + sym - XK_F1;
|
||||
specialSym = ESpecialKey(int(ESpecialKey::F1) + sym - XK_F1);
|
||||
else if (sym == XK_Escape)
|
||||
specialSym = KEY_ESC;
|
||||
specialSym = ESpecialKey::Esc;
|
||||
else if (sym == XK_Return)
|
||||
specialSym = KEY_ENTER;
|
||||
specialSym = ESpecialKey::Enter;
|
||||
else if (sym == XK_BackSpace)
|
||||
specialSym = KEY_BACKSPACE;
|
||||
specialSym = ESpecialKey::Backspace;
|
||||
else if (sym == XK_Insert)
|
||||
specialSym = KEY_INSERT;
|
||||
specialSym = ESpecialKey::Insert;
|
||||
else if (sym == XK_Delete)
|
||||
specialSym = KEY_DELETE;
|
||||
specialSym = ESpecialKey::Delete;
|
||||
else if (sym == XK_Home)
|
||||
specialSym = KEY_HOME;
|
||||
specialSym = ESpecialKey::Home;
|
||||
else if (sym == XK_End)
|
||||
specialSym = KEY_END;
|
||||
specialSym = ESpecialKey::End;
|
||||
else if (sym == XK_Page_Up)
|
||||
specialSym = KEY_PGUP;
|
||||
specialSym = ESpecialKey::PgUp;
|
||||
else if (sym == XK_Page_Down)
|
||||
specialSym = KEY_PGDOWN;
|
||||
specialSym = ESpecialKey::PgDown;
|
||||
else if (sym == XK_Left)
|
||||
specialSym = KEY_LEFT;
|
||||
specialSym = ESpecialKey::Left;
|
||||
else if (sym == XK_Right)
|
||||
specialSym = KEY_RIGHT;
|
||||
specialSym = ESpecialKey::Right;
|
||||
else if (sym == XK_Up)
|
||||
specialSym = KEY_UP;
|
||||
specialSym = ESpecialKey::Up;
|
||||
else if (sym == XK_Down)
|
||||
specialSym = KEY_DOWN;
|
||||
specialSym = ESpecialKey::Down;
|
||||
else if (sym == XK_Shift_L || sym == XK_Shift_R)
|
||||
modifierSym = MKEY_SHIFT;
|
||||
modifierSym = EModifierKey::Shift;
|
||||
else if (sym == XK_Control_L || sym == XK_Control_R)
|
||||
modifierSym = MKEY_CTRL;
|
||||
modifierSym = EModifierKey::Ctrl;
|
||||
else if (sym == XK_Alt_L || sym == XK_Alt_R)
|
||||
modifierSym = MKEY_ALT;
|
||||
modifierSym = EModifierKey::Alt;
|
||||
else
|
||||
return xkb_keysym_to_utf32(sym);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int translateModifiers(unsigned state)
|
||||
static EModifierKey translateModifiers(unsigned state)
|
||||
{
|
||||
int retval = 0;
|
||||
EModifierKey retval = EModifierKey::None;
|
||||
if (state & ShiftMask)
|
||||
retval |= MKEY_SHIFT;
|
||||
retval |= EModifierKey::Shift;
|
||||
if (state & ControlMask)
|
||||
retval |= MKEY_CTRL;
|
||||
retval |= EModifierKey::Ctrl;
|
||||
if (state & Mod1Mask)
|
||||
retval |= MKEY_ALT;
|
||||
retval |= EModifierKey::Alt;
|
||||
return retval;
|
||||
}
|
||||
|
||||
static int translateButton(unsigned detail)
|
||||
static EMouseButton translateButton(unsigned detail)
|
||||
{
|
||||
int retval = 0;
|
||||
if (detail == 1)
|
||||
retval = BUTTON_PRIMARY;
|
||||
else if (detail == 3)
|
||||
retval = BUTTON_SECONDARY;
|
||||
else if (detail == 2)
|
||||
retval = BUTTON_MIDDLE;
|
||||
else if (detail == 8)
|
||||
retval = BUTTON_AUX1;
|
||||
else if (detail == 9)
|
||||
retval = BUTTON_AUX2;
|
||||
return retval;
|
||||
switch (detail)
|
||||
{
|
||||
case 1:
|
||||
return EMouseButton::Primary;
|
||||
case 3:
|
||||
return EMouseButton::Secondary;
|
||||
case 2:
|
||||
return EMouseButton::Middle;
|
||||
case 8:
|
||||
return EMouseButton::Aux1;
|
||||
case 9:
|
||||
return EMouseButton::Aux2;
|
||||
default: break;
|
||||
}
|
||||
return EMouseButton::None;
|
||||
}
|
||||
|
||||
struct XCBAtoms
|
||||
|
@ -198,7 +202,7 @@ public:
|
|||
Display* display, int defaultScreen,
|
||||
GLXContext lastCtx, uint32_t& visualIdOut)
|
||||
: m_api(api),
|
||||
m_pf(PF_RGBA8_Z24),
|
||||
m_pf(EPixelFormat::RGBA8_Z24),
|
||||
m_parentWindow(parentWindow),
|
||||
m_xDisp(display),
|
||||
m_lastCtx(lastCtx)
|
||||
|
@ -228,25 +232,25 @@ public:
|
|||
if (!doubleBuffer)
|
||||
continue;
|
||||
|
||||
if (m_pf == PF_RGBA8 && colorSize >= 32)
|
||||
if (m_pf == EPixelFormat::RGBA8 && colorSize >= 32)
|
||||
{
|
||||
m_fbconfig = config;
|
||||
m_visualid = visualId;
|
||||
break;
|
||||
}
|
||||
else if (m_pf == PF_RGBA8_Z24 && colorSize >= 32 && depthSize >= 24)
|
||||
else if (m_pf == EPixelFormat::RGBA8_Z24 && colorSize >= 32 && depthSize >= 24)
|
||||
{
|
||||
m_fbconfig = config;
|
||||
m_visualid = visualId;
|
||||
break;
|
||||
}
|
||||
else if (m_pf == PF_RGBAF32 && colorSize >= 128)
|
||||
else if (m_pf == EPixelFormat::RGBAF32 && colorSize >= 128)
|
||||
{
|
||||
m_fbconfig = config;
|
||||
m_visualid = visualId;
|
||||
break;
|
||||
}
|
||||
else if (m_pf == PF_RGBAF32_Z24 && colorSize >= 128 && depthSize >= 24)
|
||||
else if (m_pf == EPixelFormat::RGBAF32_Z24 && colorSize >= 128 && depthSize >= 24)
|
||||
{
|
||||
m_fbconfig = config;
|
||||
m_visualid = visualId;
|
||||
|
@ -293,7 +297,7 @@ public:
|
|||
|
||||
void setPixelFormat(EPixelFormat pf)
|
||||
{
|
||||
if (pf > PF_RGBAF32_Z24)
|
||||
if (pf > EPixelFormat::RGBAF32_Z24)
|
||||
return;
|
||||
m_pf = pf;
|
||||
}
|
||||
|
@ -342,7 +346,7 @@ public:
|
|||
if (!vsyncDisp)
|
||||
Log.report(LogVisor::FatalError, "unable to open new vsync display");
|
||||
|
||||
static int attributeList[] = { GLX_RGBA, GLX_DOUBLEBUFFER, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, None };
|
||||
static int attributeList[] = { GLX_RGBA, GLX_DOUBLEBUFFER, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, 0 };
|
||||
XVisualInfo *vi = glXChooseVisual(vsyncDisp, DefaultScreen(vsyncDisp),attributeList);
|
||||
|
||||
vsyncCtx = glXCreateContext(vsyncDisp, vi, nullptr, True);
|
||||
|
@ -363,7 +367,7 @@ public:
|
|||
m_vsynccv.notify_one();
|
||||
}
|
||||
|
||||
glXMakeCurrent(vsyncDisp, None, nullptr);
|
||||
glXMakeCurrent(vsyncDisp, 0, nullptr);
|
||||
glXDestroyContext(vsyncDisp, vsyncCtx);
|
||||
XCloseDisplay(vsyncDisp);
|
||||
});
|
||||
|
@ -448,7 +452,7 @@ class WindowXlib : public IWindow
|
|||
|
||||
/* Last known input device id (0xffff if not yet set) */
|
||||
int m_lastInputID = 0xffff;
|
||||
ETouchType m_touchType = TOUCH_NONE;
|
||||
ETouchType m_touchType = ETouchType::None;
|
||||
|
||||
/* Scroll valuators */
|
||||
int m_hScrollValuator = -1;
|
||||
|
@ -470,7 +474,7 @@ public:
|
|||
Display* display, int defaultScreen,
|
||||
GLXContext lastCtx)
|
||||
: m_xDisp(display), m_callback(nullptr),
|
||||
m_gfxCtx(IGraphicsContext::API_OPENGL_3_3,
|
||||
m_gfxCtx(IGraphicsContext::EGraphicsAPI::OpenGL3_3,
|
||||
this, display, defaultScreen,
|
||||
lastCtx, m_visualId)
|
||||
{
|
||||
|
@ -504,7 +508,7 @@ public:
|
|||
genFrameDefault(screen, x, y, w, h);
|
||||
XSetWindowAttributes swa;
|
||||
swa.colormap = m_colormapId;
|
||||
swa.border_pixmap = None;
|
||||
swa.border_pixmap = 0;
|
||||
swa.event_mask = FocusChangeMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask | ExposureMask | StructureNotifyMask | LeaveWindowMask | EnterWindowMask;
|
||||
|
||||
m_windowId = XCreateWindow(display, screen->root, x, y, w, h, 10,
|
||||
|
@ -538,7 +542,7 @@ public:
|
|||
XMapWindow(m_xDisp, m_windowId);
|
||||
XFlush(m_xDisp);
|
||||
|
||||
setStyle(STYLE_DEFAULT);
|
||||
setStyle(EWindowStyle::Default);
|
||||
|
||||
m_gfxCtx.initializeContext();
|
||||
}
|
||||
|
@ -701,18 +705,18 @@ public:
|
|||
if (S_ATOMS->m_motifWmHints)
|
||||
{
|
||||
wmHints.flags = MWM_HINTS_DECORATIONS | MWM_HINTS_FUNCTIONS;
|
||||
if (style & STYLE_TITLEBAR)
|
||||
if ((style & EWindowStyle::Titlebar) != EWindowStyle::None)
|
||||
{
|
||||
wmHints.decorations |= MWM_DECOR_BORDER | MWM_DECOR_TITLE | MWM_DECOR_MINIMIZE | MWM_DECOR_MENU;
|
||||
wmHints.functions |= MWM_FUNC_MOVE | MWM_FUNC_MINIMIZE;
|
||||
}
|
||||
if (style & STYLE_RESIZE)
|
||||
if ((style & EWindowStyle::Resize) != EWindowStyle::None)
|
||||
{
|
||||
wmHints.decorations |= MWM_DECOR_MAXIMIZE | MWM_DECOR_RESIZEH;
|
||||
wmHints.functions |= MWM_FUNC_RESIZE | MWM_FUNC_MAXIMIZE;
|
||||
}
|
||||
|
||||
if (style & STYLE_CLOSE)
|
||||
if ((style & EWindowStyle::Close) != EWindowStyle::None)
|
||||
wmHints.functions |= MWM_FUNC_CLOSE;
|
||||
|
||||
XLockDisplay(m_xDisp);
|
||||
|
@ -813,11 +817,11 @@ public:
|
|||
{
|
||||
XITouchClassInfo* touchClass = (XITouchClassInfo*)dclass;
|
||||
if (touchClass->mode == XIDirectTouch)
|
||||
m_touchType = TOUCH_DISPLAY;
|
||||
m_touchType = ETouchType::Display;
|
||||
else if (touchClass->mode == XIDependentTouch)
|
||||
m_touchType = TOUCH_TRACKPAD;
|
||||
m_touchType = ETouchType::Trackpad;
|
||||
else
|
||||
m_touchType = TOUCH_NONE;
|
||||
m_touchType = ETouchType::None;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -880,19 +884,17 @@ public:
|
|||
{
|
||||
if (m_callback)
|
||||
{
|
||||
int specialKey;
|
||||
int modifierKey;
|
||||
ESpecialKey specialKey;
|
||||
EModifierKey modifierKey;
|
||||
uint32_t charCode = translateKeysym(XLookupKeysym(&event->xkey, 0),
|
||||
specialKey, modifierKey);
|
||||
int modifierMask = translateModifiers(event->xkey.state);
|
||||
EModifierKey modifierMask = translateModifiers(event->xkey.state);
|
||||
if (charCode)
|
||||
m_callback->charKeyDown(charCode,
|
||||
(EModifierKey)modifierMask, false);
|
||||
else if (specialKey)
|
||||
m_callback->specialKeyDown((ESpecialKey)specialKey,
|
||||
(EModifierKey)modifierMask, false);
|
||||
else if (modifierKey)
|
||||
m_callback->modKeyDown((EModifierKey)modifierKey, false);
|
||||
m_callback->charKeyDown(charCode, modifierMask, false);
|
||||
else if (specialKey != ESpecialKey::None)
|
||||
m_callback->specialKeyDown(specialKey, modifierMask, false);
|
||||
else if (modifierKey != EModifierKey::None)
|
||||
m_callback->modKeyDown(modifierKey, false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -900,19 +902,17 @@ public:
|
|||
{
|
||||
if (m_callback)
|
||||
{
|
||||
int specialKey;
|
||||
int modifierKey;
|
||||
ESpecialKey specialKey;
|
||||
EModifierKey modifierKey;
|
||||
uint32_t charCode = translateKeysym(XLookupKeysym(&event->xkey, 0),
|
||||
specialKey, modifierKey);
|
||||
int modifierMask = translateModifiers(event->xkey.state);
|
||||
EModifierKey modifierMask = translateModifiers(event->xkey.state);
|
||||
if (charCode)
|
||||
m_callback->charKeyUp(charCode,
|
||||
(EModifierKey)modifierMask);
|
||||
else if (specialKey)
|
||||
m_callback->specialKeyUp((ESpecialKey)specialKey,
|
||||
(EModifierKey)modifierMask);
|
||||
else if (modifierKey)
|
||||
m_callback->modKeyUp((EModifierKey)modifierKey);
|
||||
m_callback->charKeyUp(charCode, modifierMask);
|
||||
else if (specialKey != ESpecialKey::None)
|
||||
m_callback->specialKeyUp(specialKey, modifierMask);
|
||||
else if (modifierKey != EModifierKey::None)
|
||||
m_callback->modKeyUp(modifierKey);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -921,10 +921,10 @@ public:
|
|||
if (m_callback)
|
||||
{
|
||||
getWindowFrame(m_wx, m_wy, m_ww, m_wh);
|
||||
int button = translateButton(event->xbutton.button);
|
||||
if (button)
|
||||
EMouseButton button = translateButton(event->xbutton.button);
|
||||
if (button != EMouseButton::None)
|
||||
{
|
||||
int modifierMask = translateModifiers(event->xbutton.state);
|
||||
EModifierKey modifierMask = translateModifiers(event->xbutton.state);
|
||||
SWindowCoord coord =
|
||||
{
|
||||
{(unsigned)event->xbutton.x, (unsigned)event->xbutton.y},
|
||||
|
@ -968,10 +968,10 @@ public:
|
|||
if (m_callback)
|
||||
{
|
||||
getWindowFrame(m_wx, m_wy, m_ww, m_wh);
|
||||
int button = translateButton(event->xbutton.button);
|
||||
if (button)
|
||||
EMouseButton button = translateButton(event->xbutton.button);
|
||||
if (button != EMouseButton::None)
|
||||
{
|
||||
int modifierMask = translateModifiers(event->xbutton.state);
|
||||
EModifierKey modifierMask = translateModifiers(event->xbutton.state);
|
||||
SWindowCoord coord =
|
||||
{
|
||||
{(unsigned)event->xbutton.x, (unsigned)event->xbutton.y},
|
||||
|
|
|
@ -62,8 +62,8 @@ class DualshockPadCallback : public IDualshockPadCallback
|
|||
{
|
||||
if (timeDif >= 1) // wait 30 seconds before issuing another rumble event
|
||||
{
|
||||
ctrl->startRumble(DS3_MOTOR_LEFT);
|
||||
ctrl->startRumble(DS3_MOTOR_RIGHT, 100);
|
||||
ctrl->startRumble(EDualshockMotor::Left);
|
||||
ctrl->startRumble(EDualshockMotor::Right, 100);
|
||||
lastTime = timeTotal;
|
||||
}
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ public:
|
|||
if (ds3)
|
||||
{
|
||||
ds3->setCallback(&m_ds3CB);
|
||||
ds3->setLED(DS3_LED_1);
|
||||
ds3->setLED(EDualshockLED::LED_1);
|
||||
}
|
||||
}
|
||||
void deviceDisconnected(DeviceToken&, DeviceBase* device)
|
||||
|
@ -136,11 +136,11 @@ struct CTestWindowCallback : IWindowCallback
|
|||
|
||||
void mouseDown(const SWindowCoord& coord, EMouseButton button, EModifierKey mods)
|
||||
{
|
||||
fprintf(stderr, "Mouse Down %d (%f,%f)\n", button, coord.norm[0], coord.norm[1]);
|
||||
fprintf(stderr, "Mouse Down %d (%f,%f)\n", int(button), coord.norm[0], coord.norm[1]);
|
||||
}
|
||||
void mouseUp(const SWindowCoord& coord, EMouseButton button, EModifierKey mods)
|
||||
{
|
||||
fprintf(stderr, "Mouse Up %d (%f,%f)\n", button, coord.norm[0], coord.norm[1]);
|
||||
fprintf(stderr, "Mouse Up %d (%f,%f)\n", int(button), coord.norm[0], coord.norm[1]);
|
||||
}
|
||||
void mouseMove(const SWindowCoord& coord)
|
||||
{
|
||||
|
@ -182,7 +182,7 @@ struct CTestWindowCallback : IWindowCallback
|
|||
}
|
||||
void specialKeyDown(ESpecialKey key, EModifierKey mods, bool isRepeat)
|
||||
{
|
||||
if (key == boo::KEY_ENTER && (mods & boo::MKEY_ALT))
|
||||
if (key == ESpecialKey::Enter && (mods & EModifierKey::Alt) != EModifierKey::None)
|
||||
m_fullscreenToggleRequested = true;
|
||||
}
|
||||
void specialKeyUp(ESpecialKey key, EModifierKey mods)
|
||||
|
@ -251,13 +251,13 @@ struct TestApplicationCallback : IApplicationCallback
|
|||
{{-0.5,-0.5},{0.0,0.0}}
|
||||
};
|
||||
IGraphicsBuffer* vbo =
|
||||
factory->newStaticBuffer(BufferUseVertex, quad, sizeof(Vert), 4);
|
||||
factory->newStaticBuffer(BufferUse::Vertex, quad, sizeof(Vert), 4);
|
||||
|
||||
/* Make vertex format */
|
||||
VertexElementDescriptor descs[2] =
|
||||
{
|
||||
{vbo, nullptr, VertexSemanticPosition},
|
||||
{vbo, nullptr, VertexSemanticUV}
|
||||
{vbo, nullptr, VertexSemantic::Position},
|
||||
{vbo, nullptr, VertexSemantic::UV}
|
||||
};
|
||||
IVertexFormat* vfmt = factory->newVertexFormat(2, descs);
|
||||
|
||||
|
@ -273,11 +273,11 @@ struct TestApplicationCallback : IApplicationCallback
|
|||
tex[i][j][3] = 0xff;
|
||||
}
|
||||
ITexture* texture =
|
||||
factory->newStaticTexture(256, 256, 1, TextureFormatRGBA8, tex, 256*256*4);
|
||||
factory->newStaticTexture(256, 256, 1, TextureFormat::RGBA8, tex, 256*256*4);
|
||||
|
||||
/* Make shader pipeline */
|
||||
IShaderPipeline* pipeline = nullptr;
|
||||
if (factory->platform() == IGraphicsDataFactory::PlatformOGL)
|
||||
if (factory->platform() == IGraphicsDataFactory::Platform::OGL)
|
||||
{
|
||||
GLDataFactory* glF = dynamic_cast<GLDataFactory*>(factory);
|
||||
|
||||
|
@ -304,7 +304,7 @@ struct TestApplicationCallback : IApplicationCallback
|
|||
"}\n";
|
||||
|
||||
pipeline = glF->newShaderPipeline(VS, FS, 1, "texs", 0, nullptr,
|
||||
BlendFactorOne, BlendFactorZero,
|
||||
BlendFactor::One, BlendFactor::Zero,
|
||||
true, true, false);
|
||||
}
|
||||
#if _WIN32
|
||||
|
@ -444,7 +444,7 @@ struct TestApplicationCallback : IApplicationCallback
|
|||
float rgba[] = {sinf(frameIdx / 60.0), cosf(frameIdx / 60.0), 0.0, 1.0};
|
||||
gfxQ->setClearColor(rgba);
|
||||
gfxQ->clearTarget();
|
||||
gfxQ->setDrawPrimitive(PrimitiveTriStrips);
|
||||
gfxQ->setDrawPrimitive(Primitive::TriStrips);
|
||||
|
||||
gfxQ->setShaderDataBinding(m_binding);
|
||||
gfxQ->draw(0, 4);
|
||||
|
@ -486,11 +486,15 @@ struct TestApplicationCallback : IApplicationCallback
|
|||
|
||||
}
|
||||
|
||||
#if _WIN32
|
||||
int wmain(int argc, const boo::SystemChar** argv)
|
||||
#else
|
||||
int main(int argc, const boo::SystemChar** argv)
|
||||
#endif
|
||||
{
|
||||
LogVisor::RegisterConsoleLogger();
|
||||
boo::TestApplicationCallback appCb;
|
||||
int ret = ApplicationRun(boo::IApplication::PLAT_AUTO,
|
||||
int ret = ApplicationRun(boo::IApplication::EPlatformType::Auto,
|
||||
appCb, _S("boo"), _S("Boo"), argc, argv);
|
||||
printf("IM DYING!!\n");
|
||||
return ret;
|
||||
|
@ -509,9 +513,7 @@ int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE, LPWSTR lpCmdLine, int)
|
|||
booArgv[i+1] = argv[i];
|
||||
|
||||
LogVisor::CreateWin32Console();
|
||||
return main(argc+1, booArgv);
|
||||
return wmain(argc+1, booArgv);
|
||||
}
|
||||
#else
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue