Compare commits
No commits in common. "77e475980df90460dd9e9aa9bc034e38208992d0" and "81d092e9673e15ec780756971b6e3dff5bd8768a" have entirely different histories.
77e475980d
...
81d092e967
2
deps/ox/src/ox/model/fieldcounter.hpp
vendored
2
deps/ox/src/ox/model/fieldcounter.hpp
vendored
@ -67,7 +67,7 @@ consteval auto modelFieldCount() noexcept {
|
|||||||
auto t = a.allocate(1);
|
auto t = a.allocate(1);
|
||||||
detail::FieldCounter<T> c;
|
detail::FieldCounter<T> c;
|
||||||
const auto err = model(&c, t);
|
const auto err = model(&c, t);
|
||||||
oxAssert(err, "Count failed");
|
//oxAssert(err, "Count failed");
|
||||||
a.deallocate(t, 1);
|
a.deallocate(t, 1);
|
||||||
return c.fields;
|
return c.fields;
|
||||||
}
|
}
|
||||||
|
@ -15,24 +15,15 @@
|
|||||||
|
|
||||||
namespace turbine {
|
namespace turbine {
|
||||||
|
|
||||||
[[nodiscard]]
|
|
||||||
inline GlfwContext &glctx(Context &ctx) noexcept {
|
|
||||||
if constexpr(ox::defines::Debug) {
|
|
||||||
return dynamic_cast<GlfwContext&>(ctx);
|
|
||||||
} else {
|
|
||||||
return static_cast<GlfwContext&>(ctx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace gl {
|
namespace gl {
|
||||||
|
|
||||||
void addDrawer(Context &ctx, Drawer *cd) noexcept {
|
void addDrawer(Context &ctx, Drawer *cd) noexcept {
|
||||||
auto &gctx = glctx(ctx);
|
auto &gctx = static_cast<GlfwContext&>(ctx);
|
||||||
gctx.drawers.emplace_back(cd);
|
gctx.drawers.emplace_back(cd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void removeDrawer(Context &ctx, Drawer *cd) noexcept {
|
void removeDrawer(Context &ctx, Drawer *cd) noexcept {
|
||||||
auto &gctx = glctx(ctx);
|
auto &gctx = static_cast<GlfwContext&>(ctx);
|
||||||
for (auto i = 0u; i < gctx.drawers.size(); ++i) {
|
for (auto i = 0u; i < gctx.drawers.size(); ++i) {
|
||||||
if (gctx.drawers[i] == cd) {
|
if (gctx.drawers[i] == cd) {
|
||||||
oxIgnoreError(gctx.drawers.erase(i));
|
oxIgnoreError(gctx.drawers.erase(i));
|
||||||
@ -74,7 +65,7 @@ static void handleKeyPress(Context *ctx, int key, bool down) noexcept {
|
|||||||
return map;
|
return map;
|
||||||
}();
|
}();
|
||||||
const auto eventHandler = keyEventHandler(*ctx);
|
const auto eventHandler = keyEventHandler(*ctx);
|
||||||
auto &gctx = glctx(*ctx);
|
auto &gctx = static_cast<GlfwContext&>(*ctx);
|
||||||
const auto k = keyMap[static_cast<std::size_t>(key)];
|
const auto k = keyMap[static_cast<std::size_t>(key)];
|
||||||
setKeyDownStatus(&gctx, k, down);
|
setKeyDownStatus(&gctx, k, down);
|
||||||
if (eventHandler) {
|
if (eventHandler) {
|
||||||
@ -209,7 +200,7 @@ static void themeImgui() noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ox::Error initGfx(Context &ctx) noexcept {
|
ox::Error initGfx(Context &ctx) noexcept {
|
||||||
auto &gctx = glctx(ctx);
|
auto &gctx = static_cast<GlfwContext&>(ctx);
|
||||||
glfwSetErrorCallback(handleGlfwError);
|
glfwSetErrorCallback(handleGlfwError);
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
|
||||||
@ -247,40 +238,40 @@ ox::Error initGfx(Context &ctx) noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setWindowTitle(Context &ctx, ox::CRStringView title) noexcept {
|
void setWindowTitle(Context &ctx, ox::CRStringView title) noexcept {
|
||||||
auto &gctx = glctx(ctx);
|
auto &gctx = static_cast<GlfwContext&>(ctx);
|
||||||
auto cstr = ox_malloca(title.bytes() + 1, char);
|
auto cstr = ox_malloca(title.bytes() + 1, char);
|
||||||
ox_strncpy(cstr.get(), title.data(), title.bytes());
|
ox_strncpy(cstr.get(), title.data(), title.bytes());
|
||||||
glfwSetWindowTitle(gctx.window, cstr);
|
glfwSetWindowTitle(gctx.window, cstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void focusWindow(Context &ctx) noexcept {
|
void focusWindow(Context &ctx) noexcept {
|
||||||
auto &gctx = glctx(ctx);
|
auto &gctx = static_cast<GlfwContext&>(ctx);
|
||||||
glfwFocusWindow(gctx.window);
|
glfwFocusWindow(gctx.window);
|
||||||
}
|
}
|
||||||
|
|
||||||
int getScreenWidth(Context &ctx) noexcept {
|
int getScreenWidth(Context &ctx) noexcept {
|
||||||
auto &gctx = glctx(ctx);
|
auto &gctx = static_cast<GlfwContext&>(ctx);
|
||||||
int w = 0, h = 0;
|
int w = 0, h = 0;
|
||||||
glfwGetFramebufferSize(gctx.window, &w, &h);
|
glfwGetFramebufferSize(gctx.window, &w, &h);
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getScreenHeight(Context &ctx) noexcept {
|
int getScreenHeight(Context &ctx) noexcept {
|
||||||
auto &gctx = glctx(ctx);
|
auto &gctx = static_cast<GlfwContext&>(ctx);
|
||||||
int w = 0, h = 0;
|
int w = 0, h = 0;
|
||||||
glfwGetFramebufferSize(gctx.window, &w, &h);
|
glfwGetFramebufferSize(gctx.window, &w, &h);
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
ox::Size getScreenSize(Context &ctx) noexcept {
|
ox::Size getScreenSize(Context &ctx) noexcept {
|
||||||
auto &gctx = glctx(ctx);
|
auto &gctx = static_cast<GlfwContext&>(ctx);
|
||||||
int w = 0, h = 0;
|
int w = 0, h = 0;
|
||||||
glfwGetFramebufferSize(gctx.window, &w, &h);
|
glfwGetFramebufferSize(gctx.window, &w, &h);
|
||||||
return {w, h};
|
return {w, h};
|
||||||
}
|
}
|
||||||
|
|
||||||
ox::Bounds getWindowBounds(Context &ctx) noexcept {
|
ox::Bounds getWindowBounds(Context &ctx) noexcept {
|
||||||
auto &gctx = glctx(ctx);
|
auto &gctx = static_cast<GlfwContext&>(ctx);
|
||||||
ox::Bounds bnds;
|
ox::Bounds bnds;
|
||||||
glfwGetWindowPos(gctx.window, &bnds.x, &bnds.y);
|
glfwGetWindowPos(gctx.window, &bnds.x, &bnds.y);
|
||||||
glfwGetWindowSize(gctx.window, &bnds.width, &bnds.height);
|
glfwGetWindowSize(gctx.window, &bnds.width, &bnds.height);
|
||||||
@ -288,14 +279,14 @@ ox::Bounds getWindowBounds(Context &ctx) noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ox::Error setWindowBounds(Context &ctx, const ox::Bounds &bnds) noexcept {
|
ox::Error setWindowBounds(Context &ctx, const ox::Bounds &bnds) noexcept {
|
||||||
auto &gctx = glctx(ctx);
|
auto &gctx = static_cast<GlfwContext&>(ctx);
|
||||||
glfwSetWindowPos(gctx.window, bnds.x, bnds.y);
|
glfwSetWindowPos(gctx.window, bnds.x, bnds.y);
|
||||||
glfwSetWindowSize(gctx.window, bnds.width, bnds.height);
|
glfwSetWindowSize(gctx.window, bnds.width, bnds.height);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void setConstantRefresh(Context &ctx, bool r) noexcept {
|
void setConstantRefresh(Context &ctx, bool r) noexcept {
|
||||||
auto &gctx = glctx(ctx);
|
auto &gctx = static_cast<GlfwContext&>(ctx);
|
||||||
gctx.constantRefresh = r;
|
gctx.constantRefresh = r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user