[olympic/turbine] East const Turbine, cleanup

This commit is contained in:
Gary Talent 2023-12-15 00:54:48 -06:00
parent 58d13a3ad9
commit 72e54da017
4 changed files with 11 additions and 11 deletions

View File

@ -37,7 +37,7 @@ ox::String getClipboardText(Context &ctx) noexcept;
void setClipboardText(Context &ctx, ox::CRStringView text) noexcept;
void setClipboardObject(Context &ctx, ox::UniquePtr<BaseClipboardObject> &&obj) noexcept;
void setClipboardObject(Context &ctx, ox::UPtr<BaseClipboardObject> &&obj) noexcept;
ox::Result<BaseClipboardObject*> getClipboardData(Context &ctx, ox::StringView typeName, int typeVersion) noexcept;

View File

@ -22,7 +22,7 @@ void setClipboardText(Context &ctx, ox::CRStringView text) noexcept {
glfwSetClipboardString(ctx.window, cstr.get());
}
void setClipboardObject(Context &ctx, ox::UniquePtr<BaseClipboardObject> &&obj) noexcept {
void setClipboardObject(Context &ctx, ox::UPtr<BaseClipboardObject> &&obj) noexcept {
ctx.clipboard = std::move(obj);
}

View File

@ -30,7 +30,7 @@ void removeDrawer(Context &ctx, Drawer *cd) noexcept {
}
static void handleGlfwError(int err, const char *desc) noexcept {
static void handleGlfwError(int err, char const*desc) noexcept {
oxErrf("GLFW error ({}): {}\n", err, desc);
}
@ -57,8 +57,8 @@ static void handleKeyPress(Context &ctx, int key, bool down) noexcept {
map[GLFW_KEY_ESCAPE] = Key::Escape;
return map;
}();
const auto eventHandler = keyEventHandler(ctx);
const auto k = keyMap[static_cast<std::size_t>(key)];
auto const eventHandler = keyEventHandler(ctx);
auto const k = keyMap[static_cast<std::size_t>(key)];
setKeyDownStatus(ctx, k, down);
if (eventHandler) {
eventHandler(ctx, k, down);
@ -69,12 +69,12 @@ static void handleGlfwCursorPosEvent(GLFWwindow*, double, double) noexcept {
}
static void handleGlfwMouseButtonEvent(GLFWwindow *window, int, int, int) noexcept {
const auto ctx = static_cast<Context*>(glfwGetWindowUserPointer(window));
auto const ctx = static_cast<Context*>(glfwGetWindowUserPointer(window));
ctx->uninterruptedRefreshes = 25;
}
static void handleGlfwKeyEvent(GLFWwindow *window, int key, int, int action, int) noexcept {
const auto ctx = static_cast<Context*>(glfwGetWindowUserPointer(window));
auto const ctx = static_cast<Context*>(glfwGetWindowUserPointer(window));
ctx->uninterruptedRefreshes = 25;
if (action == GLFW_PRESS) {
handleKeyPress(*ctx, key, true);

View File

@ -55,8 +55,8 @@ ox::Result<ContextUPtr> init(
static void tickFps(Context &ctx, uint64_t nowMs) noexcept {
++ctx.draws;
if (ctx.draws >= 500) {
const auto duration = static_cast<double>(nowMs - ctx.prevFpsCheckTime) / 1000.0;
const auto fps = static_cast<int>(static_cast<double>(ctx.draws) / duration);
auto const duration = static_cast<double>(nowMs - ctx.prevFpsCheckTime) / 1000.0;
auto const fps = static_cast<int>(static_cast<double>(ctx.draws) / duration);
if constexpr(config::GlFpsPrint) {
oxOutf("FPS: {}\n", fps);
}
@ -70,7 +70,7 @@ ox::Error run(Context &ctx) noexcept {
int sleepTime = 0;
while (!glfwWindowShouldClose(ctx.window)) {
glfwPollEvents();
const auto ticks = ticksMs(ctx);
auto const ticks = ticksMs(ctx);
if (ctx.wakeupTime <= ticks) {
sleepTime = ctx.updateHandler(ctx);
if (sleepTime >= 0) {
@ -108,7 +108,7 @@ void shutdown(Context &ctx) noexcept {
uint64_t ticksMs(Context const&ctx) noexcept {
using namespace std::chrono;
const auto now = duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count();
auto const now = duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count();
return static_cast<uint64_t>(now - ctx.startTime);
}