Compare commits

..

No commits in common. "77e475980df90460dd9e9aa9bc034e38208992d0" and "81d092e9673e15ec780756971b6e3dff5bd8768a" have entirely different histories.

2 changed files with 13 additions and 22 deletions

View File

@ -67,7 +67,7 @@ consteval auto modelFieldCount() noexcept {
auto t = a.allocate(1);
detail::FieldCounter<T> c;
const auto err = model(&c, t);
oxAssert(err, "Count failed");
//oxAssert(err, "Count failed");
a.deallocate(t, 1);
return c.fields;
}

View File

@ -15,24 +15,15 @@
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 {
void addDrawer(Context &ctx, Drawer *cd) noexcept {
auto &gctx = glctx(ctx);
auto &gctx = static_cast<GlfwContext&>(ctx);
gctx.drawers.emplace_back(cd);
}
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) {
if (gctx.drawers[i] == cd) {
oxIgnoreError(gctx.drawers.erase(i));
@ -74,7 +65,7 @@ static void handleKeyPress(Context *ctx, int key, bool down) noexcept {
return map;
}();
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)];
setKeyDownStatus(&gctx, k, down);
if (eventHandler) {
@ -209,7 +200,7 @@ static void themeImgui() noexcept {
}
ox::Error initGfx(Context &ctx) noexcept {
auto &gctx = glctx(ctx);
auto &gctx = static_cast<GlfwContext&>(ctx);
glfwSetErrorCallback(handleGlfwError);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 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 {
auto &gctx = glctx(ctx);
auto &gctx = static_cast<GlfwContext&>(ctx);
auto cstr = ox_malloca(title.bytes() + 1, char);
ox_strncpy(cstr.get(), title.data(), title.bytes());
glfwSetWindowTitle(gctx.window, cstr);
}
void focusWindow(Context &ctx) noexcept {
auto &gctx = glctx(ctx);
auto &gctx = static_cast<GlfwContext&>(ctx);
glfwFocusWindow(gctx.window);
}
int getScreenWidth(Context &ctx) noexcept {
auto &gctx = glctx(ctx);
auto &gctx = static_cast<GlfwContext&>(ctx);
int w = 0, h = 0;
glfwGetFramebufferSize(gctx.window, &w, &h);
return w;
}
int getScreenHeight(Context &ctx) noexcept {
auto &gctx = glctx(ctx);
auto &gctx = static_cast<GlfwContext&>(ctx);
int w = 0, h = 0;
glfwGetFramebufferSize(gctx.window, &w, &h);
return h;
}
ox::Size getScreenSize(Context &ctx) noexcept {
auto &gctx = glctx(ctx);
auto &gctx = static_cast<GlfwContext&>(ctx);
int w = 0, h = 0;
glfwGetFramebufferSize(gctx.window, &w, &h);
return {w, h};
}
ox::Bounds getWindowBounds(Context &ctx) noexcept {
auto &gctx = glctx(ctx);
auto &gctx = static_cast<GlfwContext&>(ctx);
ox::Bounds bnds;
glfwGetWindowPos(gctx.window, &bnds.x, &bnds.y);
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 {
auto &gctx = glctx(ctx);
auto &gctx = static_cast<GlfwContext&>(ctx);
glfwSetWindowPos(gctx.window, bnds.x, bnds.y);
glfwSetWindowSize(gctx.window, bnds.width, bnds.height);
return {};
}
void setConstantRefresh(Context &ctx, bool r) noexcept {
auto &gctx = glctx(ctx);
auto &gctx = static_cast<GlfwContext&>(ctx);
gctx.constantRefresh = r;
}