windows enum refactor fixes

This commit is contained in:
Jack Andersen 2015-11-20 16:58:56 -10:00
parent d040e20096
commit 84b78f2962
7 changed files with 118 additions and 119 deletions

View File

@ -55,7 +55,7 @@ class D3D11GraphicsBufferS : public IGraphicsBufferS
: m_stride(stride), m_count(count), m_sz(stride * count)
{
D3D11_SUBRESOURCE_DATA iData = {data};
ThrowIfFailed(ctx->m_dev->CreateBuffer(&CD3D11_BUFFER_DESC(m_sz, USE_TABLE[use], D3D11_USAGE_IMMUTABLE), &iData, &m_buf));
ThrowIfFailed(ctx->m_dev->CreateBuffer(&CD3D11_BUFFER_DESC(m_sz, USE_TABLE[int(use)], D3D11_USAGE_IMMUTABLE), &iData, &m_buf));
}
public:
size_t m_stride;
@ -74,7 +74,7 @@ class D3D11GraphicsBufferD : public IGraphicsBufferD
{
size_t sz = stride * count;
for (int i=0 ; i<3 ; ++i)
ThrowIfFailed(ctx->m_dev->CreateBuffer(&CD3D11_BUFFER_DESC(sz, USE_TABLE[use],
ThrowIfFailed(ctx->m_dev->CreateBuffer(&CD3D11_BUFFER_DESC(sz, USE_TABLE[int(use)],
D3D11_USAGE_DYNAMIC, D3D11_CPU_ACCESS_WRITE), nullptr, &m_bufs[i]));
}
public:
@ -257,12 +257,12 @@ struct D3D11VertexFormat : IVertexFormat
{
const VertexElementDescriptor* elemin = &elements[i];
D3D11_INPUT_ELEMENT_DESC& elem = m_elements[i];
elem.SemanticName = SEMANTIC_NAME_TABLE[elemin->semantic];
elem.SemanticName = SEMANTIC_NAME_TABLE[int(elemin->semantic)];
elem.SemanticIndex = elemin->semanticIdx;
elem.Format = SEMANTIC_TYPE_TABLE[elemin->semantic];
elem.Format = SEMANTIC_TYPE_TABLE[int(elemin->semantic)];
elem.AlignedByteOffset = offset;
elem.InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
offset += SEMANTIC_SIZE_TABLE[elemin->semantic];
offset += SEMANTIC_SIZE_TABLE[int(elemin->semantic)];
}
}
};
@ -304,9 +304,9 @@ class D3D11ShaderPipeline : public IShaderPipeline
ThrowIfFailed(ctx->m_dev->CreateDepthStencilState(&dsDesc, &m_dsState));
CD3D11_BLEND_DESC blDesc(D3D11_DEFAULT);
blDesc.RenderTarget[0].BlendEnable = (dstFac != BlendFactorZero);
blDesc.RenderTarget[0].SrcBlend = BLEND_FACTOR_TABLE[srcFac];
blDesc.RenderTarget[0].DestBlend = BLEND_FACTOR_TABLE[dstFac];
blDesc.RenderTarget[0].BlendEnable = (dstFac != BlendFactor::Zero);
blDesc.RenderTarget[0].SrcBlend = BLEND_FACTOR_TABLE[int(srcFac)];
blDesc.RenderTarget[0].DestBlend = BLEND_FACTOR_TABLE[int(dstFac)];
ThrowIfFailed(ctx->m_dev->CreateBlendState(&blDesc, &m_blState));
ThrowIfFailed(ctx->m_dev->CreateInputLayout(vtxFmt->m_elements.get(), vtxFmt->m_elementCount,
@ -421,12 +421,12 @@ struct D3D11ShaderDataBinding : IShaderDataBinding
ID3D11ShaderResourceView* srvs[8];
for (int i=0 ; i<8 && i<m_texCount ; ++i)
{
if (m_texs[i]->type() == ITexture::TextureDynamic)
if (m_texs[i]->type() == TextureType::Dynamic)
{
D3D11TextureD* ctex = static_cast<D3D11TextureD*>(m_texs[i]);
srvs[i] = ctex->m_srvs[b].Get();
}
else if (m_texs[i]->type() == ITexture::TextureStatic)
else if (m_texs[i]->type() == TextureType::Static)
{
D3D11TextureS* ctex = static_cast<D3D11TextureS*>(m_texs[i]);
srvs[i] = ctex->m_srv.Get();
@ -439,7 +439,7 @@ struct D3D11ShaderDataBinding : IShaderDataBinding
struct D3D11CommandQueue : IGraphicsCommandQueue
{
Platform platform() const {return IGraphicsDataFactory::PlatformD3D11;}
Platform platform() const {return IGraphicsDataFactory::Platform::D3D11;}
const SystemChar* platformName() const {return _S("D3D11");}
D3D11Context* m_ctx;
D3D11Context::Window* m_windowCtx;
@ -609,9 +609,9 @@ struct D3D11CommandQueue : IGraphicsCommandQueue
void setDrawPrimitive(Primitive prim)
{
if (prim == PrimitiveTriangles)
if (prim == Primitive::Triangles)
m_deferredCtx->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
else if (prim == PrimitiveTriStrips)
else if (prim == Primitive::TriStrips)
m_deferredCtx->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
}
@ -714,7 +714,7 @@ public:
{}
~D3D11DataFactory() = default;
Platform platform() const {return PlatformD3D11;}
Platform platform() const {return Platform::D3D11;}
const SystemChar* platformName() const {return _S("D3D11");}
IGraphicsBufferS* newStaticBuffer(BufferUse use, const void* data, size_t stride, size_t count)

View File

@ -65,7 +65,7 @@ class D3D12GraphicsBufferS : public IGraphicsBufferS
size_t m_sz;
D3D12_RESOURCE_DESC m_gpuDesc;
D3D12GraphicsBufferS(BufferUse use, D3D12Context* ctx, const void* data, size_t stride, size_t count)
: m_state(USE_TABLE[use]), m_stride(stride), m_count(count), m_sz(stride * count)
: m_state(USE_TABLE[int(use)]), m_stride(stride), m_count(count), m_sz(stride * count)
{
m_gpuDesc = CD3DX12_RESOURCE_DESC::Buffer(m_sz);
size_t reqSz = GetRequiredIntermediateSize(ctx->m_dev.Get(), &m_gpuDesc, 0, 1);
@ -109,7 +109,7 @@ class D3D12GraphicsBufferD : public IGraphicsBufferD
size_t m_mappedSz;
void* m_mappedBuf = nullptr;
D3D12GraphicsBufferD(D3D12CommandQueue* q, BufferUse use, D3D12Context* ctx, size_t stride, size_t count)
: m_state(USE_TABLE[use]), m_q(q), m_stride(stride), m_count(count)
: m_state(USE_TABLE[int(use)]), m_q(q), m_stride(stride), m_count(count)
{
size_t sz = stride * count;
D3D12_RESOURCE_DESC desc = CD3DX12_RESOURCE_DESC::Buffer(sz);
@ -373,12 +373,12 @@ struct D3D12VertexFormat : IVertexFormat
{
const VertexElementDescriptor* elemin = &elements[i];
D3D12_INPUT_ELEMENT_DESC& elem = m_elements[i];
elem.SemanticName = SEMANTIC_NAME_TABLE[elemin->semantic];
elem.SemanticName = SEMANTIC_NAME_TABLE[int(elemin->semantic)];
elem.SemanticIndex = elemin->semanticIdx;
elem.Format = SEMANTIC_TYPE_TABLE[elemin->semantic];
elem.Format = SEMANTIC_TYPE_TABLE[int(elemin->semantic)];
elem.AlignedByteOffset = offset;
elem.InputSlotClass = D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA;
offset += SEMANTIC_SIZE_TABLE[elemin->semantic];
offset += SEMANTIC_SIZE_TABLE[int(elemin->semantic)];
}
}
};
@ -410,11 +410,11 @@ class D3D12ShaderPipeline : public IShaderPipeline
desc.VS = {vert->GetBufferPointer(), vert->GetBufferSize()};
desc.PS = {pixel->GetBufferPointer(), pixel->GetBufferSize()};
desc.BlendState = CD3DX12_BLEND_DESC(D3D12_DEFAULT);
if (dstFac != BlendFactorZero)
if (dstFac != BlendFactor::Zero)
{
desc.BlendState.RenderTarget[0].BlendEnable = true;
desc.BlendState.RenderTarget[0].SrcBlend = BLEND_FACTOR_TABLE[srcFac];
desc.BlendState.RenderTarget[0].DestBlend = BLEND_FACTOR_TABLE[dstFac];
desc.BlendState.RenderTarget[0].SrcBlend = BLEND_FACTOR_TABLE[int(srcFac)];
desc.BlendState.RenderTarget[0].DestBlend = BLEND_FACTOR_TABLE[int(dstFac)];
}
desc.RasterizerState = CD3DX12_RASTERIZER_DESC(D3D12_DEFAULT);
if (!backfaceCulling)
@ -456,9 +456,9 @@ static UINT64 PlaceBufferForGPU(IGraphicsBuffer* buf, D3D12Context* ctx, ID3D12H
static UINT64 PlaceTextureForGPU(ITexture* tex, D3D12Context* ctx, ID3D12Heap* gpuHeap, UINT64 offset)
{
if (tex->type() == ITexture::TextureDynamic)
if (tex->type() == TextureType::Dynamic)
return static_cast<D3D12TextureD*>(tex)->placeForGPU(ctx, gpuHeap, offset);
else if (tex->type() == ITexture::TextureStatic)
else if (tex->type() == TextureType::Static)
return static_cast<D3D12TextureS*>(tex)->placeForGPU(ctx, gpuHeap, offset);
return offset;
}
@ -526,12 +526,12 @@ static ID3D12Resource* GetBufferGPUResource(const IGraphicsBuffer* buf, int idx,
static ID3D12Resource* GetTextureGPUResource(const ITexture* tex, int idx)
{
if (tex->type() == ITexture::TextureDynamic)
if (tex->type() == TextureType::Dynamic)
{
const D3D12TextureD* ctex = static_cast<const D3D12TextureD*>(tex);
return ctex->m_gpuTexs[0].Get();
}
else if (tex->type() == ITexture::TextureStatic)
else if (tex->type() == TextureType::Static)
{
const D3D12TextureS* ctex = static_cast<const D3D12TextureS*>(tex);
return ctex->m_gpuTex.Get();
@ -651,7 +651,7 @@ static ID3D12GraphicsCommandList* WaitForLoadList(D3D12Context* ctx)
struct D3D12CommandQueue : IGraphicsCommandQueue
{
Platform platform() const {return IGraphicsDataFactory::PlatformD3D12;}
Platform platform() const {return IGraphicsDataFactory::Platform::D3D12;}
const SystemChar* platformName() const {return _S("D3D12");}
D3D12Context* m_ctx;
D3D12Context::Window* m_windowCtx;
@ -762,9 +762,9 @@ struct D3D12CommandQueue : IGraphicsCommandQueue
void setDrawPrimitive(Primitive prim)
{
if (prim == PrimitiveTriangles)
if (prim == Primitive::Triangles)
m_cmdList->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
else if (prim == PrimitiveTriStrips)
else if (prim == Primitive::TriStrips)
m_cmdList->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
}
@ -1005,7 +1005,7 @@ public:
}
~D3D12DataFactory() = default;
Platform platform() const {return PlatformD3D12;}
Platform platform() const {return Platform::D3D12;}
const SystemChar* platformName() const {return _S("D3D12");}
IGraphicsBufferS* newStaticBuffer(BufferUse use, const void* data, size_t stride, size_t count)

View File

@ -33,7 +33,7 @@ class HIDDeviceWinUSB final : public IHIDDevice
const std::string& m_devPath;
std::mutex m_initMutex;
std::condition_variable m_initCond;
std::thread* m_thread;
std::thread m_thread;
bool _sendUSBInterruptTransfer(const uint8_t* data, size_t length)
{
@ -196,13 +196,13 @@ public:
{
devImp.m_hidDev = this;
std::unique_lock<std::mutex> lk(m_initMutex);
DeviceToken::TDeviceType dType = token.getDeviceType();
if (dType == DeviceToken::DEVTYPE_USB)
m_thread = new std::thread(_threadProcUSBLL, this);
else if (dType == DeviceToken::DEVTYPE_BLUETOOTH)
m_thread = new std::thread(_threadProcBTLL, this);
else if (dType == DeviceToken::DEVTYPE_GENERICHID)
m_thread = new std::thread(_threadProcHID, this);
DeviceToken::DeviceType dType = token.getDeviceType();
if (dType == DeviceToken::DeviceType::USB)
m_thread = std::thread(_threadProcUSBLL, this);
else if (dType == DeviceToken::DeviceType::Bluetooth)
m_thread = std::thread(_threadProcBTLL, this);
else if (dType == DeviceToken::DeviceType::GenericHID)
m_thread = std::thread(_threadProcHID, this);
else
throw std::runtime_error("invalid token supplied to device constructor");
m_initCond.wait(lk);
@ -211,8 +211,7 @@ public:
~HIDDeviceWinUSB()
{
m_runningTransferLoop = false;
m_thread->join();
delete m_thread;
m_thread.join();
}

View File

@ -142,7 +142,7 @@ class HIDListenerWinUSB final : public IHIDListener
/* Whew!! that's a single device enumerated!! */
if (!m_finder._hasToken(DeviceInterfaceDetailData.wtf.DevicePath))
m_finder._insertToken(DeviceToken(DeviceToken::DEVTYPE_USB,
m_finder._insertToken(DeviceToken(DeviceToken::DeviceType::USB,
vid, pid, manuf, product,
DeviceInterfaceDetailData.wtf.DevicePath));

View File

@ -225,7 +225,7 @@ public:
EPlatformType getPlatformType() const
{
return PLAT_WIN32;
return EPlatformType::Win32;
}
LRESULT winHwndHandler(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
@ -362,8 +362,8 @@ int ApplicationRun(IApplication::EPlatformType platform,
{
if (APP)
return 1;
if (platform != IApplication::PLAT_WIN32 &&
platform != IApplication::PLAT_AUTO)
if (platform != IApplication::EPlatformType::Win32 &&
platform != IApplication::EPlatformType::Auto)
return 1;
/* One class for *all* boo windows */

View File

@ -40,7 +40,7 @@ struct GraphicsContextWin32 : IGraphicsContext
ComPtr<IDXGIOutput> m_output;
GraphicsContextWin32(EGraphicsAPI api, IWindow* parentWindow, Boo3DAppContext& b3dCtx)
: m_api(api),
m_pf(PF_RGBA8),
m_pf(EPixelFormat::RGBA8),
m_parentWindow(parentWindow),
m_3dCtx(b3dCtx) {}
};
@ -148,7 +148,7 @@ public:
void setPixelFormat(EPixelFormat pf)
{
if (pf > PF_RGBAF32_Z24)
if (pf > EPixelFormat::RGBAF32_Z24)
return;
m_pf = pf;
}
@ -288,7 +288,7 @@ public:
void setPixelFormat(EPixelFormat pf)
{
if (pf > PF_RGBAF32_Z24)
if (pf > EPixelFormat::RGBAF32_Z24)
return;
m_pf = pf;
}
@ -379,66 +379,66 @@ static void genFrameDefault(MONITORINFO* screen, int& xOut, int& yOut, int& wOut
hOut = height;
}
static uint32_t translateKeysym(WPARAM sym, int& specialSym, int& modifierSym)
static uint32_t translateKeysym(WPARAM sym, ESpecialKey& specialSym, EModifierKey& modifierSym)
{
specialSym = KEY_NONE;
modifierSym = MKEY_NONE;
specialSym = ESpecialKey::None;
modifierSym = EModifierKey::None;
if (sym >= VK_F1 && sym <= VK_F12)
specialSym = KEY_F1 + sym - VK_F1;
specialSym = ESpecialKey(uint32_t(ESpecialKey::F1) + sym - VK_F1);
else if (sym == VK_ESCAPE)
specialSym = KEY_ESC;
specialSym = ESpecialKey::Esc;
else if (sym == VK_RETURN)
specialSym = KEY_ENTER;
specialSym = ESpecialKey::Enter;
else if (sym == VK_BACK)
specialSym = KEY_BACKSPACE;
specialSym = ESpecialKey::Backspace;
else if (sym == VK_INSERT)
specialSym = KEY_INSERT;
specialSym = ESpecialKey::Insert;
else if (sym == VK_DELETE)
specialSym = KEY_DELETE;
specialSym = ESpecialKey::Delete;
else if (sym == VK_HOME)
specialSym = KEY_HOME;
specialSym = ESpecialKey::Home;
else if (sym == VK_END)
specialSym = KEY_END;
specialSym = ESpecialKey::End;
else if (sym == VK_PRIOR)
specialSym = KEY_PGUP;
specialSym = ESpecialKey::PgUp;
else if (sym == VK_NEXT)
specialSym = KEY_PGDOWN;
specialSym = ESpecialKey::PgDown;
else if (sym == VK_LEFT)
specialSym = KEY_LEFT;
specialSym = ESpecialKey::Left;
else if (sym == VK_RIGHT)
specialSym = KEY_RIGHT;
specialSym = ESpecialKey::Right;
else if (sym == VK_UP)
specialSym = KEY_UP;
specialSym = ESpecialKey::Up;
else if (sym == VK_DOWN)
specialSym = KEY_DOWN;
specialSym = ESpecialKey::Down;
else if (sym == VK_LSHIFT || sym == VK_RSHIFT)
modifierSym = MKEY_SHIFT;
modifierSym = EModifierKey::Shift;
else if (sym == VK_LCONTROL || sym == VK_RCONTROL)
modifierSym = MKEY_CTRL;
modifierSym = EModifierKey::Ctrl;
else if (sym == VK_MENU)
modifierSym = MKEY_ALT;
modifierSym = EModifierKey::Alt;
else
return MapVirtualKey(sym, MAPVK_VK_TO_CHAR);
return 0;
}
static int translateModifiers(UINT msg)
static EModifierKey translateModifiers(UINT msg)
{
int retval = 0;
EModifierKey retval = EModifierKey::None;
if ((GetKeyState(VK_LSHIFT) & 0x8000) != 0 || (GetKeyState(VK_RSHIFT) & 0x8000) != 0)
retval |= MKEY_SHIFT;
retval |= EModifierKey::Shift;
if ((GetKeyState(VK_LCONTROL) & 0x8000) != 0 || (GetKeyState(VK_RCONTROL) & 0x8000) != 0)
retval |= MKEY_CTRL;
retval |= EModifierKey::Ctrl;
if ((GetKeyState(VK_MENU) & 0x8000) != 0)
retval |= MKEY_ALT;
retval |= EModifierKey::Alt;
if (msg == WM_SYSKEYDOWN || msg == WM_SYSKEYUP)
retval |= MKEY_ALT;
retval |= EModifierKey::Alt;
return retval;
}
class WindowWin32 : public IWindow
{
friend GraphicsContextWin32;
friend struct GraphicsContextWin32;
HWND m_hwnd;
std::unique_ptr<GraphicsContextWin32> m_gfxCtx;
IWindowCallback* m_callback = nullptr;
@ -450,14 +450,14 @@ public:
m_hwnd = CreateWindowW(L"BooWindow", title.c_str(), WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, NULL, NULL);
IGraphicsContext::EGraphicsAPI api = IGraphicsContext::API_D3D11;
IGraphicsContext::EGraphicsAPI api = IGraphicsContext::EGraphicsAPI::D3D11;
#if _WIN32_WINNT_WIN10
if (b3dCtx.m_ctx12.m_dev)
api = IGraphicsContext::API_D3D12;
api = IGraphicsContext::EGraphicsAPI::D3D12;
#endif
if (b3dCtx.m_ctxOgl.m_dxFactory)
{
m_gfxCtx.reset(new GraphicsContextWin32GL(IGraphicsContext::API_OPENGL_3_3, this, m_hwnd, b3dCtx));
m_gfxCtx.reset(new GraphicsContextWin32GL(IGraphicsContext::EGraphicsAPI::OpenGL3_3, this, m_hwnd, b3dCtx));
return;
}
m_gfxCtx.reset(new GraphicsContextWin32D3D(api, this, m_hwnd, b3dCtx));
@ -573,14 +573,14 @@ public:
{
int x, y, w, h;
getWindowFrame(x, y, w, h);
int modifierMask = translateModifiers(e.uMsg);
EModifierKey modifierMask = translateModifiers(e.uMsg);
SWindowCoord coord =
{
{(unsigned)GET_X_LPARAM(e.lParam), (unsigned)GET_Y_LPARAM(e.lParam)},
{(unsigned)GET_X_LPARAM(e.lParam), (unsigned)GET_Y_LPARAM(e.lParam)},
{float(GET_X_LPARAM(e.lParam)) / float(w), float(GET_Y_LPARAM(e.lParam)) / float(h)}
};
m_callback->mouseDown(coord, button, EModifierKey(modifierMask));
m_callback->mouseDown(coord, button, modifierMask);
}
}
@ -590,14 +590,14 @@ public:
{
int x, y, w, h;
getWindowFrame(x, y, w, h);
int modifierMask = translateModifiers(e.uMsg);
EModifierKey modifierMask = translateModifiers(e.uMsg);
SWindowCoord coord =
{
{(unsigned)GET_X_LPARAM(e.lParam), (unsigned)GET_Y_LPARAM(e.lParam)},
{(unsigned)GET_X_LPARAM(e.lParam), (unsigned)GET_Y_LPARAM(e.lParam)},
{float(GET_X_LPARAM(e.lParam)) / float(w), float(GET_Y_LPARAM(e.lParam)) / float(h)}
};
m_callback->mouseUp(coord, button, EModifierKey(modifierMask));
m_callback->mouseUp(coord, button, modifierMask);
}
}
@ -647,16 +647,16 @@ public:
{
if (m_callback)
{
int specialKey;
int modifierKey;
ESpecialKey specialKey;
EModifierKey modifierKey;
uint32_t charCode = translateKeysym(e.wParam, specialKey, modifierKey);
int modifierMask = translateModifiers(e.uMsg);
EModifierKey modifierMask = translateModifiers(e.uMsg);
if (charCode)
m_callback->charKeyDown(charCode, EModifierKey(modifierMask), (e.lParam & 0xffff) != 0);
else if (specialKey)
m_callback->specialKeyDown(ESpecialKey(specialKey), EModifierKey(modifierMask), (e.lParam & 0xffff) != 0);
else if (modifierKey)
m_callback->modKeyDown(EModifierKey(modifierKey), (e.lParam & 0xffff) != 0);
m_callback->charKeyDown(charCode, modifierMask, (e.lParam & 0xffff) != 0);
else if (specialKey != ESpecialKey::None)
m_callback->specialKeyDown(specialKey, modifierMask, (e.lParam & 0xffff) != 0);
else if (modifierKey != EModifierKey::None)
m_callback->modKeyDown(modifierKey, (e.lParam & 0xffff) != 0);
}
return;
}
@ -665,63 +665,63 @@ public:
{
if (m_callback)
{
int specialKey;
int modifierKey;
ESpecialKey specialKey;
EModifierKey modifierKey;
uint32_t charCode = translateKeysym(e.wParam, specialKey, modifierKey);
int modifierMask = translateModifiers(e.uMsg);
EModifierKey modifierMask = translateModifiers(e.uMsg);
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;
}
case WM_LBUTTONDOWN:
{
buttonDown(e, BUTTON_PRIMARY);
buttonDown(e, EMouseButton::Primary);
return;
}
case WM_LBUTTONUP:
{
buttonUp(e, BUTTON_PRIMARY);
buttonUp(e, EMouseButton::Primary);
return;
}
case WM_RBUTTONDOWN:
{
buttonDown(e, BUTTON_SECONDARY);
buttonDown(e, EMouseButton::Secondary);
return;
}
case WM_RBUTTONUP:
{
buttonUp(e, BUTTON_SECONDARY);
buttonUp(e, EMouseButton::Secondary);
return;
}
case WM_MBUTTONDOWN:
{
buttonDown(e, BUTTON_MIDDLE);
buttonDown(e, EMouseButton::Middle);
return;
}
case WM_MBUTTONUP:
{
buttonUp(e, BUTTON_MIDDLE);
buttonUp(e, EMouseButton::Middle);
return;
}
case WM_XBUTTONDOWN:
{
if (HIWORD(e.wParam) == XBUTTON1)
buttonDown(e, BUTTON_AUX1);
buttonDown(e, EMouseButton::Aux1);
else if (HIWORD(e.wParam) == XBUTTON2)
buttonDown(e, BUTTON_AUX2);
buttonDown(e, EMouseButton::Aux2);
return;
}
case WM_XBUTTONUP:
{
if (HIWORD(e.wParam) == XBUTTON1)
buttonUp(e, BUTTON_AUX1);
buttonUp(e, EMouseButton::Aux1);
else if (HIWORD(e.wParam) == XBUTTON2)
buttonUp(e, BUTTON_AUX2);
buttonUp(e, EMouseButton::Aux2);
return;
}
case WM_MOUSEMOVE:
@ -789,24 +789,24 @@ public:
ETouchType getTouchType() const
{
return TOUCH_NONE;
return ETouchType::None;
}
void setStyle(EWindowStyle style)
{
LONG sty = GetWindowLong(m_hwnd, GWL_STYLE);
if (style & STYLE_TITLEBAR)
if ((style & EWindowStyle::Titlebar) != EWindowStyle::None)
sty |= WS_CAPTION;
else
sty &= ~WS_CAPTION;
if (style & STYLE_RESIZE)
if ((style & EWindowStyle::Resize) != EWindowStyle::None)
sty |= WS_THICKFRAME;
else
sty &= ~WS_THICKFRAME;
if (style & STYLE_CLOSE)
if ((style & EWindowStyle::Close) != EWindowStyle::None)
sty |= (WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX);
else
sty &= ~(WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX);
@ -817,14 +817,14 @@ public:
EWindowStyle getStyle() const
{
LONG sty = GetWindowLong(m_hwnd, GWL_STYLE);
unsigned retval = STYLE_NONE;
EWindowStyle retval = EWindowStyle::None;
if ((sty & WS_CAPTION) != 0)
retval |= STYLE_TITLEBAR;
retval |= EWindowStyle::Titlebar;
if ((sty & WS_THICKFRAME) != 0)
retval |= STYLE_RESIZE;
retval |= EWindowStyle::Resize;
if ((sty & WS_SYSMENU))
retval |= STYLE_CLOSE;
return EWindowStyle(retval);
retval |= EWindowStyle::Close;
return retval;
}
IGraphicsCommandQueue* getCommandQueue()

View File

@ -308,8 +308,8 @@ struct TestApplicationCallback : IApplicationCallback
true, true, false);
}
#if _WIN32
else if (factory->platform() == IGraphicsDataFactory::PlatformD3D12 ||
factory->platform() == IGraphicsDataFactory::PlatformD3D11)
else if (factory->platform() == IGraphicsDataFactory::Platform::D3D12 ||
factory->platform() == IGraphicsDataFactory::Platform::D3D11)
{
ID3DDataFactory* d3dF = dynamic_cast<ID3DDataFactory*>(factory);
@ -337,7 +337,7 @@ struct TestApplicationCallback : IApplicationCallback
ComPtr<ID3DBlob> psCompile;
ComPtr<ID3DBlob> cachedPipeline;
pipeline = d3dF->newShaderPipeline(VS, PS, vsCompile, psCompile, cachedPipeline, vfmt,
BlendFactorOne, BlendFactorZero, true, true, false);
BlendFactor::One, BlendFactor::Zero, true, true, false);
}
#elif BOO_HAS_METAL
else if (factory->platform() == IGraphicsDataFactory::Platform::Metal)