added new clang format and fixed window creation endless loops + implemented missing functions
parent
04d4e2a02f
commit
c43377a5a1
|
@ -0,0 +1,121 @@
|
|||
---
|
||||
Language: Cpp
|
||||
# BasedOnStyle: LLVM
|
||||
AccessModifierOffset: -4
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveDeclarations: false
|
||||
AlignEscapedNewlines: Right
|
||||
AlignOperands: true
|
||||
AlignTrailingComments: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortBlocksOnASingleLine: false
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: All
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: MultiLine
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BraceWrapping:
|
||||
AfterClass: false
|
||||
AfterControlStatement: false
|
||||
AfterEnum: false
|
||||
AfterFunction: false
|
||||
AfterNamespace: false
|
||||
AfterObjCDeclaration: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
AfterExternBlock: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: true
|
||||
SplitEmptyRecord: true
|
||||
SplitEmptyNamespace: true
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeBraces: Attach
|
||||
BreakBeforeInheritanceComma: false
|
||||
BreakInheritanceList: BeforeColon
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
BreakConstructorInitializers: BeforeColon
|
||||
BreakAfterJavaFieldAnnotations: false
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 80
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: true
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
FixNamespaceComments: true
|
||||
ForEachMacros:
|
||||
- foreach
|
||||
- Q_FOREACH
|
||||
- BOOST_FOREACH
|
||||
IncludeBlocks: Preserve
|
||||
IncludeCategories:
|
||||
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
||||
Priority: 2
|
||||
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
|
||||
Priority: 3
|
||||
- Regex: '.*'
|
||||
Priority: 1
|
||||
IncludeIsMainRegex: '(Test)?$'
|
||||
IndentCaseLabels: false
|
||||
IndentPPDirectives: None
|
||||
IndentWidth: 4
|
||||
IndentWrappedFunctionNames: false
|
||||
JavaScriptQuotes: Leave
|
||||
JavaScriptWrapImports: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: None
|
||||
ObjCBinPackProtocolList: Auto
|
||||
ObjCBlockIndentWidth: 4
|
||||
ObjCSpaceAfterProperty: false
|
||||
ObjCSpaceBeforeProtocolList: true
|
||||
PenaltyBreakAssignment: 4
|
||||
PenaltyBreakBeforeFirstCallParameter: 19
|
||||
PenaltyBreakComment: 300
|
||||
PenaltyBreakFirstLessLess: 120
|
||||
PenaltyBreakString: 1000
|
||||
PenaltyBreakTemplateDeclaration: 10
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyReturnTypeOnItsOwnLine: 60
|
||||
PointerAlignment: Right
|
||||
ReflowComments: true
|
||||
SortIncludes: true
|
||||
SortUsingDeclarations: true
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCpp11BracedList: false
|
||||
SpaceBeforeCtorInitializerColon: true
|
||||
SpaceBeforeInheritanceColon: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesInAngles: false
|
||||
SpacesInContainerLiterals: true
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: Cpp11
|
||||
StatementMacros:
|
||||
- Q_UNUSED
|
||||
- QT_REQUIRE_VERSION
|
||||
TabWidth: 4
|
||||
UseTab: ForContinuationAndIndentation
|
||||
...
|
||||
|
|
@ -5,14 +5,11 @@
|
|||
#include "window_xcb.h"
|
||||
|
||||
namespace gin {
|
||||
XcbDevice::XcbDevice(::Display* display, int screen,
|
||||
xcb_connection_t* xcb_connection, xcb_screen_t* xcb_screen,
|
||||
Own<InputStream>&& an)
|
||||
: display{display},
|
||||
screen{screen},
|
||||
xcb_connection{xcb_connection},
|
||||
xcb_screen{xcb_screen},
|
||||
async_notifier{std::move(an)},
|
||||
XcbDevice::XcbDevice(::Display *display, int screen,
|
||||
xcb_connection_t *xcb_connection, xcb_screen_t *xcb_screen,
|
||||
Own<InputStream> &&an)
|
||||
: display{display}, screen{screen}, xcb_connection{xcb_connection},
|
||||
xcb_screen{xcb_screen}, async_notifier{std::move(an)},
|
||||
async_conveyor{async_notifier->readReady()
|
||||
.then([this]() { handleEvents(); })
|
||||
.buffer(1)} {}
|
||||
|
@ -28,7 +25,9 @@ void XcbDevice::windowDestroyed(xcb_window_t window_id) {
|
|||
windows.erase(window_id);
|
||||
}
|
||||
|
||||
Own<XcbWindow> XcbDevice::createXcbWindow(const VideoMode& video_mode,
|
||||
void XcbDevice::handleEvents() {}
|
||||
|
||||
Own<XcbWindow> XcbDevice::createXcbWindow(const VideoMode &video_mode,
|
||||
std::string_view title_view,
|
||||
int visual_id) {
|
||||
assert(xcb_screen);
|
||||
|
@ -45,9 +44,9 @@ Own<XcbWindow> XcbDevice::createXcbWindow(const VideoMode& video_mode,
|
|||
uint32_t valuemask = XCB_CW_EVENT_MASK | XCB_CW_COLORMAP;
|
||||
|
||||
xcb_create_window(xcb_connection, XCB_COPY_FROM_PARENT, xcb_window,
|
||||
xcb_screen->root, 0, 0, video_mode.width, video_mode.height,
|
||||
0, XCB_WINDOW_CLASS_INPUT_OUTPUT, visual_id, valuemask,
|
||||
valuelist);
|
||||
xcb_screen->root, 0, 0, video_mode.width,
|
||||
video_mode.height, 0, XCB_WINDOW_CLASS_INPUT_OUTPUT,
|
||||
visual_id, valuemask, valuelist);
|
||||
|
||||
xcb_change_property(xcb_connection, XCB_PROP_MODE_REPLACE, xcb_window,
|
||||
XCB_ATOM_WM_NAME, XCB_ATOM_STRING, 8, title_view.size(),
|
||||
|
@ -59,7 +58,7 @@ Own<XcbWindow> XcbDevice::createXcbWindow(const VideoMode& video_mode,
|
|||
title_view);
|
||||
}
|
||||
|
||||
Own<Window> XcbDevice::createWindow(const VideoMode& video_mode,
|
||||
Own<Window> XcbDevice::createWindow(const VideoMode &video_mode,
|
||||
std::string_view title_view) {
|
||||
assert(xcb_screen);
|
||||
return createXcbWindow(video_mode, title_view, xcb_screen->root_visual);
|
||||
|
@ -70,8 +69,8 @@ void XcbDevice::flush() {
|
|||
xcb_flush(xcb_connection);
|
||||
}
|
||||
|
||||
Own<XcbDevice> createXcbDevice(AsyncIoProvider& provider) {
|
||||
::Display* display = ::XOpenDisplay(nullptr);
|
||||
Own<XcbDevice> createXcbDevice(AsyncIoProvider &provider) {
|
||||
::Display *display = ::XOpenDisplay(nullptr);
|
||||
if (!display) {
|
||||
/// @todo log errors
|
||||
return nullptr;
|
||||
|
@ -79,7 +78,7 @@ Own<XcbDevice> createXcbDevice(AsyncIoProvider& provider) {
|
|||
|
||||
int screen = ::XDefaultScreen(display);
|
||||
|
||||
xcb_connection_t* xcb_connection = ::XGetXCBConnection(display);
|
||||
xcb_connection_t *xcb_connection = ::XGetXCBConnection(display);
|
||||
if (!xcb_connection) {
|
||||
/// @todo log errors
|
||||
::XCloseDisplay(display);
|
||||
|
@ -102,13 +101,13 @@ Own<XcbDevice> createXcbDevice(AsyncIoProvider& provider) {
|
|||
--screen_i, xcb_screen_next(&screen_iter))
|
||||
;
|
||||
|
||||
xcb_screen_t* xcb_screen = screen_iter.data;
|
||||
xcb_screen_t *xcb_screen = screen_iter.data;
|
||||
|
||||
return heap<XcbDevice>(display, screen, xcb_connection, xcb_screen,
|
||||
std::move(fd_wrapped));
|
||||
}
|
||||
|
||||
Own<Device> createDevice(AsyncIoProvider& provider) {
|
||||
Own<Device> createDevice(AsyncIoProvider &provider) {
|
||||
return createXcbDevice(provider);
|
||||
}
|
||||
} // namespace gin
|
|
@ -12,33 +12,33 @@
|
|||
|
||||
namespace gin {
|
||||
class XcbDevice final : public Device {
|
||||
public:
|
||||
::Display* display;
|
||||
public:
|
||||
::Display *display;
|
||||
int screen;
|
||||
|
||||
xcb_connection_t* xcb_connection;
|
||||
xcb_screen_t* xcb_screen;
|
||||
xcb_connection_t *xcb_connection;
|
||||
xcb_screen_t *xcb_screen;
|
||||
|
||||
Own<InputStream> async_notifier;
|
||||
Conveyor<void> async_conveyor;
|
||||
|
||||
std::map<xcb_window_t, XcbWindow*> windows;
|
||||
std::map<xcb_window_t, XcbWindow *> windows;
|
||||
|
||||
public:
|
||||
XcbDevice(::Display* display, int screen, xcb_connection_t* xcb_connection,
|
||||
xcb_screen_t* xcb_screen, Own<InputStream>&& an);
|
||||
public:
|
||||
XcbDevice(::Display *display, int screen, xcb_connection_t *xcb_connection,
|
||||
xcb_screen_t *xcb_screen, Own<InputStream> &&an);
|
||||
~XcbDevice();
|
||||
|
||||
void windowDestroyed(xcb_window_t window_id);
|
||||
void handleEvents();
|
||||
|
||||
Own<XcbWindow> createXcbWindow(const VideoMode& mode,
|
||||
Own<XcbWindow> createXcbWindow(const VideoMode &mode,
|
||||
std::string_view title_view, int visual_id);
|
||||
Own<Window> createWindow(const VideoMode& video_mode,
|
||||
Own<Window> createWindow(const VideoMode &video_mode,
|
||||
std::string_view title_view) override;
|
||||
|
||||
void flush() override;
|
||||
};
|
||||
|
||||
Own<XcbDevice> createXcbDevice(AsyncIoProvider& provider);
|
||||
Own<XcbDevice> createXcbDevice(AsyncIoProvider &provider);
|
||||
} // namespace gin
|
||||
|
|
|
@ -7,31 +7,33 @@
|
|||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
#include "device_xcb.h"
|
||||
#include "../device_xcb.h"
|
||||
#include "gl_window_xcb.h"
|
||||
|
||||
namespace gin {
|
||||
namespace {
|
||||
GlxLibraryExtensions glxLibraryExtensions(const char* extension_string) {
|
||||
GlxLibraryExtensions glxLibraryExtensions(const char *extension_string) {
|
||||
std::string_view extensions_view{extension_string};
|
||||
std::set<std::string_view> extensions;
|
||||
while (1) {
|
||||
size_t n = extensions_view.find_first_not_of(' ');
|
||||
size_t n = extensions_view.find_first_of(' ');
|
||||
if (n != extensions_view.npos && n < extensions_view.size()) {
|
||||
std::string_view sub_glx_ext = extensions_view.substr(0, n);
|
||||
extensions.insert(sub_glx_ext);
|
||||
extensions_view.remove_prefix(n + 1);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
auto find = extensions.find("glXCreateContextAttribsARB");
|
||||
GLXContext (*glXCreateContextAttribsARB)(Display*, GLXFBConfig, GLXContext,
|
||||
Bool, const int*) = nullptr;
|
||||
auto find = extensions.find("GLX_ARB_create_context");
|
||||
GLXContext (*glXCreateContextAttribsARB)(Display *, GLXFBConfig, GLXContext,
|
||||
Bool, const int *) = nullptr;
|
||||
if (find != extensions.end()) {
|
||||
glXCreateContextAttribsARB = reinterpret_cast<GLXContext (*)(
|
||||
Display*, GLXFBConfig, GLXContext, Bool, const int*)>(
|
||||
glXGetProcAddress(
|
||||
reinterpret_cast<const GLubyte*>("glXCreateContextAttribsARB")));
|
||||
Display *, GLXFBConfig, GLXContext, Bool, const int *)>(
|
||||
glXGetProcAddress(reinterpret_cast<const GLubyte *>(
|
||||
"glXCreateContextAttribsARB")));
|
||||
}
|
||||
return {extensions_view, glXCreateContextAttribsARB};
|
||||
}
|
||||
|
@ -61,14 +63,11 @@ int translateDrawableTypeSetting(GlSettings::DrawableType cmp) {
|
|||
}
|
||||
} // namespace
|
||||
|
||||
XcbGlContext::XcbGlContext(const GlxLibraryExtensions& ext_lib,
|
||||
Own<XcbDevice>&& dev, int visual_id,
|
||||
XcbGlContext::XcbGlContext(const GlxLibraryExtensions &ext_lib,
|
||||
Own<XcbDevice> &&dev, int visual_id,
|
||||
GLXContext context, GLXFBConfig fb_config)
|
||||
: ext_lib{ext_lib},
|
||||
device{std::move(dev)},
|
||||
visual_id{visual_id},
|
||||
context{context},
|
||||
fb_config{fb_config} {}
|
||||
: ext_lib{ext_lib}, device{std::move(dev)}, visual_id{visual_id},
|
||||
context{context}, fb_config{fb_config} {}
|
||||
|
||||
XcbGlContext::~XcbGlContext() {
|
||||
assert(device);
|
||||
|
@ -82,15 +81,33 @@ XcbGlContext::~XcbGlContext() {
|
|||
|
||||
void XcbGlContext::bind() {}
|
||||
|
||||
Own<GlWindow> XcbGlContext::createWindow(const VideoMode& video_mode,
|
||||
Own<GlWindow> XcbGlContext::createWindow(const VideoMode &video_mode,
|
||||
std::string_view title_view) {
|
||||
assert(device);
|
||||
if (!device) {
|
||||
return nullptr;
|
||||
}
|
||||
gin::Own<XcbWindow> window =
|
||||
device->createXcbWindow(video_mode, title_view, visual_id);
|
||||
if (!window) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
::GLXWindow glx_window = glXCreateWindow(device->display, fb_config,
|
||||
window->xcb_window, nullptr);
|
||||
|
||||
return gin::heap<XcbGlWindow>(std::move(window), *this, glx_window);
|
||||
}
|
||||
|
||||
void XcbGlContext::flush() {}
|
||||
void XcbGlContext::flush() {
|
||||
assert(device);
|
||||
if (device) {
|
||||
device->flush();
|
||||
}
|
||||
}
|
||||
|
||||
Own<GlContext> createGlContext(AsyncIoProvider& provider,
|
||||
const GlSettings& settings) {
|
||||
Own<GlContext> createGlContext(AsyncIoProvider &provider,
|
||||
const GlSettings &settings) {
|
||||
Own<XcbDevice> device = createXcbDevice(provider);
|
||||
if (!device) {
|
||||
return nullptr;
|
||||
|
@ -142,8 +159,8 @@ Own<GlContext> createGlContext(AsyncIoProvider& provider,
|
|||
GlxLibraryExtensions lib_ext = glxLibraryExtensions(
|
||||
glXQueryExtensionsString(device->display, device->screen));
|
||||
|
||||
GLXFBConfig* fb_configs = glXChooseFBConfig(device->display, device->screen,
|
||||
&attributes[0], &num_fb_configs);
|
||||
GLXFBConfig *fb_configs = glXChooseFBConfig(
|
||||
device->display, device->screen, &attributes[0], &num_fb_configs);
|
||||
if (!fb_configs || num_fb_configs == 0) {
|
||||
/// @todo log errors
|
||||
return nullptr;
|
||||
|
@ -167,8 +184,8 @@ Own<GlContext> createGlContext(AsyncIoProvider& provider,
|
|||
: GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB);
|
||||
glx_attribs.push_back(None);
|
||||
|
||||
context = lib_ext.glXCreateContextAttribsARB(device->display, fb_config,
|
||||
NULL, True, &glx_attribs[0]);
|
||||
context = lib_ext.glXCreateContextAttribsARB(
|
||||
device->display, fb_config, NULL, True, &glx_attribs[0]);
|
||||
if (!context) {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -9,29 +9,29 @@
|
|||
|
||||
namespace gin {
|
||||
struct GlxLibraryExtensions {
|
||||
public:
|
||||
public:
|
||||
std::string_view raw_extension_string;
|
||||
|
||||
GLXContext (*glXCreateContextAttribsARB)(Display*, GLXFBConfig, GLXContext,
|
||||
Bool, const int*) = nullptr;
|
||||
GLXContext (*glXCreateContextAttribsARB)(Display *, GLXFBConfig, GLXContext,
|
||||
Bool, const int *) = nullptr;
|
||||
};
|
||||
|
||||
class XcbDevice;
|
||||
class XcbGlContext final : public GlContext {
|
||||
private:
|
||||
public:
|
||||
GlxLibraryExtensions ext_lib;
|
||||
Own<XcbDevice> device;
|
||||
int visual_id;
|
||||
GLXContext context;
|
||||
GLXFBConfig fb_config;
|
||||
|
||||
public:
|
||||
XcbGlContext(const GlxLibraryExtensions&, Own<XcbDevice>&&, int, GLXContext,
|
||||
GLXFBConfig);
|
||||
public:
|
||||
XcbGlContext(const GlxLibraryExtensions &, Own<XcbDevice> &&, int,
|
||||
GLXContext, GLXFBConfig);
|
||||
~XcbGlContext();
|
||||
|
||||
void bind() override;
|
||||
Own<GlWindow> createWindow(const VideoMode&, std::string_view) override;
|
||||
Own<GlWindow> createWindow(const VideoMode &, std::string_view) override;
|
||||
|
||||
void flush() override;
|
||||
};
|
||||
|
|
|
@ -1,5 +1,32 @@
|
|||
#include "gl_window_xcb.h"
|
||||
|
||||
#include "window_xcb.h"
|
||||
#include "gl_context_xcb.h"
|
||||
|
||||
namespace gin {}
|
||||
#include "../device_xcb.h"
|
||||
#include "../window_xcb.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
namespace gin {
|
||||
XcbGlWindow::XcbGlWindow(Own<XcbWindow> &&win, XcbGlContext &ctx,
|
||||
::GLXWindow glx_win)
|
||||
: window{std::move(win)}, context{ctx}, glx_window{glx_win} {}
|
||||
|
||||
XcbGlWindow::~XcbGlWindow() {
|
||||
assert(context.device);
|
||||
if (context.device) {
|
||||
glXDestroyWindow(context.device->display, glx_window);
|
||||
}
|
||||
}
|
||||
|
||||
void XcbGlWindow::bind() {}
|
||||
|
||||
void XcbGlWindow::show() {
|
||||
assert(window);
|
||||
if (window) {
|
||||
window->show();
|
||||
}
|
||||
}
|
||||
|
||||
void XcbGlWindow::swap() {}
|
||||
} // namespace gin
|
|
@ -9,14 +9,18 @@ namespace gin {
|
|||
class XcbWindow;
|
||||
class XcbGlContext;
|
||||
class XcbGlWindow final : public GlWindow {
|
||||
public:
|
||||
public:
|
||||
Own<XcbWindow> window;
|
||||
XcbGlContext& context;
|
||||
XcbGlContext &context;
|
||||
|
||||
::GLXWindow glx_window;
|
||||
|
||||
public:
|
||||
XcbGlWindow(Own<XcbWindow>&&, XcbGlContext&, ::GLXWindow);
|
||||
public:
|
||||
XcbGlWindow(Own<XcbWindow> &&, XcbGlContext &, ::GLXWindow);
|
||||
~XcbGlWindow();
|
||||
|
||||
void bind() override;
|
||||
void swap() override;
|
||||
void show() override;
|
||||
};
|
||||
} // namespace gin
|
|
@ -5,14 +5,11 @@
|
|||
#include "device_xcb.h"
|
||||
|
||||
namespace gin {
|
||||
XcbWindow::XcbWindow(XcbDevice& device, xcb_window_t xcb_window,
|
||||
xcb_colormap_t xcb_colormap, const VideoMode& video_mode,
|
||||
XcbWindow::XcbWindow(XcbDevice &device, xcb_window_t xcb_window,
|
||||
xcb_colormap_t xcb_colormap, const VideoMode &video_mode,
|
||||
std::string_view title_view)
|
||||
: device{device},
|
||||
xcb_window{xcb_window},
|
||||
xcb_colormap{xcb_colormap},
|
||||
video_mode{video_mode},
|
||||
window_title{title_view} {}
|
||||
: device{device}, xcb_window{xcb_window}, xcb_colormap{xcb_colormap},
|
||||
video_mode{video_mode}, window_title{title_view} {}
|
||||
|
||||
XcbWindow::~XcbWindow() {
|
||||
device.windowDestroyed(xcb_window);
|
||||
|
@ -30,7 +27,7 @@ void XcbWindow::hide() {
|
|||
xcb_unmap_window(device.xcb_connection, xcb_window);
|
||||
}
|
||||
|
||||
const VideoMode& XcbWindow::videoMode() const { return video_mode; }
|
||||
const VideoMode &XcbWindow::videoMode() const { return video_mode; }
|
||||
|
||||
const std::string_view XcbWindow::title() const { return window_title; }
|
||||
} // namespace gin
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
namespace gin {
|
||||
class XcbDevice;
|
||||
class XcbWindow final : public Window {
|
||||
public:
|
||||
XcbDevice& device;
|
||||
public:
|
||||
XcbDevice &device;
|
||||
|
||||
xcb_window_t xcb_window;
|
||||
xcb_colormap_t xcb_colormap;
|
||||
|
@ -20,16 +20,16 @@ class XcbWindow final : public Window {
|
|||
VideoMode video_mode;
|
||||
std::string window_title;
|
||||
|
||||
public:
|
||||
XcbWindow(XcbDevice& device, xcb_window_t xcb_window,
|
||||
xcb_colormap_t xcb_colormap, const VideoMode& video_mode,
|
||||
public:
|
||||
XcbWindow(XcbDevice &device, xcb_window_t xcb_window,
|
||||
xcb_colormap_t xcb_colormap, const VideoMode &video_mode,
|
||||
std::string_view title_view);
|
||||
~XcbWindow();
|
||||
|
||||
void show() override;
|
||||
void hide() override;
|
||||
|
||||
const VideoMode& videoMode() const override;
|
||||
const VideoMode &videoMode() const override;
|
||||
const std::string_view title() const override;
|
||||
};
|
||||
} // namespace gin
|
|
@ -8,14 +8,14 @@
|
|||
|
||||
namespace gin {
|
||||
class Device {
|
||||
public:
|
||||
public:
|
||||
virtual ~Device() = default;
|
||||
|
||||
virtual Own<Window> createWindow(const VideoMode& mode,
|
||||
virtual Own<Window> createWindow(const VideoMode &mode,
|
||||
std::string_view title_view) = 0;
|
||||
virtual void flush() = 0;
|
||||
};
|
||||
|
||||
class AsyncIoProvider;
|
||||
Own<Device> createDevice(AsyncIoProvider& provider);
|
||||
Own<Device> createDevice(AsyncIoProvider &provider);
|
||||
} // namespace gin
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
namespace gin {
|
||||
class GlSettings {
|
||||
public:
|
||||
public:
|
||||
uint8_t gl_major = 3;
|
||||
uint8_t gl_minor = 3;
|
||||
|
||||
|
@ -48,15 +48,15 @@ class GlSettings {
|
|||
};
|
||||
|
||||
class GlContext {
|
||||
public:
|
||||
public:
|
||||
virtual ~GlContext() = default;
|
||||
|
||||
virtual void bind() = 0;
|
||||
virtual Own<GlWindow> createWindow(const VideoMode&, std::string_view) = 0;
|
||||
virtual Own<GlWindow> createWindow(const VideoMode &, std::string_view) = 0;
|
||||
|
||||
virtual void flush() = 0;
|
||||
};
|
||||
|
||||
class AsyncIoProvider;
|
||||
Own<GlContext> createGlContext(AsyncIoProvider&, const GlSettings&);
|
||||
Own<GlContext> createGlContext(AsyncIoProvider &, const GlSettings &);
|
||||
} // namespace gin
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#pragma once
|
||||
|
||||
#include "video_mode.h"
|
||||
#include "../video_mode.h"
|
||||
|
||||
namespace gin {
|
||||
class GlWindow {
|
||||
public:
|
||||
public:
|
||||
virtual ~GlWindow() = default;
|
||||
|
||||
virtual void bind() = 0;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace gin {
|
||||
class VideoMode {
|
||||
public:
|
||||
public:
|
||||
size_t height = 128;
|
||||
size_t width = 128;
|
||||
};
|
||||
|
|
|
@ -8,13 +8,13 @@
|
|||
|
||||
namespace gin {
|
||||
class Window {
|
||||
public:
|
||||
public:
|
||||
virtual ~Window() = default;
|
||||
|
||||
virtual void show() = 0;
|
||||
virtual void hide() = 0;
|
||||
|
||||
virtual const VideoMode& videoMode() const = 0;
|
||||
virtual const VideoMode &videoMode() const = 0;
|
||||
virtual const std::string_view title() const = 0;
|
||||
};
|
||||
} // namespace gin
|
||||
|
|
Loading…
Reference in New Issue