[keel,nostalgia,studio,turbine] Make turbine::Context have a keel::Context instead of being one
This commit is contained in:
@@ -214,8 +214,8 @@ ox::Error initGfx(Context &ctx) noexcept {
|
||||
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE);
|
||||
}
|
||||
glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE);
|
||||
auto cstr = ox_malloca(ctx.appName.bytes() + 1, char);
|
||||
ox_strncpy(cstr.get(), ctx.appName.data(), ctx.appName.bytes());
|
||||
auto cstr = ox_malloca(ctx.keelCtx.appName.bytes() + 1, char);
|
||||
ox_strncpy(cstr.get(), ctx.keelCtx.appName.data(), ctx.keelCtx.appName.bytes());
|
||||
gctx.window = glfwCreateWindow(240 * Scale, 160 * Scale, cstr, nullptr, nullptr);
|
||||
if (gctx.window == nullptr) {
|
||||
return OxError(1, "Could not open GLFW window");
|
||||
@@ -275,6 +275,21 @@ ox::Size getScreenSize(Context &ctx) noexcept {
|
||||
return {w, h};
|
||||
}
|
||||
|
||||
ox::Bounds getWindowBounds(Context &ctx) noexcept {
|
||||
auto &gctx = static_cast<GlfwContext&>(ctx);
|
||||
ox::Bounds bnds;
|
||||
glfwGetWindowPos(gctx.window, &bnds.x, &bnds.y);
|
||||
glfwGetWindowSize(gctx.window, &bnds.width, &bnds.height);
|
||||
return bnds;
|
||||
}
|
||||
|
||||
ox::Error setWindowBounds(Context &ctx, const ox::Bounds &bnds) noexcept {
|
||||
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 = static_cast<GlfwContext&>(ctx);
|
||||
gctx.constantRefresh = r;
|
||||
|
||||
Reference in New Issue
Block a user