#define BZ_ENTRYPOINT
#include <breeze.h>

#include <raylib.h>
#include <rlImGui.h>

bool init(int *game) {
    rlImGuiSetup(true);

    return true;
}

void render(float dt, int *game) {

    static f32 x = 0;

    x += dt * 2;

    //f32 eased = bzEase(BZ_EASE_INOUT_SINE, x);
    f32 eased = bzEase(BZ_EASE_OUT_ELASTIC, x);

    Rectangle rect = {
            500, 500, 200, 400
    };
    Vector2 origin = {rect.width * 0.5f, rect.height};

    BeginDrawing();
    ClearBackground(WHITE);

    f32 rotation = 45 * (1 - eased);
    DrawRectanglePro(rect, origin, rotation, RED);


    if (IsKeyReleased(KEY_SPACE)) {
        x = 0.0f;
    }


    rlImGuiBegin();

    igBegin("Easing", NULL, 0);
    igText("x: %.2f", x);
    igText("eased: %.2f", eased);
    igText("rotation: %.2f", rotation);
    if (igSmallButton("Reset")) {
        x = 0.0f;
    }
    igEnd();

    rlImGuiEnd();
    EndDrawing();
}

bool bzMain(BzAppDesc *appDesc, int argc, const char **argv) {
    appDesc->init = (BzAppInitFunc) init;
    appDesc->render = (BzAppRenderFunc) render;

    return true;
}