make naming more consistent + rename some files
This commit is contained in:
@ -12,8 +12,8 @@ include_directories(include)
|
|||||||
add_executable(masssprings
|
add_executable(masssprings
|
||||||
src/main.cpp
|
src/main.cpp
|
||||||
src/renderer.cpp
|
src/renderer.cpp
|
||||||
src/mass_springs.cpp
|
src/physics.cpp
|
||||||
src/klotski.cpp
|
src/puzzle.cpp
|
||||||
src/state.cpp
|
src/state.cpp
|
||||||
src/input.cpp
|
src/input.cpp
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
#ifndef __MASS_SPRINGS_HPP_
|
#ifndef __PHYSICS_HPP_
|
||||||
#define __MASS_SPRINGS_HPP_
|
#define __PHYSICS_HPP_
|
||||||
|
|
||||||
#include "config.hpp"
|
#include "config.hpp"
|
||||||
#include "klotski.hpp"
|
#include "puzzle.hpp"
|
||||||
#include <raylib.h>
|
#include <raylib.h>
|
||||||
#include <raymath.h>
|
#include <raymath.h>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
@ -4,7 +4,7 @@
|
|||||||
#include <functional>
|
#include <functional>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "klotski.hpp"
|
#include "puzzle.hpp"
|
||||||
|
|
||||||
using StateGenerator = std::function<State(void)>;
|
using StateGenerator = std::function<State(void)>;
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#ifndef __KLOTSKI_HPP_
|
#ifndef __PUZZLE_HPP_
|
||||||
#define __KLOTSKI_HPP_
|
#define __PUZZLE_HPP_
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
@ -7,8 +7,8 @@
|
|||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
|
|
||||||
#include "config.hpp"
|
#include "config.hpp"
|
||||||
#include "klotski.hpp"
|
#include "puzzle.hpp"
|
||||||
#include "mass_springs.hpp"
|
#include "physics.hpp"
|
||||||
|
|
||||||
class OrbitCamera3D {
|
class OrbitCamera3D {
|
||||||
friend class Renderer;
|
friend class Renderer;
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
#define __STATE_HPP_
|
#define __STATE_HPP_
|
||||||
|
|
||||||
#include "config.hpp"
|
#include "config.hpp"
|
||||||
#include "klotski.hpp"
|
#include "puzzle.hpp"
|
||||||
#include "mass_springs.hpp"
|
#include "physics.hpp"
|
||||||
#include "presets.hpp"
|
#include "presets.hpp"
|
||||||
|
|
||||||
#include <raymath.h>
|
#include <raymath.h>
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#include "config.hpp"
|
#include "config.hpp"
|
||||||
#include "input.hpp"
|
#include "input.hpp"
|
||||||
#include "mass_springs.hpp"
|
#include "physics.hpp"
|
||||||
#include "renderer.hpp"
|
#include "renderer.hpp"
|
||||||
#include "state.hpp"
|
#include "state.hpp"
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
#include "mass_springs.hpp"
|
#include "physics.hpp"
|
||||||
#include "config.hpp"
|
#include "config.hpp"
|
||||||
|
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
@ -1,4 +1,4 @@
|
|||||||
#include "klotski.hpp"
|
#include "puzzle.hpp"
|
||||||
|
|
||||||
auto Block::Hash() const -> int {
|
auto Block::Hash() const -> int {
|
||||||
std::string s = std::format("{},{},{},{}", x, y, width, height);
|
std::string s = std::format("{},{},{},{}", x, y, width, height);
|
||||||
@ -8,8 +8,8 @@
|
|||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
|
|
||||||
#include "config.hpp"
|
#include "config.hpp"
|
||||||
#include "klotski.hpp"
|
#include "puzzle.hpp"
|
||||||
#include "mass_springs.hpp"
|
#include "physics.hpp"
|
||||||
|
|
||||||
#ifdef BATCHING
|
#ifdef BATCHING
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
@ -94,9 +94,9 @@ auto OrbitCamera3D::Update(const Mass ¤t_mass) -> void {
|
|||||||
camera.target = target;
|
camera.target = target;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto Renderer::UpdateCamera(const MassSpringSystem &masssprings,
|
auto Renderer::UpdateCamera(const MassSpringSystem &mass_springs,
|
||||||
const State ¤t) -> void {
|
const State ¤t) -> void {
|
||||||
const Mass &c = masssprings.masses.at(current);
|
const Mass &c = mass_springs.masses.at(current);
|
||||||
camera.Update(c);
|
camera.Update(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,11 +180,6 @@ auto Renderer::DrawMassSprings(const MassSpringSystem &mass_springs,
|
|||||||
DrawMeshInstanced(cube_instance, vertex_mat, transforms,
|
DrawMeshInstanced(cube_instance, vertex_mat, transforms,
|
||||||
mass_springs.masses.size());
|
mass_springs.masses.size());
|
||||||
|
|
||||||
// Mark current state
|
|
||||||
const Mass ¤t_mass = mass_springs.GetMass(current_state);
|
|
||||||
DrawCube(current_mass.position, VERTEX_SIZE * 2, VERTEX_SIZE * 2,
|
|
||||||
VERTEX_SIZE * 2, RED);
|
|
||||||
|
|
||||||
// Mark winning states
|
// Mark winning states
|
||||||
if (mark_solutions || connect_solutions) {
|
if (mark_solutions || connect_solutions) {
|
||||||
for (const auto &state : winning_states) {
|
for (const auto &state : winning_states) {
|
||||||
@ -201,6 +196,11 @@ auto Renderer::DrawMassSprings(const MassSpringSystem &mass_springs,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Mark current state
|
||||||
|
const Mass ¤t_mass = mass_springs.GetMass(current_state);
|
||||||
|
DrawCube(current_mass.position, VERTEX_SIZE * 2, VERTEX_SIZE * 2,
|
||||||
|
VERTEX_SIZE * 2, RED);
|
||||||
|
|
||||||
// DrawGrid(10, 1.0);
|
// DrawGrid(10, 1.0);
|
||||||
// DrawSphere(camera.target, VERTEX_SIZE, ORANGE);
|
// DrawSphere(camera.target, VERTEX_SIZE, ORANGE);
|
||||||
EndMode3D();
|
EndMode3D();
|
||||||
@ -293,8 +293,8 @@ auto Renderer::DrawKlotski(const State &state, int hov_x, int hov_y, int sel_x,
|
|||||||
EndTextureMode();
|
EndTextureMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto Renderer::DrawMenu(const MassSpringSystem &masssprings, int current_preset,
|
auto Renderer::DrawMenu(const MassSpringSystem &mass_springs,
|
||||||
const State ¤t_state,
|
int current_preset, const State ¤t_state,
|
||||||
const std::unordered_set<State> &winning_states)
|
const std::unordered_set<State> &winning_states)
|
||||||
-> void {
|
-> void {
|
||||||
BeginTextureMode(menu_target);
|
BeginTextureMode(menu_target);
|
||||||
@ -318,7 +318,7 @@ auto Renderer::DrawMenu(const MassSpringSystem &masssprings, int current_preset,
|
|||||||
|
|
||||||
draw_btn(0, 0,
|
draw_btn(0, 0,
|
||||||
std::format("States: {}, Transitions: {}, Winning: {}",
|
std::format("States: {}, Transitions: {}, Winning: {}",
|
||||||
masssprings.masses.size(), masssprings.springs.size(),
|
mass_springs.masses.size(), mass_springs.springs.size(),
|
||||||
winning_states.size()),
|
winning_states.size()),
|
||||||
DARKGREEN);
|
DARKGREEN);
|
||||||
draw_btn(
|
draw_btn(
|
||||||
|
|||||||
Reference in New Issue
Block a user