make naming more consistent + rename some files

This commit is contained in:
2026-02-22 14:17:55 +01:00
parent fe6bbe9bbb
commit f06afc210f
10 changed files with 27 additions and 27 deletions

View File

@ -12,8 +12,8 @@ include_directories(include)
add_executable(masssprings
src/main.cpp
src/renderer.cpp
src/mass_springs.cpp
src/klotski.cpp
src/physics.cpp
src/puzzle.cpp
src/state.cpp
src/input.cpp
)

View File

@ -1,8 +1,8 @@
#ifndef __MASS_SPRINGS_HPP_
#define __MASS_SPRINGS_HPP_
#ifndef __PHYSICS_HPP_
#define __PHYSICS_HPP_
#include "config.hpp"
#include "klotski.hpp"
#include "puzzle.hpp"
#include <raylib.h>
#include <raymath.h>
#include <unordered_map>

View File

@ -4,7 +4,7 @@
#include <functional>
#include <vector>
#include "klotski.hpp"
#include "puzzle.hpp"
using StateGenerator = std::function<State(void)>;

View File

@ -1,5 +1,5 @@
#ifndef __KLOTSKI_HPP_
#define __KLOTSKI_HPP_
#ifndef __PUZZLE_HPP_
#define __PUZZLE_HPP_
#include <array>
#include <cstddef>

View File

@ -7,8 +7,8 @@
#include <unordered_set>
#include "config.hpp"
#include "klotski.hpp"
#include "mass_springs.hpp"
#include "puzzle.hpp"
#include "physics.hpp"
class OrbitCamera3D {
friend class Renderer;

View File

@ -2,8 +2,8 @@
#define __STATE_HPP_
#include "config.hpp"
#include "klotski.hpp"
#include "mass_springs.hpp"
#include "puzzle.hpp"
#include "physics.hpp"
#include "presets.hpp"
#include <raymath.h>

View File

@ -4,7 +4,7 @@
#include "config.hpp"
#include "input.hpp"
#include "mass_springs.hpp"
#include "physics.hpp"
#include "renderer.hpp"
#include "state.hpp"

View File

@ -1,4 +1,4 @@
#include "mass_springs.hpp"
#include "physics.hpp"
#include "config.hpp"
#include <numeric>

View File

@ -1,4 +1,4 @@
#include "klotski.hpp"
#include "puzzle.hpp"
auto Block::Hash() const -> int {
std::string s = std::format("{},{},{},{}", x, y, width, height);

View File

@ -8,8 +8,8 @@
#include <unordered_set>
#include "config.hpp"
#include "klotski.hpp"
#include "mass_springs.hpp"
#include "puzzle.hpp"
#include "physics.hpp"
#ifdef BATCHING
#include <cstring>
@ -94,9 +94,9 @@ auto OrbitCamera3D::Update(const Mass &current_mass) -> void {
camera.target = target;
}
auto Renderer::UpdateCamera(const MassSpringSystem &masssprings,
auto Renderer::UpdateCamera(const MassSpringSystem &mass_springs,
const State &current) -> void {
const Mass &c = masssprings.masses.at(current);
const Mass &c = mass_springs.masses.at(current);
camera.Update(c);
}
@ -180,11 +180,6 @@ auto Renderer::DrawMassSprings(const MassSpringSystem &mass_springs,
DrawMeshInstanced(cube_instance, vertex_mat, transforms,
mass_springs.masses.size());
// Mark current state
const Mass &current_mass = mass_springs.GetMass(current_state);
DrawCube(current_mass.position, VERTEX_SIZE * 2, VERTEX_SIZE * 2,
VERTEX_SIZE * 2, RED);
// Mark winning states
if (mark_solutions || connect_solutions) {
for (const auto &state : winning_states) {
@ -201,6 +196,11 @@ auto Renderer::DrawMassSprings(const MassSpringSystem &mass_springs,
}
}
// Mark current state
const Mass &current_mass = mass_springs.GetMass(current_state);
DrawCube(current_mass.position, VERTEX_SIZE * 2, VERTEX_SIZE * 2,
VERTEX_SIZE * 2, RED);
// DrawGrid(10, 1.0);
// DrawSphere(camera.target, VERTEX_SIZE, ORANGE);
EndMode3D();
@ -293,8 +293,8 @@ auto Renderer::DrawKlotski(const State &state, int hov_x, int hov_y, int sel_x,
EndTextureMode();
}
auto Renderer::DrawMenu(const MassSpringSystem &masssprings, int current_preset,
const State &current_state,
auto Renderer::DrawMenu(const MassSpringSystem &mass_springs,
int current_preset, const State &current_state,
const std::unordered_set<State> &winning_states)
-> void {
BeginTextureMode(menu_target);
@ -318,7 +318,7 @@ auto Renderer::DrawMenu(const MassSpringSystem &masssprings, int current_preset,
draw_btn(0, 0,
std::format("States: {}, Transitions: {}, Winning: {}",
masssprings.masses.size(), masssprings.springs.size(),
mass_springs.masses.size(), mass_springs.springs.size(),
winning_states.size()),
DARKGREEN);
draw_btn(