make window resizable

This commit is contained in:
2026-02-19 23:10:16 +01:00
parent 53a38e9cf3
commit a48a6caefc
4 changed files with 114 additions and 86 deletions

View File

@ -3,13 +3,17 @@
#include <raylib.h>
#define VERLET_UPDATE
// #define WEB
// Window
constexpr int WIDTH = 1300;
constexpr int HEIGHT = 1100;
constexpr int INITIAL_WIDTH = 800;
constexpr int INITIAL_HEIGHT = 800;
constexpr int MENU_HEIGHT = 200;
// Menu
constexpr int MENU_PAD = 10;
constexpr int MENU_PAD = 5;
constexpr int BUTTON_PAD = 20;
constexpr int MENU_ROWS = 3;
constexpr int MENU_COLS = 3;

View File

@ -58,9 +58,11 @@ public:
Renderer()
: camera(OrbitCamera3D(Vector3(0, 0, 0), CAMERA_DISTANCE)),
mark_solutions(false), connect_solutions(false) {
render_target = LoadRenderTexture(WIDTH, HEIGHT);
klotski_target = LoadRenderTexture(WIDTH, HEIGHT);
menu_target = LoadRenderTexture(WIDTH * 2, MENU_HEIGHT);
render_target = LoadRenderTexture(GetScreenWidth() / 2.0,
GetScreenHeight() - MENU_HEIGHT);
klotski_target = LoadRenderTexture(GetScreenWidth() / 2.0,
GetScreenHeight() - MENU_HEIGHT);
menu_target = LoadRenderTexture(GetScreenWidth(), MENU_HEIGHT);
}
Renderer(const Renderer &copy) = delete;
@ -84,6 +86,8 @@ public:
auto UpdateCamera(const MassSpringSystem &masssprings, const State &current)
-> void;
auto UpdateTextureSizes() -> void;
auto DrawMassSprings(const MassSpringSystem &masssprings,
const State &current) -> void;