Skip to content

Commit

Permalink
fix: closing on windows, constexpr error
Browse files Browse the repository at this point in the history
  • Loading branch information
f0e committed Nov 22, 2024
1 parent 31f3f56 commit aafeb8d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/gui/easing.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#pragma once

constexpr inline double ease_out_quart(double x) {
const inline double ease_out_quart(double x) {
return 1.f - pow(1.f - x, 4.f);
}

constexpr inline double ease_out_expo(double x) {
const inline double ease_out_expo(double x) {
return (x == 1) ? 1 : 1 - std::pow(2, -10 * x);
}
12 changes: 6 additions & 6 deletions src/gui/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ const int spacing = 4;
const int pad_x = 24;
const int pad_y = 35;

bool closing = false;

SkFont font;
os::EventQueue* event_queue;

Expand Down Expand Up @@ -80,6 +82,7 @@ bool processEvent(const os::Event& ev) {

case os::Event::CloseApp:
case os::Event::CloseWindow:
closing = true;
return false;

case os::Event::ResizeWindow:
Expand Down Expand Up @@ -119,7 +122,7 @@ void gui::generate_messages_from_os_events() { // https://github.com/aseprite/as
}

void gui::event_loop() {
while (true) {
while (!closing) {
generate_messages_from_os_events();
}
}
Expand Down Expand Up @@ -177,12 +180,9 @@ void gui::redraw_window(os::Window* window) {

{
// debug
static int x = 0;
static float x = 0;
static bool right = true;
if (right)
x++;
else
x--;
x += 500.f * delta_time * (right ? 1 : -1);
os::Paint paint;
paint.color(gfx::rgba(255, 0, 0, 50));
s->drawRect(gfx::Rect(x, 100, 30, 30), paint);
Expand Down

0 comments on commit aafeb8d

Please sign in to comment.