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:
|
public:
|
||||||
virtual ~IApplication() {}
|
virtual ~IApplication() {}
|
||||||
|
|
||||||
enum EPlatformType
|
enum class EPlatformType : uint8_t
|
||||||
{
|
{
|
||||||
PLAT_AUTO = 0,
|
Auto = 0,
|
||||||
PLAT_WAYLAND = 1,
|
Wayland = 1,
|
||||||
PLAT_XLIB = 2,
|
Xlib = 2,
|
||||||
PLAT_ANDROID = 3,
|
Android = 3,
|
||||||
PLAT_COCOA = 4,
|
Cocoa = 4,
|
||||||
PLAT_COCOA_TOUCH = 5,
|
CocoaTouch = 5,
|
||||||
PLAT_WIN32 = 6,
|
Win32 = 6,
|
||||||
PLAT_WINRT = 7,
|
WinRT = 7,
|
||||||
PLAT_REVOLUTION = 8,
|
Revolution = 8,
|
||||||
PLAT_CAFE = 9
|
Cafe = 9
|
||||||
};
|
};
|
||||||
virtual EPlatformType getPlatformType() const=0;
|
virtual EPlatformType getPlatformType() const=0;
|
||||||
|
|
||||||
|
|
|
@ -17,27 +17,27 @@ class IGraphicsContext
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
enum EGraphicsAPI
|
enum class EGraphicsAPI
|
||||||
{
|
{
|
||||||
API_NONE = 0,
|
None = 0,
|
||||||
API_OPENGL_3_3 = 1,
|
OpenGL3_3 = 1,
|
||||||
API_OPENGL_4_2 = 2,
|
OpenGL4_2 = 2,
|
||||||
API_OPENGLES_3 = 3,
|
OpenGLES3 = 3,
|
||||||
API_VULKAN = 4,
|
Vulkan = 4,
|
||||||
API_D3D11 = 5,
|
D3D11 = 5,
|
||||||
API_D3D12 = 6,
|
D3D12 = 6,
|
||||||
API_METAL = 7,
|
Metal = 7,
|
||||||
API_GX = 8,
|
GX = 8,
|
||||||
API_GX2 = 9
|
GX2 = 9
|
||||||
};
|
};
|
||||||
|
|
||||||
enum EPixelFormat
|
enum class EPixelFormat
|
||||||
{
|
{
|
||||||
PF_NONE = 0,
|
None = 0,
|
||||||
PF_RGBA8 = 1, /* Default */
|
RGBA8 = 1, /* Default */
|
||||||
PF_RGBA8_Z24 = 2,
|
RGBA8_Z24 = 2,
|
||||||
PF_RGBAF32 = 3,
|
RGBAF32 = 3,
|
||||||
PF_RGBAF32_Z24 = 4
|
RGBAF32_Z24 = 4
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual ~IGraphicsContext() {}
|
virtual ~IGraphicsContext() {}
|
||||||
|
|
|
@ -8,14 +8,14 @@ namespace boo
|
||||||
struct IGraphicsCommandQueue;
|
struct IGraphicsCommandQueue;
|
||||||
struct IGraphicsDataFactory;
|
struct IGraphicsDataFactory;
|
||||||
|
|
||||||
enum EMouseButton
|
enum class EMouseButton
|
||||||
{
|
{
|
||||||
BUTTON_NONE = 0,
|
None = 0,
|
||||||
BUTTON_PRIMARY = 1,
|
Primary = 1,
|
||||||
BUTTON_SECONDARY = 2,
|
Secondary = 2,
|
||||||
BUTTON_MIDDLE = 3,
|
Middle = 3,
|
||||||
BUTTON_AUX1 = 4,
|
Aux1 = 4,
|
||||||
BUTTON_AUX2 = 5
|
Aux2 = 5
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SWindowRect
|
struct SWindowRect
|
||||||
|
@ -48,45 +48,70 @@ struct SScrollDelta
|
||||||
void zeroOut() {delta[0] = 0.0; delta[1] = 0.0;}
|
void zeroOut() {delta[0] = 0.0; delta[1] = 0.0;}
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ESpecialKey
|
enum class ESpecialKey
|
||||||
{
|
{
|
||||||
KEY_NONE = 0,
|
None = 0,
|
||||||
KEY_F1 = 1,
|
F1 = 1,
|
||||||
KEY_F2 = 2,
|
F2 = 2,
|
||||||
KEY_F3 = 3,
|
F3 = 3,
|
||||||
KEY_F4 = 4,
|
F4 = 4,
|
||||||
KEY_F5 = 5,
|
F5 = 5,
|
||||||
KEY_F6 = 6,
|
F6 = 6,
|
||||||
KEY_F7 = 7,
|
F7 = 7,
|
||||||
KEY_F8 = 8,
|
F8 = 8,
|
||||||
KEY_F9 = 9,
|
F9 = 9,
|
||||||
KEY_F10 = 10,
|
F10 = 10,
|
||||||
KEY_F11 = 11,
|
F11 = 11,
|
||||||
KEY_F12 = 12,
|
F12 = 12,
|
||||||
KEY_ESC = 13,
|
Esc = 13,
|
||||||
KEY_ENTER = 14,
|
Enter = 14,
|
||||||
KEY_BACKSPACE = 15,
|
Backspace = 15,
|
||||||
KEY_INSERT = 16,
|
Insert = 16,
|
||||||
KEY_DELETE = 17,
|
Delete = 17,
|
||||||
KEY_HOME = 18,
|
Home = 18,
|
||||||
KEY_END = 19,
|
End = 19,
|
||||||
KEY_PGUP = 20,
|
PgUp = 20,
|
||||||
KEY_PGDOWN = 21,
|
PgDown = 21,
|
||||||
KEY_LEFT = 22,
|
Left = 22,
|
||||||
KEY_RIGHT = 23,
|
Right = 23,
|
||||||
KEY_UP = 24,
|
Up = 24,
|
||||||
KEY_DOWN = 25
|
Down = 25
|
||||||
};
|
};
|
||||||
|
|
||||||
enum EModifierKey
|
enum class EModifierKey
|
||||||
{
|
{
|
||||||
MKEY_NONE = 0,
|
None = 0,
|
||||||
MKEY_CTRL = 1<<0,
|
Ctrl = 1<<0,
|
||||||
MKEY_ALT = 1<<2,
|
Alt = 1<<2,
|
||||||
MKEY_SHIFT = 1<<3,
|
Shift = 1<<3,
|
||||||
MKEY_COMMAND = 1<<4
|
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
|
class IWindowCallback
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -132,23 +157,35 @@ public:
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ETouchType
|
enum class ETouchType
|
||||||
{
|
{
|
||||||
TOUCH_NONE = 0,
|
None = 0,
|
||||||
TOUCH_DISPLAY = 1,
|
Display = 1,
|
||||||
TOUCH_TRACKPAD = 2
|
Trackpad = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
enum EWindowStyle
|
enum class EWindowStyle
|
||||||
{
|
{
|
||||||
STYLE_NONE = 0,
|
None = 0,
|
||||||
STYLE_TITLEBAR = 1<<0,
|
Titlebar = 1<<0,
|
||||||
STYLE_RESIZE = 1<<1,
|
Resize = 1<<1,
|
||||||
STYLE_CLOSE = 1<<2,
|
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
|
class IWindow
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -3,6 +3,35 @@
|
||||||
|
|
||||||
#include <string>
|
#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
|
namespace boo
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ public:
|
||||||
GLDataFactory(IGraphicsContext* parent);
|
GLDataFactory(IGraphicsContext* parent);
|
||||||
~GLDataFactory() {}
|
~GLDataFactory() {}
|
||||||
|
|
||||||
Platform platform() const {return PlatformOGL;}
|
Platform platform() const {return Platform::OGL;}
|
||||||
const SystemChar* platformName() const {return _S("OGL");}
|
const SystemChar* platformName() const {return _S("OGL");}
|
||||||
|
|
||||||
IGraphicsBufferS* newStaticBuffer(BufferUse use, const void* data, size_t stride, size_t count);
|
IGraphicsBufferS* newStaticBuffer(BufferUse use, const void* data, size_t stride, size_t count);
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
|
|
||||||
namespace boo
|
namespace boo
|
||||||
{
|
{
|
||||||
enum Primitive
|
enum class Primitive
|
||||||
{
|
{
|
||||||
PrimitiveTriangles,
|
Triangles,
|
||||||
PrimitiveTriStrips
|
TriStrips
|
||||||
};
|
};
|
||||||
|
|
||||||
struct IGraphicsCommandQueue
|
struct IGraphicsCommandQueue
|
||||||
|
|
|
@ -35,32 +35,27 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Supported buffer uses */
|
/** Supported buffer uses */
|
||||||
enum BufferUse
|
enum class BufferUse
|
||||||
{
|
{
|
||||||
BufferUseNull,
|
Null,
|
||||||
BufferUseVertex,
|
Vertex,
|
||||||
BufferUseIndex,
|
Index,
|
||||||
BufferUseUniform
|
Uniform
|
||||||
};
|
};
|
||||||
|
|
||||||
enum TextureType
|
enum class TextureType
|
||||||
{
|
{
|
||||||
TextureStatic,
|
Static,
|
||||||
Texture
|
Dynamic,
|
||||||
|
Render
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ITexture
|
struct ITexture
|
||||||
{
|
{
|
||||||
enum Type
|
TextureType type() const {return m_type;}
|
||||||
{
|
|
||||||
TextureStatic,
|
|
||||||
TextureDynamic,
|
|
||||||
TextureRender
|
|
||||||
};
|
|
||||||
Type type() const {return m_type;}
|
|
||||||
protected:
|
protected:
|
||||||
Type m_type;
|
TextureType m_type;
|
||||||
ITexture(Type type) : m_type(type) {}
|
ITexture(TextureType type) : m_type(type) {}
|
||||||
virtual ~ITexture() {}
|
virtual ~ITexture() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -68,7 +63,7 @@ protected:
|
||||||
struct ITextureS : ITexture
|
struct ITextureS : ITexture
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
ITextureS() : ITexture(TextureStatic) {}
|
ITextureS() : ITexture(TextureType::Static) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Dynamic resource buffer for textures */
|
/** Dynamic resource buffer for textures */
|
||||||
|
@ -78,22 +73,22 @@ struct ITextureD : ITexture
|
||||||
virtual void* map(size_t sz)=0;
|
virtual void* map(size_t sz)=0;
|
||||||
virtual void unmap()=0;
|
virtual void unmap()=0;
|
||||||
protected:
|
protected:
|
||||||
ITextureD() : ITexture(TextureDynamic) {}
|
ITextureD() : ITexture(TextureType::Dynamic) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Resource buffer for render-target textures */
|
/** Resource buffer for render-target textures */
|
||||||
struct ITextureR : ITexture
|
struct ITextureR : ITexture
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
ITextureR() : ITexture(TextureRender) {}
|
ITextureR() : ITexture(TextureType::Render) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Supported texture formats */
|
/** Supported texture formats */
|
||||||
enum TextureFormat
|
enum class TextureFormat
|
||||||
{
|
{
|
||||||
TextureFormatRGBA8,
|
RGBA8,
|
||||||
TextureFormatDXT1,
|
DXT1,
|
||||||
TextureFormatPVRTC4
|
PVRTC4
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Opaque token for representing the data layout of a vertex
|
/** Opaque token for representing the data layout of a vertex
|
||||||
|
@ -102,13 +97,13 @@ enum TextureFormat
|
||||||
struct IVertexFormat {};
|
struct IVertexFormat {};
|
||||||
|
|
||||||
/** Types of vertex attributes */
|
/** Types of vertex attributes */
|
||||||
enum VertexSemantic
|
enum class VertexSemantic
|
||||||
{
|
{
|
||||||
VertexSemanticPosition,
|
Position,
|
||||||
VertexSemanticNormal,
|
Normal,
|
||||||
VertexSemanticColor,
|
Color,
|
||||||
VertexSemanticUV,
|
UV,
|
||||||
VertexSemanticWeight
|
Weight
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Used to create IVertexFormat */
|
/** Used to create IVertexFormat */
|
||||||
|
@ -140,18 +135,18 @@ struct IGraphicsData
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Used by platform shader pipeline constructors */
|
/** Used by platform shader pipeline constructors */
|
||||||
enum BlendFactor
|
enum class BlendFactor
|
||||||
{
|
{
|
||||||
BlendFactorZero,
|
Zero,
|
||||||
BlendFactorOne,
|
One,
|
||||||
BlendFactorSrcColor,
|
SrcColor,
|
||||||
BlendFactorInvSrcColor,
|
InvSrcColor,
|
||||||
BlendFactorDstColor,
|
DstColor,
|
||||||
BlendFactorInvDstColor,
|
InvDstColor,
|
||||||
BlendFactorSrcAlpha,
|
SrcAlpha,
|
||||||
BlendFactorInvSrcAlpha,
|
InvSrcAlpha,
|
||||||
BlendFactorDstAlpha,
|
DstAlpha,
|
||||||
BlendFactorInvDstAlpha
|
InvDstAlpha
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Factory object for creating batches of resources as an IGraphicsData token */
|
/** Factory object for creating batches of resources as an IGraphicsData token */
|
||||||
|
@ -159,15 +154,15 @@ struct IGraphicsDataFactory
|
||||||
{
|
{
|
||||||
virtual ~IGraphicsDataFactory() {}
|
virtual ~IGraphicsDataFactory() {}
|
||||||
|
|
||||||
enum Platform
|
enum class Platform
|
||||||
{
|
{
|
||||||
PlatformNull,
|
Null,
|
||||||
PlatformOGL,
|
OGL,
|
||||||
PlatformD3D11,
|
D3D11,
|
||||||
PlatformD3D12,
|
D3D12,
|
||||||
PlatformMetal,
|
Metal,
|
||||||
PlatformGX,
|
GX,
|
||||||
PlatformGX2
|
GX2
|
||||||
};
|
};
|
||||||
virtual Platform platform() const=0;
|
virtual Platform platform() const=0;
|
||||||
virtual const SystemChar* platformName() const=0;
|
virtual const SystemChar* platformName() const=0;
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include "../System.hpp"
|
||||||
|
|
||||||
namespace boo
|
namespace boo
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,16 +11,16 @@ namespace boo
|
||||||
class DeviceToken
|
class DeviceToken
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum TDeviceType
|
enum class DeviceType
|
||||||
{
|
{
|
||||||
DEVTYPE_NONE = 0,
|
None = 0,
|
||||||
DEVTYPE_USB = 1,
|
USB = 1,
|
||||||
DEVTYPE_BLUETOOTH = 2,
|
Bluetooth = 2,
|
||||||
DEVTYPE_GENERICHID = 3
|
GenericHID = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TDeviceType m_devType;
|
DeviceType m_devType;
|
||||||
unsigned m_vendorId;
|
unsigned m_vendorId;
|
||||||
unsigned m_productId;
|
unsigned m_productId;
|
||||||
std::string m_vendorName;
|
std::string m_vendorName;
|
||||||
|
@ -50,7 +50,7 @@ public:
|
||||||
m_devPath(other.m_devPath),
|
m_devPath(other.m_devPath),
|
||||||
m_connectedDev(other.m_connectedDev)
|
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_devType(devType),
|
||||||
m_vendorId(vid),
|
m_vendorId(vid),
|
||||||
m_productId(pid),
|
m_productId(pid),
|
||||||
|
@ -63,7 +63,7 @@ public:
|
||||||
m_productName = pname;
|
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 getVendorId() const {return m_vendorId;}
|
||||||
inline unsigned getProductId() const {return m_productId;}
|
inline unsigned getProductId() const {return m_productId;}
|
||||||
inline const std::string& getVendorName() const {return m_vendorName;}
|
inline const std::string& getVendorName() const {return m_vendorName;}
|
||||||
|
|
|
@ -7,28 +7,30 @@
|
||||||
namespace boo
|
namespace boo
|
||||||
{
|
{
|
||||||
|
|
||||||
enum EDolphinControllerType
|
enum class EDolphinControllerType
|
||||||
{
|
{
|
||||||
DOL_TYPE_NONE = 0,
|
None = 0,
|
||||||
DOL_TYPE_NORMAL = 0x10,
|
Normal = 0x10,
|
||||||
DOL_TYPE_WAVEBIRD = 0x20,
|
Wavebird = 0x20,
|
||||||
};
|
};
|
||||||
|
ENABLE_BITWISE_ENUM(EDolphinControllerType)
|
||||||
|
|
||||||
enum EDolphinControllerButtons
|
enum class EDolphinControllerButtons
|
||||||
{
|
{
|
||||||
DOL_START = 1<<0,
|
Start = 1<<0,
|
||||||
DOL_Z = 1<<1,
|
Z = 1<<1,
|
||||||
DOL_L = 1<<2,
|
L = 1<<2,
|
||||||
DOL_R = 1<<3,
|
R = 1<<3,
|
||||||
DOL_A = 1<<8,
|
A = 1<<8,
|
||||||
DOL_B = 1<<9,
|
B = 1<<9,
|
||||||
DOL_X = 1<<10,
|
X = 1<<10,
|
||||||
DOL_Y = 1<<11,
|
Y = 1<<11,
|
||||||
DOL_LEFT = 1<<12,
|
Left = 1<<12,
|
||||||
DOL_RIGHT = 1<<13,
|
Right = 1<<13,
|
||||||
DOL_DOWN = 1<<14,
|
Down = 1<<14,
|
||||||
DOL_UP = 1<<15
|
Up = 1<<15
|
||||||
};
|
};
|
||||||
|
ENABLE_BITWISE_ENUM(EDolphinControllerButtons)
|
||||||
|
|
||||||
struct DolphinControllerState
|
struct DolphinControllerState
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,40 +39,43 @@ union DualshockOutReport
|
||||||
uint8_t buf[36];
|
uint8_t buf[36];
|
||||||
};
|
};
|
||||||
|
|
||||||
enum EDualshockPadButtons
|
enum class EDualshockPadButtons
|
||||||
{
|
{
|
||||||
DS3_SELECT = 1<< 0,
|
Select = 1<< 0,
|
||||||
DS3_L3 = 1<< 1,
|
L3 = 1<< 1,
|
||||||
DS3_R3 = 1<< 2,
|
R3 = 1<< 2,
|
||||||
DS3_START = 1<< 3,
|
Start = 1<< 3,
|
||||||
DS3_UP = 1<< 4,
|
Up = 1<< 4,
|
||||||
DS3_RIGHT = 1<< 5,
|
Right = 1<< 5,
|
||||||
DS3_DOWN = 1<< 6,
|
Down = 1<< 6,
|
||||||
DS3_LEFT = 1<< 7,
|
Left = 1<< 7,
|
||||||
DS3_L2 = 1<< 8,
|
L2 = 1<< 8,
|
||||||
DS3_R2 = 1<< 9,
|
R2 = 1<< 9,
|
||||||
DS3_L1 = 1<<10,
|
L1 = 1<<10,
|
||||||
DS3_R1 = 1<<11,
|
R1 = 1<<11,
|
||||||
DS3_TRIANGLE = 1<<12,
|
Triangle = 1<<12,
|
||||||
DS3_CIRCLE = 1<<13,
|
Circle = 1<<13,
|
||||||
DS3_CROSS = 1<<14,
|
Cross = 1<<14,
|
||||||
DS3_SQUARE = 1<<15
|
Square = 1<<15
|
||||||
};
|
};
|
||||||
|
|
||||||
enum EDualshockMotor : int
|
enum class EDualshockMotor : uint8_t
|
||||||
{
|
{
|
||||||
DS3_MOTOR_RIGHT = 1<<0,
|
None = 0,
|
||||||
DS3_MOTOR_LEFT = 1<<1,
|
Right = 1<<0,
|
||||||
|
Left = 1<<1,
|
||||||
};
|
};
|
||||||
|
ENABLE_BITWISE_ENUM(EDualshockMotor)
|
||||||
|
|
||||||
enum EDualshockLED
|
enum class EDualshockLED
|
||||||
{
|
{
|
||||||
DS3_LED_OFF = 0,
|
LED_OFF = 0,
|
||||||
DS3_LED_1 = 1<<1,
|
LED_1 = 1<<1,
|
||||||
DS3_LED_2 = 1<<2,
|
LED_2 = 1<<2,
|
||||||
DS3_LED_3 = 1<<3,
|
LED_3 = 1<<3,
|
||||||
DS3_LED_4 = 1<<4
|
LED_4 = 1<<4
|
||||||
};
|
};
|
||||||
|
ENABLE_BITWISE_ENUM(EDualshockLED)
|
||||||
|
|
||||||
struct DualshockPadState
|
struct DualshockPadState
|
||||||
{
|
{
|
||||||
|
@ -120,11 +123,11 @@ struct IDualshockPadCallback
|
||||||
class DualshockPad final : public DeviceBase
|
class DualshockPad final : public DeviceBase
|
||||||
{
|
{
|
||||||
IDualshockPadCallback* m_callback;
|
IDualshockPadCallback* m_callback;
|
||||||
uint8_t m_rumbleRequest;
|
EDualshockMotor m_rumbleRequest;
|
||||||
uint8_t m_rumbleState;
|
EDualshockMotor m_rumbleState;
|
||||||
uint8_t m_rumbleDuration[2];
|
uint8_t m_rumbleDuration[2];
|
||||||
uint8_t m_rumbleIntensity[2];
|
uint8_t m_rumbleIntensity[2];
|
||||||
uint8_t m_led;
|
EDualshockLED m_led;
|
||||||
DualshockOutReport m_report;
|
DualshockOutReport m_report;
|
||||||
uint8_t m_btAddress[6];
|
uint8_t m_btAddress[6];
|
||||||
void deviceDisconnected();
|
void deviceDisconnected();
|
||||||
|
@ -135,45 +138,45 @@ public:
|
||||||
DualshockPad(DeviceToken* token);
|
DualshockPad(DeviceToken* token);
|
||||||
~DualshockPad();
|
~DualshockPad();
|
||||||
|
|
||||||
inline void setCallback(IDualshockPadCallback* cb)
|
void setCallback(IDualshockPadCallback* cb)
|
||||||
{ m_callback = cb; if (m_callback) m_callback->ctrl = this; }
|
{ 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;
|
m_rumbleRequest |= motor;
|
||||||
if (motor & DS3_MOTOR_LEFT)
|
if ((EDualshockMotor(motor) & EDualshockMotor::Left) != EDualshockMotor::None)
|
||||||
{
|
{
|
||||||
m_rumbleDuration[0] = duration;
|
m_rumbleDuration[0] = duration;
|
||||||
m_rumbleIntensity[0] = intensity;
|
m_rumbleIntensity[0] = intensity;
|
||||||
}
|
}
|
||||||
if (motor & DS3_MOTOR_RIGHT)
|
if ((EDualshockMotor(motor) & EDualshockMotor::Right) != EDualshockMotor::None)
|
||||||
{
|
{
|
||||||
m_rumbleDuration[1] = duration;
|
m_rumbleDuration[1] = duration;
|
||||||
m_rumbleIntensity[1] = intensity;
|
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;
|
return m_led;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void setLED(int led, bool on = true)
|
void setLED(EDualshockLED led, bool on = true)
|
||||||
{
|
{
|
||||||
if (on)
|
if (on)
|
||||||
m_led |= led;
|
m_led |= led;
|
||||||
else
|
else
|
||||||
m_led &= ~led;
|
m_led &= ~led;
|
||||||
|
|
||||||
setRawLED(led);
|
setRawLED(int(led));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void setRawLED(int led)
|
void setRawLED(int led)
|
||||||
{
|
{
|
||||||
m_report.leds = led;
|
m_report.leds = led;
|
||||||
sendHIDReport(m_report.buf, sizeof(m_report), 0x0201);
|
sendHIDReport(m_report.buf, sizeof(m_report), 0x0201);
|
||||||
|
|
|
@ -40,7 +40,7 @@ class GLGraphicsBufferS : public IGraphicsBufferS
|
||||||
GLenum m_target;
|
GLenum m_target;
|
||||||
GLGraphicsBufferS(BufferUse use, const void* data, size_t sz)
|
GLGraphicsBufferS(BufferUse use, const void* data, size_t sz)
|
||||||
{
|
{
|
||||||
m_target = USE_TABLE[use];
|
m_target = USE_TABLE[int(use)];
|
||||||
glGenBuffers(1, &m_buf);
|
glGenBuffers(1, &m_buf);
|
||||||
glBindBuffer(m_target, m_buf);
|
glBindBuffer(m_target, m_buf);
|
||||||
glBufferData(m_target, sz, data, GL_STATIC_DRAW);
|
glBufferData(m_target, sz, data, GL_STATIC_DRAW);
|
||||||
|
@ -68,7 +68,7 @@ class GLGraphicsBufferD : public IGraphicsBufferD
|
||||||
GLGraphicsBufferD(GLCommandQueue* q, BufferUse use)
|
GLGraphicsBufferD(GLCommandQueue* q, BufferUse use)
|
||||||
: m_q(q)
|
: m_q(q)
|
||||||
{
|
{
|
||||||
m_target = USE_TABLE[use];
|
m_target = USE_TABLE[int(use)];
|
||||||
glGenBuffers(3, m_bufs);
|
glGenBuffers(3, m_bufs);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
@ -115,7 +115,7 @@ class GLTextureS : public ITextureS
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
|
||||||
else
|
else
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
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)
|
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");
|
Log.report(LogVisor::Error, "unable to create shader objects\n");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
shader.m_sfactor = BLEND_FACTOR_TABLE[srcFac];
|
shader.m_sfactor = BLEND_FACTOR_TABLE[int(srcFac)];
|
||||||
shader.m_dfactor = BLEND_FACTOR_TABLE[dstFac];
|
shader.m_dfactor = BLEND_FACTOR_TABLE[int(dstFac)];
|
||||||
shader.m_depthTest = depthTest;
|
shader.m_depthTest = depthTest;
|
||||||
shader.m_depthWrite = depthWrite;
|
shader.m_depthWrite = depthWrite;
|
||||||
shader.m_backfaceCulling = backfaceCulling;
|
shader.m_backfaceCulling = backfaceCulling;
|
||||||
|
@ -456,9 +456,9 @@ struct GLShaderDataBinding : IShaderDataBinding
|
||||||
for (size_t i=0 ; i<m_texCount ; ++i)
|
for (size_t i=0 ; i<m_texCount ; ++i)
|
||||||
{
|
{
|
||||||
ITexture* tex = m_texs[i];
|
ITexture* tex = m_texs[i];
|
||||||
if (tex->type() == ITexture::TextureDynamic)
|
if (tex->type() == TextureType::Dynamic)
|
||||||
static_cast<GLTextureD*>(tex)->bind(i);
|
static_cast<GLTextureD*>(tex)->bind(i);
|
||||||
else if (tex->type() == ITexture::TextureStatic)
|
else if (tex->type() == TextureType::Static)
|
||||||
static_cast<GLTextureS*>(tex)->bind(i);
|
static_cast<GLTextureS*>(tex)->bind(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -541,25 +541,25 @@ static const GLenum SEMANTIC_TYPE_TABLE[] =
|
||||||
|
|
||||||
struct GLCommandQueue : IGraphicsCommandQueue
|
struct GLCommandQueue : IGraphicsCommandQueue
|
||||||
{
|
{
|
||||||
Platform platform() const {return IGraphicsDataFactory::PlatformOGL;}
|
Platform platform() const {return IGraphicsDataFactory::Platform::OGL;}
|
||||||
const SystemChar* platformName() const {return _S("OGL");}
|
const SystemChar* platformName() const {return _S("OGL");}
|
||||||
IGraphicsContext* m_parent = nullptr;
|
IGraphicsContext* m_parent = nullptr;
|
||||||
|
|
||||||
struct Command
|
struct Command
|
||||||
{
|
{
|
||||||
enum Op
|
enum class Op
|
||||||
{
|
{
|
||||||
OpSetShaderDataBinding,
|
SetShaderDataBinding,
|
||||||
OpSetRenderTarget,
|
SetRenderTarget,
|
||||||
OpSetViewport,
|
SetViewport,
|
||||||
OpSetClearColor,
|
SetClearColor,
|
||||||
OpClearTarget,
|
ClearTarget,
|
||||||
OpSetDrawPrimitive,
|
SetDrawPrimitive,
|
||||||
OpDraw,
|
Draw,
|
||||||
OpDrawIndexed,
|
DrawIndexed,
|
||||||
OpDrawInstances,
|
DrawInstances,
|
||||||
OpDrawInstancesIndexed,
|
DrawInstancesIndexed,
|
||||||
OpPresent
|
Present
|
||||||
} m_op;
|
} m_op;
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
|
@ -614,7 +614,7 @@ struct GLCommandQueue : IGraphicsCommandQueue
|
||||||
for (size_t i=0 ; i<fmt->m_elementCount ; ++i)
|
for (size_t i=0 ; i<fmt->m_elementCount ; ++i)
|
||||||
{
|
{
|
||||||
const VertexElementDescriptor* desc = &fmt->m_elements[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;
|
size_t offset = 0;
|
||||||
|
@ -641,9 +641,9 @@ struct GLCommandQueue : IGraphicsCommandQueue
|
||||||
static_cast<const GLGraphicsBufferS*>(lastEBO)->bindIndex();
|
static_cast<const GLGraphicsBufferS*>(lastEBO)->bindIndex();
|
||||||
}
|
}
|
||||||
glEnableVertexAttribArray(i);
|
glEnableVertexAttribArray(i);
|
||||||
glVertexAttribPointer(i, SEMANTIC_COUNT_TABLE[desc->semantic],
|
glVertexAttribPointer(i, SEMANTIC_COUNT_TABLE[int(desc->semantic)],
|
||||||
SEMANTIC_TYPE_TABLE[desc->semantic], GL_TRUE, stride, (void*)offset);
|
SEMANTIC_TYPE_TABLE[int(desc->semantic)], GL_TRUE, stride, (void*)offset);
|
||||||
offset += SEMANTIC_SIZE_TABLE[desc->semantic];
|
offset += SEMANTIC_SIZE_TABLE[int(desc->semantic)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -715,10 +715,10 @@ struct GLCommandQueue : IGraphicsCommandQueue
|
||||||
{
|
{
|
||||||
switch (cmd.m_op)
|
switch (cmd.m_op)
|
||||||
{
|
{
|
||||||
case Command::OpSetShaderDataBinding:
|
case Command::Op::SetShaderDataBinding:
|
||||||
static_cast<const GLShaderDataBinding*>(cmd.binding)->bind();
|
static_cast<const GLShaderDataBinding*>(cmd.binding)->bind();
|
||||||
break;
|
break;
|
||||||
case Command::OpSetRenderTarget:
|
case Command::Op::SetRenderTarget:
|
||||||
{
|
{
|
||||||
const GLTextureR* tex = static_cast<const GLTextureR*>(cmd.target);
|
const GLTextureR* tex = static_cast<const GLTextureR*>(cmd.target);
|
||||||
if (!tex)
|
if (!tex)
|
||||||
|
@ -727,32 +727,32 @@ struct GLCommandQueue : IGraphicsCommandQueue
|
||||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, tex->m_fbo);
|
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, tex->m_fbo);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Command::OpSetViewport:
|
case Command::Op::SetViewport:
|
||||||
glViewport(cmd.rect.location[0], cmd.rect.location[1],
|
glViewport(cmd.rect.location[0], cmd.rect.location[1],
|
||||||
cmd.rect.size[0], cmd.rect.size[1]);
|
cmd.rect.size[0], cmd.rect.size[1]);
|
||||||
break;
|
break;
|
||||||
case Command::OpSetClearColor:
|
case Command::Op::SetClearColor:
|
||||||
glClearColor(cmd.rgba[0], cmd.rgba[1], cmd.rgba[2], cmd.rgba[3]);
|
glClearColor(cmd.rgba[0], cmd.rgba[1], cmd.rgba[2], cmd.rgba[3]);
|
||||||
break;
|
break;
|
||||||
case Command::OpClearTarget:
|
case Command::Op::ClearTarget:
|
||||||
glClear(cmd.flags);
|
glClear(cmd.flags);
|
||||||
break;
|
break;
|
||||||
case Command::OpSetDrawPrimitive:
|
case Command::Op::SetDrawPrimitive:
|
||||||
prim = cmd.prim;
|
prim = cmd.prim;
|
||||||
break;
|
break;
|
||||||
case Command::OpDraw:
|
case Command::Op::Draw:
|
||||||
glDrawArrays(prim, cmd.start, cmd.count);
|
glDrawArrays(prim, cmd.start, cmd.count);
|
||||||
break;
|
break;
|
||||||
case Command::OpDrawIndexed:
|
case Command::Op::DrawIndexed:
|
||||||
glDrawElements(prim, cmd.count, GL_UNSIGNED_INT, (void*)cmd.start);
|
glDrawElements(prim, cmd.count, GL_UNSIGNED_INT, (void*)cmd.start);
|
||||||
break;
|
break;
|
||||||
case Command::OpDrawInstances:
|
case Command::Op::DrawInstances:
|
||||||
glDrawArraysInstanced(prim, cmd.start, cmd.count, cmd.instCount);
|
glDrawArraysInstanced(prim, cmd.start, cmd.count, cmd.instCount);
|
||||||
break;
|
break;
|
||||||
case Command::OpDrawInstancesIndexed:
|
case Command::Op::DrawInstancesIndexed:
|
||||||
glDrawElementsInstanced(prim, cmd.count, GL_UNSIGNED_INT, (void*)cmd.start, cmd.instCount);
|
glDrawElementsInstanced(prim, cmd.count, GL_UNSIGNED_INT, (void*)cmd.start, cmd.instCount);
|
||||||
break;
|
break;
|
||||||
case Command::OpPresent:
|
case Command::Op::Present:
|
||||||
{
|
{
|
||||||
const GLTextureR* tex = static_cast<const GLTextureR*>(cmd.source);
|
const GLTextureR* tex = static_cast<const GLTextureR*>(cmd.source);
|
||||||
if (tex)
|
if (tex)
|
||||||
|
@ -791,21 +791,21 @@ struct GLCommandQueue : IGraphicsCommandQueue
|
||||||
void setShaderDataBinding(IShaderDataBinding* binding)
|
void setShaderDataBinding(IShaderDataBinding* binding)
|
||||||
{
|
{
|
||||||
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
||||||
cmds.emplace_back(Command::OpSetShaderDataBinding);
|
cmds.emplace_back(Command::Op::SetShaderDataBinding);
|
||||||
cmds.back().binding = binding;
|
cmds.back().binding = binding;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setRenderTarget(ITextureR* target)
|
void setRenderTarget(ITextureR* target)
|
||||||
{
|
{
|
||||||
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
||||||
cmds.emplace_back(Command::OpSetRenderTarget);
|
cmds.emplace_back(Command::Op::SetRenderTarget);
|
||||||
cmds.back().target = target;
|
cmds.back().target = target;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setViewport(const SWindowRect& rect)
|
void setViewport(const SWindowRect& rect)
|
||||||
{
|
{
|
||||||
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
||||||
cmds.emplace_back(Command::OpSetViewport);
|
cmds.emplace_back(Command::Op::SetViewport);
|
||||||
cmds.back().rect = rect;
|
cmds.back().rect = rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -824,7 +824,7 @@ struct GLCommandQueue : IGraphicsCommandQueue
|
||||||
void setClearColor(const float rgba[4])
|
void setClearColor(const float rgba[4])
|
||||||
{
|
{
|
||||||
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
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[0] = rgba[0];
|
||||||
cmds.back().rgba[1] = rgba[1];
|
cmds.back().rgba[1] = rgba[1];
|
||||||
cmds.back().rgba[2] = rgba[2];
|
cmds.back().rgba[2] = rgba[2];
|
||||||
|
@ -834,7 +834,7 @@ struct GLCommandQueue : IGraphicsCommandQueue
|
||||||
void clearTarget(bool render=true, bool depth=true)
|
void clearTarget(bool render=true, bool depth=true)
|
||||||
{
|
{
|
||||||
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
||||||
cmds.emplace_back(Command::OpClearTarget);
|
cmds.emplace_back(Command::Op::ClearTarget);
|
||||||
cmds.back().flags = 0;
|
cmds.back().flags = 0;
|
||||||
if (render)
|
if (render)
|
||||||
cmds.back().flags |= GL_COLOR_BUFFER_BIT;
|
cmds.back().flags |= GL_COLOR_BUFFER_BIT;
|
||||||
|
@ -845,17 +845,17 @@ struct GLCommandQueue : IGraphicsCommandQueue
|
||||||
void setDrawPrimitive(Primitive prim)
|
void setDrawPrimitive(Primitive prim)
|
||||||
{
|
{
|
||||||
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
||||||
cmds.emplace_back(Command::OpSetDrawPrimitive);
|
cmds.emplace_back(Command::Op::SetDrawPrimitive);
|
||||||
if (prim == PrimitiveTriangles)
|
if (prim == Primitive::Triangles)
|
||||||
cmds.back().prim = GL_TRIANGLES;
|
cmds.back().prim = GL_TRIANGLES;
|
||||||
else if (prim == PrimitiveTriStrips)
|
else if (prim == Primitive::TriStrips)
|
||||||
cmds.back().prim = GL_TRIANGLE_STRIP;
|
cmds.back().prim = GL_TRIANGLE_STRIP;
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw(size_t start, size_t count)
|
void draw(size_t start, size_t count)
|
||||||
{
|
{
|
||||||
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
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().start = start;
|
||||||
cmds.back().count = count;
|
cmds.back().count = count;
|
||||||
}
|
}
|
||||||
|
@ -863,7 +863,7 @@ struct GLCommandQueue : IGraphicsCommandQueue
|
||||||
void drawIndexed(size_t start, size_t count)
|
void drawIndexed(size_t start, size_t count)
|
||||||
{
|
{
|
||||||
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
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().start = start;
|
||||||
cmds.back().count = count;
|
cmds.back().count = count;
|
||||||
}
|
}
|
||||||
|
@ -871,7 +871,7 @@ struct GLCommandQueue : IGraphicsCommandQueue
|
||||||
void drawInstances(size_t start, size_t count, size_t instCount)
|
void drawInstances(size_t start, size_t count, size_t instCount)
|
||||||
{
|
{
|
||||||
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
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().start = start;
|
||||||
cmds.back().count = count;
|
cmds.back().count = count;
|
||||||
cmds.back().instCount = instCount;
|
cmds.back().instCount = instCount;
|
||||||
|
@ -880,7 +880,7 @@ struct GLCommandQueue : IGraphicsCommandQueue
|
||||||
void drawInstancesIndexed(size_t start, size_t count, size_t instCount)
|
void drawInstancesIndexed(size_t start, size_t count, size_t instCount)
|
||||||
{
|
{
|
||||||
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
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().start = start;
|
||||||
cmds.back().count = count;
|
cmds.back().count = count;
|
||||||
cmds.back().instCount = instCount;
|
cmds.back().instCount = instCount;
|
||||||
|
@ -889,7 +889,7 @@ struct GLCommandQueue : IGraphicsCommandQueue
|
||||||
void resolveDisplay(ITextureR* source)
|
void resolveDisplay(ITextureR* source)
|
||||||
{
|
{
|
||||||
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
||||||
cmds.emplace_back(Command::OpPresent);
|
cmds.emplace_back(Command::Op::Present);
|
||||||
cmds.back().source = source;
|
cmds.back().source = source;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ extern const DeviceSignature BOO_DEVICE_SIGS[];
|
||||||
|
|
||||||
bool DeviceSignature::DeviceMatchToken(const DeviceToken& token, const TDeviceSignatureSet& sigSet)
|
bool DeviceSignature::DeviceMatchToken(const DeviceToken& token, const TDeviceSignatureSet& sigSet)
|
||||||
{
|
{
|
||||||
if (token.getDeviceType() == DeviceToken::DEVTYPE_GENERICHID)
|
if (token.getDeviceType() == DeviceToken::DeviceType::GenericHID)
|
||||||
return true;
|
return true;
|
||||||
for (const DeviceSignature* sig : sigSet)
|
for (const DeviceSignature* sig : sigSet)
|
||||||
{
|
{
|
||||||
|
@ -27,7 +27,7 @@ DeviceBase* DeviceSignature::DeviceNew(DeviceToken& token)
|
||||||
DeviceBase* retval = NULL;
|
DeviceBase* retval = NULL;
|
||||||
|
|
||||||
/* Early-return for generic HID devices */
|
/* Early-return for generic HID devices */
|
||||||
if (token.getDeviceType() == DeviceToken::DEVTYPE_GENERICHID)
|
if (token.getDeviceType() == DeviceToken::DeviceType::GenericHID)
|
||||||
{
|
{
|
||||||
retval = new GenericPad(&token);
|
retval = new GenericPad(&token);
|
||||||
if (!retval)
|
if (!retval)
|
||||||
|
|
|
@ -20,14 +20,15 @@ DolphinSmashAdapter::~DolphinSmashAdapter()
|
||||||
|
|
||||||
static inline EDolphinControllerType parseType(unsigned char status)
|
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)
|
switch (type)
|
||||||
{
|
{
|
||||||
case DOL_TYPE_NORMAL:
|
case EDolphinControllerType::Normal:
|
||||||
case DOL_TYPE_WAVEBIRD:
|
case EDolphinControllerType::Wavebird:
|
||||||
return (EDolphinControllerType)type;
|
return type;
|
||||||
default:
|
default:
|
||||||
return DOL_TYPE_NONE;
|
return EDolphinControllerType::None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,12 +78,12 @@ void DolphinSmashAdapter::transferCycle()
|
||||||
DolphinControllerState state;
|
DolphinControllerState state;
|
||||||
bool rumble = false;
|
bool rumble = false;
|
||||||
EDolphinControllerType type = parseState(&state, controller, rumble);
|
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_knownControllers |= 1<<i;
|
||||||
m_callback->controllerConnected(i, type);
|
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_knownControllers &= ~(1<<i);
|
||||||
m_callback->controllerDisconnected(i);
|
m_callback->controllerDisconnected(i);
|
||||||
|
|
|
@ -49,8 +49,8 @@ static const uint8_t defaultReport[35] = {
|
||||||
DualshockPad::DualshockPad(DeviceToken* token)
|
DualshockPad::DualshockPad(DeviceToken* token)
|
||||||
: DeviceBase(token),
|
: DeviceBase(token),
|
||||||
m_callback(nullptr),
|
m_callback(nullptr),
|
||||||
m_rumbleRequest(0),
|
m_rumbleRequest(EDualshockMotor::None),
|
||||||
m_rumbleState(0)
|
m_rumbleState(EDualshockMotor::None)
|
||||||
{
|
{
|
||||||
memcpy(m_report.buf, defaultReport, 35);
|
memcpy(m_report.buf, defaultReport, 35);
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ void DualshockPad::transferCycle()
|
||||||
|
|
||||||
if (m_rumbleRequest != m_rumbleState)
|
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.leftDuration = m_rumbleDuration[0];
|
||||||
m_report.rumble.leftForce = m_rumbleIntensity[0];
|
m_report.rumble.leftForce = m_rumbleIntensity[0];
|
||||||
|
@ -107,7 +107,7 @@ void DualshockPad::transferCycle()
|
||||||
m_report.rumble.leftForce = 0;
|
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.rightDuration = m_rumbleDuration[0];
|
||||||
m_report.rumble.rightOn = true;
|
m_report.rumble.rightOn = true;
|
||||||
|
@ -123,9 +123,9 @@ void DualshockPad::transferCycle()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (state.m_reserved5[8] & 0x80)
|
if (state.m_reserved5[8] & 0x80)
|
||||||
m_rumbleRequest &= ~DS3_MOTOR_RIGHT;
|
m_rumbleRequest &= ~EDualshockMotor::Right;
|
||||||
if (state.m_reserved5[7] & 0x01)
|
if (state.m_reserved5[7] & 0x01)
|
||||||
m_rumbleRequest &= ~DS3_MOTOR_LEFT;
|
m_rumbleRequest &= ~EDualshockMotor::Left;
|
||||||
m_rumbleState = m_rumbleRequest;
|
m_rumbleState = m_rumbleRequest;
|
||||||
const double zeroG = 511.5; // 1.65/3.3*1023 (1,65V);
|
const double zeroG = 511.5; // 1.65/3.3*1023 (1,65V);
|
||||||
float accXval = -((double)state.m_accelerometer[0] - zeroG);
|
float accXval = -((double)state.m_accelerometer[0] - zeroG);
|
||||||
|
|
|
@ -243,12 +243,12 @@ public:
|
||||||
{
|
{
|
||||||
devImp.m_hidDev = this;
|
devImp.m_hidDev = this;
|
||||||
std::unique_lock<std::mutex> lk(m_initMutex);
|
std::unique_lock<std::mutex> lk(m_initMutex);
|
||||||
DeviceToken::TDeviceType dType = token.getDeviceType();
|
DeviceToken::DeviceType dType = token.getDeviceType();
|
||||||
if (dType == DeviceToken::DEVTYPE_USB)
|
if (dType == DeviceToken::DeviceType::USB)
|
||||||
m_thread = new std::thread(_threadProcUSBLL, this);
|
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);
|
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);
|
m_thread = new std::thread(_threadProcHID, this);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,11 +34,11 @@ class HIDListenerUdev final : public IHIDListener
|
||||||
|
|
||||||
/* Filter to USB/BT */
|
/* Filter to USB/BT */
|
||||||
const char* dt = udev_device_get_devtype(device);
|
const char* dt = udev_device_get_devtype(device);
|
||||||
DeviceToken::TDeviceType type;
|
DeviceToken::DeviceType type;
|
||||||
if (!strcmp(dt, "usb_device"))
|
if (!strcmp(dt, "usb_device"))
|
||||||
type = DeviceToken::DEVTYPE_USB;
|
type = DeviceToken::DeviceType::USB;
|
||||||
else if (!strcmp(dt, "bluetooth_device"))
|
else if (!strcmp(dt, "bluetooth_device"))
|
||||||
type = DeviceToken::DEVTYPE_BLUETOOTH;
|
type = DeviceToken::DeviceType::Bluetooth;
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -82,9 +82,9 @@ class HIDListenerUdev final : public IHIDListener
|
||||||
{
|
{
|
||||||
/* Matched-insertion failed; see if generic HID interface is available */
|
/* Matched-insertion failed; see if generic HID interface is available */
|
||||||
udev_list_entry* devInterfaces = nullptr;
|
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");
|
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");
|
devInterfaces = udev_list_entry_get_by_name(attrs, "ID_BLUETOOTH_INTERFACES");
|
||||||
if (devInterfaces)
|
if (devInterfaces)
|
||||||
{
|
{
|
||||||
|
@ -101,7 +101,7 @@ class HIDListenerUdev final : public IHIDListener
|
||||||
{
|
{
|
||||||
const char* hidPath = udev_list_entry_get_name(hidEnt);
|
const char* hidPath = udev_list_entry_get_name(hidEnt);
|
||||||
if (!listener->m_finder._hasToken(hidPath))
|
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));
|
vid, pid, manuf, product, hidPath));
|
||||||
}
|
}
|
||||||
udev_enumerate_unref(hidEnum);
|
udev_enumerate_unref(hidEnum);
|
||||||
|
|
|
@ -58,10 +58,10 @@ int ApplicationRun(IApplication::EPlatformType platform,
|
||||||
{
|
{
|
||||||
if (APP)
|
if (APP)
|
||||||
return 1;
|
return 1;
|
||||||
if (platform == IApplication::PLAT_WAYLAND)
|
if (platform == IApplication::EPlatformType::Wayland)
|
||||||
APP = new ApplicationWayland(cb, uniqueName, friendlyName, pname, args, singleInstance);
|
APP = new ApplicationWayland(cb, uniqueName, friendlyName, pname, args, singleInstance);
|
||||||
else if (platform == IApplication::PLAT_XLIB ||
|
else if (platform == IApplication::EPlatformType::Xlib ||
|
||||||
platform == IApplication::PLAT_AUTO)
|
platform == IApplication::EPlatformType::Auto)
|
||||||
APP = new ApplicationXlib(cb, uniqueName, friendlyName, pname, args, singleInstance);
|
APP = new ApplicationXlib(cb, uniqueName, friendlyName, pname, args, singleInstance);
|
||||||
else
|
else
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -43,7 +43,7 @@ public:
|
||||||
|
|
||||||
EPlatformType getPlatformType() const
|
EPlatformType getPlatformType() const
|
||||||
{
|
{
|
||||||
return PLAT_WAYLAND;
|
return EPlatformType::Wayland;
|
||||||
}
|
}
|
||||||
|
|
||||||
int run()
|
int run()
|
||||||
|
|
|
@ -220,7 +220,7 @@ public:
|
||||||
|
|
||||||
EPlatformType getPlatformType() const
|
EPlatformType getPlatformType() const
|
||||||
{
|
{
|
||||||
return PLAT_XLIB;
|
return EPlatformType::Xlib;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Empty handler for SIGINT */
|
/* Empty handler for SIGINT */
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include "boo/IGraphicsContext.hpp"
|
#include "boo/IGraphicsContext.hpp"
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
#undef None
|
||||||
|
|
||||||
namespace boo
|
namespace boo
|
||||||
{
|
{
|
||||||
|
@ -18,7 +19,7 @@ public:
|
||||||
|
|
||||||
GraphicsContextWayland(EGraphicsAPI api, IWindow* parentWindow)
|
GraphicsContextWayland(EGraphicsAPI api, IWindow* parentWindow)
|
||||||
: m_api(api),
|
: m_api(api),
|
||||||
m_pf(PF_RGBA8),
|
m_pf(EPixelFormat::RGBA8),
|
||||||
m_parentWindow(parentWindow)
|
m_parentWindow(parentWindow)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
@ -44,7 +45,7 @@ public:
|
||||||
|
|
||||||
void setPixelFormat(EPixelFormat pf)
|
void setPixelFormat(EPixelFormat pf)
|
||||||
{
|
{
|
||||||
if (pf > PF_RGBAF32_Z24)
|
if (pf > EPixelFormat::RGBAF32_Z24)
|
||||||
return;
|
return;
|
||||||
m_pf = pf;
|
m_pf = pf;
|
||||||
}
|
}
|
||||||
|
@ -93,7 +94,7 @@ struct WindowWayland : IWindow
|
||||||
GraphicsContextWayland m_gfxCtx;
|
GraphicsContextWayland m_gfxCtx;
|
||||||
|
|
||||||
WindowWayland(const std::string& title)
|
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
|
EWindowStyle getStyle() const
|
||||||
{
|
{
|
||||||
return STYLE_NONE;
|
return EWindowStyle::None;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isFullscreen() const
|
bool isFullscreen() const
|
||||||
|
@ -187,7 +188,7 @@ struct WindowWayland : IWindow
|
||||||
|
|
||||||
ETouchType getTouchType() const
|
ETouchType getTouchType() const
|
||||||
{
|
{
|
||||||
return TOUCH_NONE;
|
return ETouchType::None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
#define MWM_FUNC_MAXIMIZE (1L<<4)
|
#define MWM_FUNC_MAXIMIZE (1L<<4)
|
||||||
#define MWM_FUNC_CLOSE (1L<<5)
|
#define MWM_FUNC_CLOSE (1L<<5)
|
||||||
|
|
||||||
|
#undef None
|
||||||
|
|
||||||
typedef GLXContext (*glXCreateContextAttribsARBProc)(Display*, GLXFBConfig, GLXContext, Bool, const int*);
|
typedef GLXContext (*glXCreateContextAttribsARBProc)(Display*, GLXFBConfig, GLXContext, Bool, const int*);
|
||||||
static glXCreateContextAttribsARBProc glXCreateContextAttribsARB = 0;
|
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_CORE_PROFILE_BIT_ARB,
|
||||||
//GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_DEBUG_BIT_ARB,
|
//GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_DEBUG_BIT_ARB,
|
||||||
//GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,
|
//GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,
|
||||||
None
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace boo
|
namespace boo
|
||||||
|
@ -67,75 +68,78 @@ void GLXEnableVSync(Display* disp, GLXWindow drawable);
|
||||||
|
|
||||||
extern int XINPUT_OPCODE;
|
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;
|
specialSym = ESpecialKey::None;
|
||||||
modifierSym = MKEY_NONE;
|
modifierSym = EModifierKey::None;
|
||||||
if (sym >= XK_F1 && sym <= XK_F12)
|
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)
|
else if (sym == XK_Escape)
|
||||||
specialSym = KEY_ESC;
|
specialSym = ESpecialKey::Esc;
|
||||||
else if (sym == XK_Return)
|
else if (sym == XK_Return)
|
||||||
specialSym = KEY_ENTER;
|
specialSym = ESpecialKey::Enter;
|
||||||
else if (sym == XK_BackSpace)
|
else if (sym == XK_BackSpace)
|
||||||
specialSym = KEY_BACKSPACE;
|
specialSym = ESpecialKey::Backspace;
|
||||||
else if (sym == XK_Insert)
|
else if (sym == XK_Insert)
|
||||||
specialSym = KEY_INSERT;
|
specialSym = ESpecialKey::Insert;
|
||||||
else if (sym == XK_Delete)
|
else if (sym == XK_Delete)
|
||||||
specialSym = KEY_DELETE;
|
specialSym = ESpecialKey::Delete;
|
||||||
else if (sym == XK_Home)
|
else if (sym == XK_Home)
|
||||||
specialSym = KEY_HOME;
|
specialSym = ESpecialKey::Home;
|
||||||
else if (sym == XK_End)
|
else if (sym == XK_End)
|
||||||
specialSym = KEY_END;
|
specialSym = ESpecialKey::End;
|
||||||
else if (sym == XK_Page_Up)
|
else if (sym == XK_Page_Up)
|
||||||
specialSym = KEY_PGUP;
|
specialSym = ESpecialKey::PgUp;
|
||||||
else if (sym == XK_Page_Down)
|
else if (sym == XK_Page_Down)
|
||||||
specialSym = KEY_PGDOWN;
|
specialSym = ESpecialKey::PgDown;
|
||||||
else if (sym == XK_Left)
|
else if (sym == XK_Left)
|
||||||
specialSym = KEY_LEFT;
|
specialSym = ESpecialKey::Left;
|
||||||
else if (sym == XK_Right)
|
else if (sym == XK_Right)
|
||||||
specialSym = KEY_RIGHT;
|
specialSym = ESpecialKey::Right;
|
||||||
else if (sym == XK_Up)
|
else if (sym == XK_Up)
|
||||||
specialSym = KEY_UP;
|
specialSym = ESpecialKey::Up;
|
||||||
else if (sym == XK_Down)
|
else if (sym == XK_Down)
|
||||||
specialSym = KEY_DOWN;
|
specialSym = ESpecialKey::Down;
|
||||||
else if (sym == XK_Shift_L || sym == XK_Shift_R)
|
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)
|
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)
|
else if (sym == XK_Alt_L || sym == XK_Alt_R)
|
||||||
modifierSym = MKEY_ALT;
|
modifierSym = EModifierKey::Alt;
|
||||||
else
|
else
|
||||||
return xkb_keysym_to_utf32(sym);
|
return xkb_keysym_to_utf32(sym);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int translateModifiers(unsigned state)
|
static EModifierKey translateModifiers(unsigned state)
|
||||||
{
|
{
|
||||||
int retval = 0;
|
EModifierKey retval = EModifierKey::None;
|
||||||
if (state & ShiftMask)
|
if (state & ShiftMask)
|
||||||
retval |= MKEY_SHIFT;
|
retval |= EModifierKey::Shift;
|
||||||
if (state & ControlMask)
|
if (state & ControlMask)
|
||||||
retval |= MKEY_CTRL;
|
retval |= EModifierKey::Ctrl;
|
||||||
if (state & Mod1Mask)
|
if (state & Mod1Mask)
|
||||||
retval |= MKEY_ALT;
|
retval |= EModifierKey::Alt;
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int translateButton(unsigned detail)
|
static EMouseButton translateButton(unsigned detail)
|
||||||
{
|
{
|
||||||
int retval = 0;
|
switch (detail)
|
||||||
if (detail == 1)
|
{
|
||||||
retval = BUTTON_PRIMARY;
|
case 1:
|
||||||
else if (detail == 3)
|
return EMouseButton::Primary;
|
||||||
retval = BUTTON_SECONDARY;
|
case 3:
|
||||||
else if (detail == 2)
|
return EMouseButton::Secondary;
|
||||||
retval = BUTTON_MIDDLE;
|
case 2:
|
||||||
else if (detail == 8)
|
return EMouseButton::Middle;
|
||||||
retval = BUTTON_AUX1;
|
case 8:
|
||||||
else if (detail == 9)
|
return EMouseButton::Aux1;
|
||||||
retval = BUTTON_AUX2;
|
case 9:
|
||||||
return retval;
|
return EMouseButton::Aux2;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
return EMouseButton::None;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct XCBAtoms
|
struct XCBAtoms
|
||||||
|
@ -198,7 +202,7 @@ public:
|
||||||
Display* display, int defaultScreen,
|
Display* display, int defaultScreen,
|
||||||
GLXContext lastCtx, uint32_t& visualIdOut)
|
GLXContext lastCtx, uint32_t& visualIdOut)
|
||||||
: m_api(api),
|
: m_api(api),
|
||||||
m_pf(PF_RGBA8_Z24),
|
m_pf(EPixelFormat::RGBA8_Z24),
|
||||||
m_parentWindow(parentWindow),
|
m_parentWindow(parentWindow),
|
||||||
m_xDisp(display),
|
m_xDisp(display),
|
||||||
m_lastCtx(lastCtx)
|
m_lastCtx(lastCtx)
|
||||||
|
@ -228,25 +232,25 @@ public:
|
||||||
if (!doubleBuffer)
|
if (!doubleBuffer)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (m_pf == PF_RGBA8 && colorSize >= 32)
|
if (m_pf == EPixelFormat::RGBA8 && colorSize >= 32)
|
||||||
{
|
{
|
||||||
m_fbconfig = config;
|
m_fbconfig = config;
|
||||||
m_visualid = visualId;
|
m_visualid = visualId;
|
||||||
break;
|
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_fbconfig = config;
|
||||||
m_visualid = visualId;
|
m_visualid = visualId;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (m_pf == PF_RGBAF32 && colorSize >= 128)
|
else if (m_pf == EPixelFormat::RGBAF32 && colorSize >= 128)
|
||||||
{
|
{
|
||||||
m_fbconfig = config;
|
m_fbconfig = config;
|
||||||
m_visualid = visualId;
|
m_visualid = visualId;
|
||||||
break;
|
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_fbconfig = config;
|
||||||
m_visualid = visualId;
|
m_visualid = visualId;
|
||||||
|
@ -293,7 +297,7 @@ public:
|
||||||
|
|
||||||
void setPixelFormat(EPixelFormat pf)
|
void setPixelFormat(EPixelFormat pf)
|
||||||
{
|
{
|
||||||
if (pf > PF_RGBAF32_Z24)
|
if (pf > EPixelFormat::RGBAF32_Z24)
|
||||||
return;
|
return;
|
||||||
m_pf = pf;
|
m_pf = pf;
|
||||||
}
|
}
|
||||||
|
@ -342,7 +346,7 @@ public:
|
||||||
if (!vsyncDisp)
|
if (!vsyncDisp)
|
||||||
Log.report(LogVisor::FatalError, "unable to open new vsync display");
|
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);
|
XVisualInfo *vi = glXChooseVisual(vsyncDisp, DefaultScreen(vsyncDisp),attributeList);
|
||||||
|
|
||||||
vsyncCtx = glXCreateContext(vsyncDisp, vi, nullptr, True);
|
vsyncCtx = glXCreateContext(vsyncDisp, vi, nullptr, True);
|
||||||
|
@ -363,7 +367,7 @@ public:
|
||||||
m_vsynccv.notify_one();
|
m_vsynccv.notify_one();
|
||||||
}
|
}
|
||||||
|
|
||||||
glXMakeCurrent(vsyncDisp, None, nullptr);
|
glXMakeCurrent(vsyncDisp, 0, nullptr);
|
||||||
glXDestroyContext(vsyncDisp, vsyncCtx);
|
glXDestroyContext(vsyncDisp, vsyncCtx);
|
||||||
XCloseDisplay(vsyncDisp);
|
XCloseDisplay(vsyncDisp);
|
||||||
});
|
});
|
||||||
|
@ -448,7 +452,7 @@ class WindowXlib : public IWindow
|
||||||
|
|
||||||
/* Last known input device id (0xffff if not yet set) */
|
/* Last known input device id (0xffff if not yet set) */
|
||||||
int m_lastInputID = 0xffff;
|
int m_lastInputID = 0xffff;
|
||||||
ETouchType m_touchType = TOUCH_NONE;
|
ETouchType m_touchType = ETouchType::None;
|
||||||
|
|
||||||
/* Scroll valuators */
|
/* Scroll valuators */
|
||||||
int m_hScrollValuator = -1;
|
int m_hScrollValuator = -1;
|
||||||
|
@ -470,7 +474,7 @@ public:
|
||||||
Display* display, int defaultScreen,
|
Display* display, int defaultScreen,
|
||||||
GLXContext lastCtx)
|
GLXContext lastCtx)
|
||||||
: m_xDisp(display), m_callback(nullptr),
|
: m_xDisp(display), m_callback(nullptr),
|
||||||
m_gfxCtx(IGraphicsContext::API_OPENGL_3_3,
|
m_gfxCtx(IGraphicsContext::EGraphicsAPI::OpenGL3_3,
|
||||||
this, display, defaultScreen,
|
this, display, defaultScreen,
|
||||||
lastCtx, m_visualId)
|
lastCtx, m_visualId)
|
||||||
{
|
{
|
||||||
|
@ -504,7 +508,7 @@ public:
|
||||||
genFrameDefault(screen, x, y, w, h);
|
genFrameDefault(screen, x, y, w, h);
|
||||||
XSetWindowAttributes swa;
|
XSetWindowAttributes swa;
|
||||||
swa.colormap = m_colormapId;
|
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;
|
swa.event_mask = FocusChangeMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask | ExposureMask | StructureNotifyMask | LeaveWindowMask | EnterWindowMask;
|
||||||
|
|
||||||
m_windowId = XCreateWindow(display, screen->root, x, y, w, h, 10,
|
m_windowId = XCreateWindow(display, screen->root, x, y, w, h, 10,
|
||||||
|
@ -538,7 +542,7 @@ public:
|
||||||
XMapWindow(m_xDisp, m_windowId);
|
XMapWindow(m_xDisp, m_windowId);
|
||||||
XFlush(m_xDisp);
|
XFlush(m_xDisp);
|
||||||
|
|
||||||
setStyle(STYLE_DEFAULT);
|
setStyle(EWindowStyle::Default);
|
||||||
|
|
||||||
m_gfxCtx.initializeContext();
|
m_gfxCtx.initializeContext();
|
||||||
}
|
}
|
||||||
|
@ -701,18 +705,18 @@ public:
|
||||||
if (S_ATOMS->m_motifWmHints)
|
if (S_ATOMS->m_motifWmHints)
|
||||||
{
|
{
|
||||||
wmHints.flags = MWM_HINTS_DECORATIONS | MWM_HINTS_FUNCTIONS;
|
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.decorations |= MWM_DECOR_BORDER | MWM_DECOR_TITLE | MWM_DECOR_MINIMIZE | MWM_DECOR_MENU;
|
||||||
wmHints.functions |= MWM_FUNC_MOVE | MWM_FUNC_MINIMIZE;
|
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.decorations |= MWM_DECOR_MAXIMIZE | MWM_DECOR_RESIZEH;
|
||||||
wmHints.functions |= MWM_FUNC_RESIZE | MWM_FUNC_MAXIMIZE;
|
wmHints.functions |= MWM_FUNC_RESIZE | MWM_FUNC_MAXIMIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (style & STYLE_CLOSE)
|
if ((style & EWindowStyle::Close) != EWindowStyle::None)
|
||||||
wmHints.functions |= MWM_FUNC_CLOSE;
|
wmHints.functions |= MWM_FUNC_CLOSE;
|
||||||
|
|
||||||
XLockDisplay(m_xDisp);
|
XLockDisplay(m_xDisp);
|
||||||
|
@ -813,11 +817,11 @@ public:
|
||||||
{
|
{
|
||||||
XITouchClassInfo* touchClass = (XITouchClassInfo*)dclass;
|
XITouchClassInfo* touchClass = (XITouchClassInfo*)dclass;
|
||||||
if (touchClass->mode == XIDirectTouch)
|
if (touchClass->mode == XIDirectTouch)
|
||||||
m_touchType = TOUCH_DISPLAY;
|
m_touchType = ETouchType::Display;
|
||||||
else if (touchClass->mode == XIDependentTouch)
|
else if (touchClass->mode == XIDependentTouch)
|
||||||
m_touchType = TOUCH_TRACKPAD;
|
m_touchType = ETouchType::Trackpad;
|
||||||
else
|
else
|
||||||
m_touchType = TOUCH_NONE;
|
m_touchType = ETouchType::None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -880,19 +884,17 @@ public:
|
||||||
{
|
{
|
||||||
if (m_callback)
|
if (m_callback)
|
||||||
{
|
{
|
||||||
int specialKey;
|
ESpecialKey specialKey;
|
||||||
int modifierKey;
|
EModifierKey modifierKey;
|
||||||
uint32_t charCode = translateKeysym(XLookupKeysym(&event->xkey, 0),
|
uint32_t charCode = translateKeysym(XLookupKeysym(&event->xkey, 0),
|
||||||
specialKey, modifierKey);
|
specialKey, modifierKey);
|
||||||
int modifierMask = translateModifiers(event->xkey.state);
|
EModifierKey modifierMask = translateModifiers(event->xkey.state);
|
||||||
if (charCode)
|
if (charCode)
|
||||||
m_callback->charKeyDown(charCode,
|
m_callback->charKeyDown(charCode, modifierMask, false);
|
||||||
(EModifierKey)modifierMask, false);
|
else if (specialKey != ESpecialKey::None)
|
||||||
else if (specialKey)
|
m_callback->specialKeyDown(specialKey, modifierMask, false);
|
||||||
m_callback->specialKeyDown((ESpecialKey)specialKey,
|
else if (modifierKey != EModifierKey::None)
|
||||||
(EModifierKey)modifierMask, false);
|
m_callback->modKeyDown(modifierKey, false);
|
||||||
else if (modifierKey)
|
|
||||||
m_callback->modKeyDown((EModifierKey)modifierKey, false);
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -900,19 +902,17 @@ public:
|
||||||
{
|
{
|
||||||
if (m_callback)
|
if (m_callback)
|
||||||
{
|
{
|
||||||
int specialKey;
|
ESpecialKey specialKey;
|
||||||
int modifierKey;
|
EModifierKey modifierKey;
|
||||||
uint32_t charCode = translateKeysym(XLookupKeysym(&event->xkey, 0),
|
uint32_t charCode = translateKeysym(XLookupKeysym(&event->xkey, 0),
|
||||||
specialKey, modifierKey);
|
specialKey, modifierKey);
|
||||||
int modifierMask = translateModifiers(event->xkey.state);
|
EModifierKey modifierMask = translateModifiers(event->xkey.state);
|
||||||
if (charCode)
|
if (charCode)
|
||||||
m_callback->charKeyUp(charCode,
|
m_callback->charKeyUp(charCode, modifierMask);
|
||||||
(EModifierKey)modifierMask);
|
else if (specialKey != ESpecialKey::None)
|
||||||
else if (specialKey)
|
m_callback->specialKeyUp(specialKey, modifierMask);
|
||||||
m_callback->specialKeyUp((ESpecialKey)specialKey,
|
else if (modifierKey != EModifierKey::None)
|
||||||
(EModifierKey)modifierMask);
|
m_callback->modKeyUp(modifierKey);
|
||||||
else if (modifierKey)
|
|
||||||
m_callback->modKeyUp((EModifierKey)modifierKey);
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -921,10 +921,10 @@ public:
|
||||||
if (m_callback)
|
if (m_callback)
|
||||||
{
|
{
|
||||||
getWindowFrame(m_wx, m_wy, m_ww, m_wh);
|
getWindowFrame(m_wx, m_wy, m_ww, m_wh);
|
||||||
int button = translateButton(event->xbutton.button);
|
EMouseButton button = translateButton(event->xbutton.button);
|
||||||
if (button)
|
if (button != EMouseButton::None)
|
||||||
{
|
{
|
||||||
int modifierMask = translateModifiers(event->xbutton.state);
|
EModifierKey modifierMask = translateModifiers(event->xbutton.state);
|
||||||
SWindowCoord coord =
|
SWindowCoord coord =
|
||||||
{
|
{
|
||||||
{(unsigned)event->xbutton.x, (unsigned)event->xbutton.y},
|
{(unsigned)event->xbutton.x, (unsigned)event->xbutton.y},
|
||||||
|
@ -968,10 +968,10 @@ public:
|
||||||
if (m_callback)
|
if (m_callback)
|
||||||
{
|
{
|
||||||
getWindowFrame(m_wx, m_wy, m_ww, m_wh);
|
getWindowFrame(m_wx, m_wy, m_ww, m_wh);
|
||||||
int button = translateButton(event->xbutton.button);
|
EMouseButton button = translateButton(event->xbutton.button);
|
||||||
if (button)
|
if (button != EMouseButton::None)
|
||||||
{
|
{
|
||||||
int modifierMask = translateModifiers(event->xbutton.state);
|
EModifierKey modifierMask = translateModifiers(event->xbutton.state);
|
||||||
SWindowCoord coord =
|
SWindowCoord coord =
|
||||||
{
|
{
|
||||||
{(unsigned)event->xbutton.x, (unsigned)event->xbutton.y},
|
{(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
|
if (timeDif >= 1) // wait 30 seconds before issuing another rumble event
|
||||||
{
|
{
|
||||||
ctrl->startRumble(DS3_MOTOR_LEFT);
|
ctrl->startRumble(EDualshockMotor::Left);
|
||||||
ctrl->startRumble(DS3_MOTOR_RIGHT, 100);
|
ctrl->startRumble(EDualshockMotor::Right, 100);
|
||||||
lastTime = timeTotal;
|
lastTime = timeTotal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ public:
|
||||||
if (ds3)
|
if (ds3)
|
||||||
{
|
{
|
||||||
ds3->setCallback(&m_ds3CB);
|
ds3->setCallback(&m_ds3CB);
|
||||||
ds3->setLED(DS3_LED_1);
|
ds3->setLED(EDualshockLED::LED_1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void deviceDisconnected(DeviceToken&, DeviceBase* device)
|
void deviceDisconnected(DeviceToken&, DeviceBase* device)
|
||||||
|
@ -136,11 +136,11 @@ struct CTestWindowCallback : IWindowCallback
|
||||||
|
|
||||||
void mouseDown(const SWindowCoord& coord, EMouseButton button, EModifierKey mods)
|
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)
|
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)
|
void mouseMove(const SWindowCoord& coord)
|
||||||
{
|
{
|
||||||
|
@ -182,7 +182,7 @@ struct CTestWindowCallback : IWindowCallback
|
||||||
}
|
}
|
||||||
void specialKeyDown(ESpecialKey key, EModifierKey mods, bool isRepeat)
|
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;
|
m_fullscreenToggleRequested = true;
|
||||||
}
|
}
|
||||||
void specialKeyUp(ESpecialKey key, EModifierKey mods)
|
void specialKeyUp(ESpecialKey key, EModifierKey mods)
|
||||||
|
@ -251,13 +251,13 @@ struct TestApplicationCallback : IApplicationCallback
|
||||||
{{-0.5,-0.5},{0.0,0.0}}
|
{{-0.5,-0.5},{0.0,0.0}}
|
||||||
};
|
};
|
||||||
IGraphicsBuffer* vbo =
|
IGraphicsBuffer* vbo =
|
||||||
factory->newStaticBuffer(BufferUseVertex, quad, sizeof(Vert), 4);
|
factory->newStaticBuffer(BufferUse::Vertex, quad, sizeof(Vert), 4);
|
||||||
|
|
||||||
/* Make vertex format */
|
/* Make vertex format */
|
||||||
VertexElementDescriptor descs[2] =
|
VertexElementDescriptor descs[2] =
|
||||||
{
|
{
|
||||||
{vbo, nullptr, VertexSemanticPosition},
|
{vbo, nullptr, VertexSemantic::Position},
|
||||||
{vbo, nullptr, VertexSemanticUV}
|
{vbo, nullptr, VertexSemantic::UV}
|
||||||
};
|
};
|
||||||
IVertexFormat* vfmt = factory->newVertexFormat(2, descs);
|
IVertexFormat* vfmt = factory->newVertexFormat(2, descs);
|
||||||
|
|
||||||
|
@ -273,11 +273,11 @@ struct TestApplicationCallback : IApplicationCallback
|
||||||
tex[i][j][3] = 0xff;
|
tex[i][j][3] = 0xff;
|
||||||
}
|
}
|
||||||
ITexture* texture =
|
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 */
|
/* Make shader pipeline */
|
||||||
IShaderPipeline* pipeline = nullptr;
|
IShaderPipeline* pipeline = nullptr;
|
||||||
if (factory->platform() == IGraphicsDataFactory::PlatformOGL)
|
if (factory->platform() == IGraphicsDataFactory::Platform::OGL)
|
||||||
{
|
{
|
||||||
GLDataFactory* glF = dynamic_cast<GLDataFactory*>(factory);
|
GLDataFactory* glF = dynamic_cast<GLDataFactory*>(factory);
|
||||||
|
|
||||||
|
@ -304,7 +304,7 @@ struct TestApplicationCallback : IApplicationCallback
|
||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
pipeline = glF->newShaderPipeline(VS, FS, 1, "texs", 0, nullptr,
|
pipeline = glF->newShaderPipeline(VS, FS, 1, "texs", 0, nullptr,
|
||||||
BlendFactorOne, BlendFactorZero,
|
BlendFactor::One, BlendFactor::Zero,
|
||||||
true, true, false);
|
true, true, false);
|
||||||
}
|
}
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
|
@ -444,7 +444,7 @@ struct TestApplicationCallback : IApplicationCallback
|
||||||
float rgba[] = {sinf(frameIdx / 60.0), cosf(frameIdx / 60.0), 0.0, 1.0};
|
float rgba[] = {sinf(frameIdx / 60.0), cosf(frameIdx / 60.0), 0.0, 1.0};
|
||||||
gfxQ->setClearColor(rgba);
|
gfxQ->setClearColor(rgba);
|
||||||
gfxQ->clearTarget();
|
gfxQ->clearTarget();
|
||||||
gfxQ->setDrawPrimitive(PrimitiveTriStrips);
|
gfxQ->setDrawPrimitive(Primitive::TriStrips);
|
||||||
|
|
||||||
gfxQ->setShaderDataBinding(m_binding);
|
gfxQ->setShaderDataBinding(m_binding);
|
||||||
gfxQ->draw(0, 4);
|
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)
|
int main(int argc, const boo::SystemChar** argv)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
LogVisor::RegisterConsoleLogger();
|
LogVisor::RegisterConsoleLogger();
|
||||||
boo::TestApplicationCallback appCb;
|
boo::TestApplicationCallback appCb;
|
||||||
int ret = ApplicationRun(boo::IApplication::PLAT_AUTO,
|
int ret = ApplicationRun(boo::IApplication::EPlatformType::Auto,
|
||||||
appCb, _S("boo"), _S("Boo"), argc, argv);
|
appCb, _S("boo"), _S("Boo"), argc, argv);
|
||||||
printf("IM DYING!!\n");
|
printf("IM DYING!!\n");
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -509,9 +513,7 @@ int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE, LPWSTR lpCmdLine, int)
|
||||||
booArgv[i+1] = argv[i];
|
booArgv[i+1] = argv[i];
|
||||||
|
|
||||||
LogVisor::CreateWin32Console();
|
LogVisor::CreateWin32Console();
|
||||||
return main(argc+1, booArgv);
|
return wmain(argc+1, booArgv);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue