add menu pane at the top
This commit is contained in:
@ -5,14 +5,21 @@
|
||||
|
||||
// Window
|
||||
constexpr int WIDTH = 1300;
|
||||
constexpr int HEIGHT = 1300;
|
||||
constexpr int HEIGHT = 1100;
|
||||
constexpr int MENU_HEIGHT = 200;
|
||||
|
||||
// Menu
|
||||
constexpr int MENU_PAD = 10;
|
||||
constexpr int MENU_ROWS = 3;
|
||||
constexpr int MENU_COLS = 3;
|
||||
|
||||
// Camera Controls
|
||||
constexpr float SIM_SPEED = 4.0;
|
||||
constexpr float CAMERA_DISTANCE = 250.0;
|
||||
constexpr float CAMERA_DISTANCE = 100.0;
|
||||
constexpr float MIN_CAMERA_DISTANCE = 2.0;
|
||||
constexpr float MAX_CAMERA_DISTANCE = 2000.0;
|
||||
constexpr float ZOOM_SPEED = 10.0;
|
||||
constexpr float ZOOM_SPEED = 2.5;
|
||||
constexpr float ZOOM_MULTIPLIER = 4.0;
|
||||
constexpr float PAN_SPEED = 2.0;
|
||||
constexpr float ROT_SPEED = 1.0;
|
||||
|
||||
@ -25,7 +32,7 @@ constexpr float REPULSION_RANGE = 5.0 * REST_LENGTH;
|
||||
constexpr float VERLET_DAMPENING = 0.01; // [0, 1]
|
||||
|
||||
// Graph Drawing
|
||||
constexpr float VERTEX_SIZE = 0.05;
|
||||
constexpr float VERTEX_SIZE = 0.1;
|
||||
constexpr Color VERTEX_COLOR = GREEN;
|
||||
constexpr Color EDGE_COLOR = DARKGREEN;
|
||||
|
||||
|
||||
@ -21,12 +21,13 @@ private:
|
||||
Vector2 last_mouse;
|
||||
bool dragging;
|
||||
bool panning;
|
||||
bool target_lock;
|
||||
|
||||
public:
|
||||
OrbitCamera3D(Vector3 target, float distance)
|
||||
: camera({0}), target(target), distance(distance), angle_x(0.0),
|
||||
angle_y(0.3), last_mouse(Vector2Zero()), dragging(false),
|
||||
panning(false) {
|
||||
panning(false), target_lock(true) {
|
||||
camera.position = Vector3(0, 0, -1.0 * distance);
|
||||
camera.target = target;
|
||||
camera.up = Vector3(0, 1.0, 0);
|
||||
@ -37,23 +38,21 @@ public:
|
||||
~OrbitCamera3D() {}
|
||||
|
||||
public:
|
||||
auto Update() -> void;
|
||||
auto Update(const Mass ¤t_mass) -> void;
|
||||
};
|
||||
|
||||
class Renderer {
|
||||
private:
|
||||
const int width;
|
||||
const int height;
|
||||
OrbitCamera3D camera;
|
||||
RenderTexture render_target;
|
||||
RenderTexture klotski_target;
|
||||
RenderTexture menu_target;
|
||||
|
||||
public:
|
||||
Renderer(int width, int height)
|
||||
: width(width), height(height),
|
||||
camera(OrbitCamera3D(Vector3(0, 0, 0), CAMERA_DISTANCE)) {
|
||||
render_target = LoadRenderTexture(width, height);
|
||||
klotski_target = LoadRenderTexture(width, height);
|
||||
Renderer() : camera(OrbitCamera3D(Vector3(0, 0, 0), CAMERA_DISTANCE)) {
|
||||
render_target = LoadRenderTexture(WIDTH, HEIGHT);
|
||||
klotski_target = LoadRenderTexture(WIDTH, HEIGHT);
|
||||
menu_target = LoadRenderTexture(WIDTH * 2, MENU_HEIGHT);
|
||||
}
|
||||
|
||||
Renderer(const Renderer ©) = delete;
|
||||
@ -64,16 +63,21 @@ public:
|
||||
~Renderer() {
|
||||
UnloadRenderTexture(render_target);
|
||||
UnloadRenderTexture(klotski_target);
|
||||
UnloadRenderTexture(menu_target);
|
||||
}
|
||||
|
||||
public:
|
||||
auto UpdateCamera() -> void;
|
||||
auto UpdateCamera(const MassSpringSystem &masssprings, const State ¤t)
|
||||
-> void;
|
||||
|
||||
auto DrawMassSprings(const MassSpringSystem &masssprings) -> void;
|
||||
auto DrawMassSprings(const MassSpringSystem &masssprings,
|
||||
const State ¤t) -> void;
|
||||
|
||||
auto DrawKlotski(const State &state, int hov_x, int hov_y, int sel_x,
|
||||
int sel_y) -> void;
|
||||
|
||||
auto DrawMenu(const MassSpringSystem &masssprings) -> void;
|
||||
|
||||
auto DrawTextures() -> void;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user