2015-08-18 22:43:30 +00:00
|
|
|
#include "boo/IWindow.hpp"
|
|
|
|
#include "boo/IGraphicsContext.hpp"
|
2015-05-06 00:50:57 +00:00
|
|
|
|
2015-08-28 00:10:46 +00:00
|
|
|
#include <X11/Xlib.h>
|
2015-11-21 01:12:22 +00:00
|
|
|
#undef None
|
2015-08-28 00:10:46 +00:00
|
|
|
|
2015-05-06 00:50:57 +00:00
|
|
|
namespace boo
|
|
|
|
{
|
|
|
|
|
2015-10-29 04:44:38 +00:00
|
|
|
struct GraphicsContextWayland : IGraphicsContext
|
|
|
|
{
|
|
|
|
|
|
|
|
EGraphicsAPI m_api;
|
|
|
|
EPixelFormat m_pf;
|
|
|
|
IWindow* m_parentWindow;
|
|
|
|
|
|
|
|
public:
|
|
|
|
IWindowCallback* m_callback;
|
|
|
|
|
|
|
|
GraphicsContextWayland(EGraphicsAPI api, IWindow* parentWindow)
|
|
|
|
: m_api(api),
|
2015-11-21 01:12:22 +00:00
|
|
|
m_pf(EPixelFormat::RGBA8),
|
2015-10-29 04:44:38 +00:00
|
|
|
m_parentWindow(parentWindow)
|
|
|
|
{}
|
|
|
|
|
|
|
|
~GraphicsContextWayland()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void _setCallback(IWindowCallback* cb)
|
|
|
|
{
|
|
|
|
m_callback = cb;
|
|
|
|
}
|
|
|
|
|
|
|
|
EGraphicsAPI getAPI() const
|
|
|
|
{
|
|
|
|
return m_api;
|
|
|
|
}
|
|
|
|
|
|
|
|
EPixelFormat getPixelFormat() const
|
|
|
|
{
|
|
|
|
return m_pf;
|
|
|
|
}
|
|
|
|
|
|
|
|
void setPixelFormat(EPixelFormat pf)
|
|
|
|
{
|
2015-11-21 01:12:22 +00:00
|
|
|
if (pf > EPixelFormat::RGBAF32_Z24)
|
2015-10-29 04:44:38 +00:00
|
|
|
return;
|
|
|
|
m_pf = pf;
|
|
|
|
}
|
|
|
|
|
|
|
|
void initializeContext()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void makeCurrent()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-10-31 04:28:21 +00:00
|
|
|
void postInit()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-10-30 06:26:02 +00:00
|
|
|
IGraphicsCommandQueue* getCommandQueue()
|
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
IGraphicsDataFactory* getDataFactory()
|
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2015-11-17 06:41:32 +00:00
|
|
|
IGraphicsDataFactory* getMainContextDataFactory()
|
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2015-10-30 06:26:02 +00:00
|
|
|
IGraphicsDataFactory* getLoadContextDataFactory()
|
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2015-10-31 04:28:21 +00:00
|
|
|
void present()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-10-29 04:44:38 +00:00
|
|
|
};
|
2015-05-06 00:50:57 +00:00
|
|
|
|
2015-08-18 19:40:26 +00:00
|
|
|
struct WindowWayland : IWindow
|
|
|
|
{
|
2015-10-30 06:26:02 +00:00
|
|
|
GraphicsContextWayland m_gfxCtx;
|
|
|
|
|
2015-08-18 19:40:26 +00:00
|
|
|
WindowWayland(const std::string& title)
|
2015-11-21 01:12:22 +00:00
|
|
|
: m_gfxCtx(IGraphicsContext::EGraphicsAPI::OpenGL3_3, this)
|
2015-05-06 00:50:57 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-08-18 19:40:26 +00:00
|
|
|
~WindowWayland()
|
2015-05-06 00:50:57 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void setCallback(IWindowCallback* cb)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void showWindow()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void hideWindow()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string getTitle()
|
|
|
|
{
|
2015-11-05 07:30:40 +00:00
|
|
|
return "";
|
2015-05-06 00:50:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void setTitle(const std::string& title)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
2015-11-30 00:20:20 +00:00
|
|
|
|
|
|
|
void setCursor(EMouseCursor cursor)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void setWaitCursor(bool wait)
|
|
|
|
{
|
|
|
|
}
|
2015-05-06 00:50:57 +00:00
|
|
|
|
|
|
|
void setWindowFrameDefault()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void getWindowFrame(float& xOut, float& yOut, float& wOut, float& hOut) const
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-11-04 03:25:27 +00:00
|
|
|
void getWindowFrame(int& xOut, int& yOut, int& wOut, int& hOut) const
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-05-06 00:50:57 +00:00
|
|
|
void setWindowFrame(float x, float y, float w, float h)
|
|
|
|
{
|
|
|
|
|
2015-11-04 03:25:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void setWindowFrame(int x, int y, int w, int h)
|
|
|
|
{
|
|
|
|
|
2015-05-06 00:50:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
float getVirtualPixelFactor() const
|
|
|
|
{
|
2015-11-05 07:30:40 +00:00
|
|
|
return 0;
|
2015-05-06 00:50:57 +00:00
|
|
|
}
|
|
|
|
|
2015-11-05 07:30:40 +00:00
|
|
|
void setStyle(EWindowStyle /*style*/)
|
|
|
|
{}
|
|
|
|
|
|
|
|
EWindowStyle getStyle() const
|
|
|
|
{
|
2015-11-21 01:12:22 +00:00
|
|
|
return EWindowStyle::None;
|
2015-11-05 07:30:40 +00:00
|
|
|
}
|
|
|
|
|
2015-05-06 00:50:57 +00:00
|
|
|
bool isFullscreen() const
|
|
|
|
{
|
2015-11-05 07:30:40 +00:00
|
|
|
return false;
|
2015-05-06 00:50:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void setFullscreen(bool fs)
|
|
|
|
{
|
|
|
|
|
2015-05-09 05:33:48 +00:00
|
|
|
}
|
|
|
|
|
2015-12-24 20:55:23 +00:00
|
|
|
void claimKeyboardFocus(const int coord[2])
|
2015-12-24 03:30:52 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool clipboardCopy(EClipboardType type, const uint8_t* data, size_t sz)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::unique_ptr<uint8_t[]> clipboardPaste(EClipboardType type, size_t& sz)
|
|
|
|
{
|
|
|
|
return std::unique_ptr<uint8_t[]>();
|
|
|
|
}
|
|
|
|
|
2015-10-31 04:28:21 +00:00
|
|
|
void waitForRetrace()
|
2015-08-28 00:10:46 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-05-09 05:33:48 +00:00
|
|
|
uintptr_t getPlatformHandle() const
|
|
|
|
{
|
2015-11-05 07:30:40 +00:00
|
|
|
return 0;
|
2015-05-06 00:50:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ETouchType getTouchType() const
|
|
|
|
{
|
2015-11-21 01:12:22 +00:00
|
|
|
return ETouchType::None;
|
2015-05-06 00:50:57 +00:00
|
|
|
}
|
|
|
|
|
2015-10-30 06:26:02 +00:00
|
|
|
|
|
|
|
IGraphicsCommandQueue* getCommandQueue()
|
|
|
|
{
|
|
|
|
return m_gfxCtx.getCommandQueue();
|
|
|
|
}
|
|
|
|
|
|
|
|
IGraphicsDataFactory* getDataFactory()
|
|
|
|
{
|
|
|
|
return m_gfxCtx.getDataFactory();
|
|
|
|
}
|
|
|
|
|
2015-11-17 06:41:32 +00:00
|
|
|
IGraphicsDataFactory* getMainContextDataFactory()
|
|
|
|
{
|
|
|
|
return m_gfxCtx.getMainContextDataFactory();
|
|
|
|
}
|
|
|
|
|
2015-10-30 06:26:02 +00:00
|
|
|
IGraphicsDataFactory* getLoadContextDataFactory()
|
|
|
|
{
|
|
|
|
return m_gfxCtx.getLoadContextDataFactory();
|
|
|
|
}
|
|
|
|
|
2015-05-06 00:50:57 +00:00
|
|
|
};
|
|
|
|
|
2015-10-28 01:47:55 +00:00
|
|
|
IWindow* _WindowWaylandNew(const std::string& title)
|
2015-05-06 00:50:57 +00:00
|
|
|
{
|
2015-08-18 19:40:26 +00:00
|
|
|
return new WindowWayland(title);
|
2015-05-06 00:50:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|