Upgraded to the latest winlibs/gcc 14.
This commit is contained in:
parent
5a6494acf5
commit
290affa49a
11 changed files with 20 additions and 13 deletions
2
.gdbinit
2
.gdbinit
|
@ -5,4 +5,6 @@ set logging overwrite on
|
||||||
set print pretty on
|
set print pretty on
|
||||||
set pagination off
|
set pagination off
|
||||||
break abort
|
break abort
|
||||||
|
break _invalid_parameter_noinfo
|
||||||
|
break _invalid_parameter
|
||||||
catch throw
|
catch throw
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
#include <SFML/Graphics.hpp>
|
#include <SFML/Graphics.hpp>
|
||||||
#include <codecvt>
|
#include <codecvt>
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
typedef std::function<void(sf::Color bgcolor, sf::Color color)> ColorCB;
|
typedef std::function<void(sf::Color bgcolor, sf::Color color)> ColorCB;
|
||||||
|
|
||||||
|
|
1
map.cpp
1
map.cpp
|
@ -13,6 +13,7 @@ using namespace fmt;
|
||||||
Map::Map(size_t width, size_t height) :
|
Map::Map(size_t width, size_t height) :
|
||||||
$width(width),
|
$width(width),
|
||||||
$height(height),
|
$height(height),
|
||||||
|
$tiles(height, matrix::Row(width, INV_WALL)),
|
||||||
$walls(height, matrix::Row(width, INV_WALL)),
|
$walls(height, matrix::Row(width, INV_WALL)),
|
||||||
$paths(width, height)
|
$paths(width, height)
|
||||||
{}
|
{}
|
||||||
|
|
2
map.hpp
2
map.hpp
|
@ -30,6 +30,7 @@ class Map {
|
||||||
public:
|
public:
|
||||||
size_t $width;
|
size_t $width;
|
||||||
size_t $height;
|
size_t $height;
|
||||||
|
Matrix $tiles;
|
||||||
Matrix $walls;
|
Matrix $walls;
|
||||||
Pathing $paths;
|
Pathing $paths;
|
||||||
std::vector<Room> $rooms;
|
std::vector<Room> $rooms;
|
||||||
|
@ -42,6 +43,7 @@ public:
|
||||||
Map(Map &map) = delete;
|
Map(Map &map) = delete;
|
||||||
|
|
||||||
Matrix& paths() { return $paths.paths(); }
|
Matrix& paths() { return $paths.paths(); }
|
||||||
|
Matrix& tiles() { return $tiles; }
|
||||||
Matrix& input_map() { return $paths.input(); }
|
Matrix& input_map() { return $paths.input(); }
|
||||||
Matrix& walls() { return $walls; }
|
Matrix& walls() { return $walls; }
|
||||||
size_t width() { return $width; }
|
size_t width() { return $width; }
|
||||||
|
|
|
@ -180,7 +180,7 @@ void System::draw_map(DinkyECS::World &world, Map &game_map, const Matrix &light
|
||||||
const auto& player = world.get_the<Player>();
|
const auto& player = world.get_the<Player>();
|
||||||
const auto& player_position = world.get<Position>(player.entity);
|
const auto& player_position = world.get<Position>(player.entity);
|
||||||
Point start = game_map.center_camera(player_position.location, view_x, view_y);
|
Point start = game_map.center_camera(player_position.location, view_x, view_y);
|
||||||
auto &walls = game_map.walls();
|
auto &tiles = game_map.tiles();
|
||||||
auto &paths = game_map.paths();
|
auto &paths = game_map.paths();
|
||||||
|
|
||||||
size_t end_x = std::min(view_x, game_map.width() - start.x);
|
size_t end_x = std::min(view_x, game_map.width() - start.x);
|
||||||
|
@ -188,7 +188,7 @@ void System::draw_map(DinkyECS::World &world, Map &game_map, const Matrix &light
|
||||||
|
|
||||||
for(size_t y = 0; y < end_y; ++y) {
|
for(size_t y = 0; y < end_y; ++y) {
|
||||||
for(size_t x = 0; x < end_x; ++x) {
|
for(size_t x = 0; x < end_x; ++x) {
|
||||||
string tile = walls[start.y+y][start.x+x] == 1 ? config.WALL_TILE : config.FLOOR_TILE;
|
string tile = tiles[start.y+y][start.x+x] == L'#' ? config.WALL_TILE : config.FLOOR_TILE;
|
||||||
int light_value = debug.LIGHT ? 160 : lighting[start.y+y][start.x+x];
|
int light_value = debug.LIGHT ? 160 : lighting[start.y+y][start.x+x];
|
||||||
|
|
||||||
if(tile == config.WALL_TILE) {
|
if(tile == config.WALL_TILE) {
|
||||||
|
|
|
@ -13,7 +13,7 @@ using namespace fmt;
|
||||||
using namespace components;
|
using namespace components;
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
TEST_CASE("load a basic gui run but don't loop", "[render]") {
|
TEST_CASE("load a basic gui run but don't loop", "[gui]") {
|
||||||
DinkyECS::World world;
|
DinkyECS::World world;
|
||||||
save::load_configs(world);
|
save::load_configs(world);
|
||||||
Map game_map(40, 40);
|
Map game_map(40, 40);
|
||||||
|
|
|
@ -133,7 +133,7 @@ TEST_CASE("thrash box iterators", "[matrix]") {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("thrash compass iterators", "[matrix:compass]") {
|
TEST_CASE("thrash compass iterators", "[matrix:compass]") {
|
||||||
for(int count = 0; count < 2000; count++) {
|
for(int count = 0; count < 20; count++) {
|
||||||
size_t width = Random::uniform<size_t>(1, 25);
|
size_t width = Random::uniform<size_t>(1, 25);
|
||||||
size_t height = Random::uniform<size_t>(1, 33);
|
size_t height = Random::uniform<size_t>(1, 33);
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ TEST_CASE("thrash compass iterators", "[matrix:compass]") {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("prototype flood algorithm", "[matrix:flood]") {
|
TEST_CASE("prototype flood algorithm", "[matrix:flood]") {
|
||||||
for(int count = 0; count < 1000; count++) {
|
for(int count = 0; count < 20; count++) {
|
||||||
size_t width = Random::uniform<size_t>(10, 25);
|
size_t width = Random::uniform<size_t>(10, 25);
|
||||||
size_t height = Random::uniform<size_t>(10, 33);
|
size_t height = Random::uniform<size_t>(10, 33);
|
||||||
|
|
||||||
|
|
|
@ -20,12 +20,12 @@
|
||||||
#include <exception>
|
#include <exception>
|
||||||
|
|
||||||
using namespace nlohmann;
|
using namespace nlohmann;
|
||||||
using namespace fmt;
|
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
using lighting::LightSource, lighting::LightRender;
|
using lighting::LightSource, lighting::LightRender;
|
||||||
namespace fs = std::filesystem;
|
namespace fs = std::filesystem;
|
||||||
using std::string, std::wstring, std::vector;
|
using std::string, std::wstring, std::vector;
|
||||||
|
using fmt::println, fmt::print, fmt::format;
|
||||||
|
|
||||||
const Point GRID_SIZE={15,8};
|
const Point GRID_SIZE={15,8};
|
||||||
const int DEFAULT_FONT_SIZE=200;
|
const int DEFAULT_FONT_SIZE=200;
|
||||||
|
@ -54,7 +54,7 @@ struct FontGrid {
|
||||||
}
|
}
|
||||||
|
|
||||||
void configure_font() {
|
void configure_font() {
|
||||||
dbc::check(fs::exists($font_list), format("font listing {} does not exist", $font_list));
|
dbc::check(fs::exists($font_list), std::format("font listing {} does not exist", $font_list));
|
||||||
|
|
||||||
std::ifstream in_file($font_list);
|
std::ifstream in_file($font_list);
|
||||||
json input = json::parse(in_file);
|
json input = json::parse(in_file);
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <chrono> // for operator""s, chrono_literals
|
|
||||||
#include <thread> // for sleep_for
|
#include <thread> // for sleep_for
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <fmt/core.h>
|
|
||||||
#include <locale>
|
#include <locale>
|
||||||
#include <codecvt>
|
#include <codecvt>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -16,9 +14,10 @@
|
||||||
#include FT_TRUETYPE_IDS_H
|
#include FT_TRUETYPE_IDS_H
|
||||||
#include "dbc.hpp"
|
#include "dbc.hpp"
|
||||||
#include "constants.hpp"
|
#include "constants.hpp"
|
||||||
|
#include <fmt/core.h>
|
||||||
|
|
||||||
using namespace nlohmann;
|
using namespace nlohmann;
|
||||||
using namespace fmt;
|
using fmt::format, fmt::println, fmt::print;
|
||||||
namespace fs = std::filesystem;
|
namespace fs = std::filesystem;
|
||||||
using std::string, std::wstring, std::vector;
|
using std::string, std::wstring, std::vector;
|
||||||
|
|
||||||
|
|
4
tser.hpp
4
tser.hpp
|
@ -211,10 +211,10 @@ inline decltype(auto) members() const { return std::tie(__VA_ARGS__); } \
|
||||||
inline decltype(auto) members() { return std::tie(__VA_ARGS__); } \
|
inline decltype(auto) members() { return std::tie(__VA_ARGS__); } \
|
||||||
static constexpr std::array<char, tser::detail::str_size(#__VA_ARGS__)> _memberNameData = [](){ \
|
static constexpr std::array<char, tser::detail::str_size(#__VA_ARGS__)> _memberNameData = [](){ \
|
||||||
std::array<char, tser::detail::str_size(#__VA_ARGS__)> chars{'\0'}; size_t _idx = 0; constexpr auto* ini(#__VA_ARGS__); \
|
std::array<char, tser::detail::str_size(#__VA_ARGS__)> chars{'\0'}; size_t _idx = 0; constexpr auto* ini(#__VA_ARGS__); \
|
||||||
for (char const* _c = ini; *_c; ++_c, ++_idx) if(*_c != ',' && *_c != ' ') chars[_idx] = *_c; return chars;}(); \
|
for (char const* _c = ini; *_c; ++_c, ++_idx) { if(*_c != ',' && *_c != ' ') chars[_idx] = *_c; } return chars;}(); \
|
||||||
static constexpr const char* _typeName = #Type; \
|
static constexpr const char* _typeName = #Type; \
|
||||||
static constexpr std::array<const char*, tser::detail::n_args(#__VA_ARGS__)> _memberNames = \
|
static constexpr std::array<const char*, tser::detail::n_args(#__VA_ARGS__)> _memberNames = \
|
||||||
[](){ std::array<const char*, tser::detail::n_args(#__VA_ARGS__)> out{ }; \
|
[](){ std::array<const char*, tser::detail::n_args(#__VA_ARGS__)> out{ }; \
|
||||||
for(size_t _i = 0, nArgs = 0; nArgs < tser::detail::n_args(#__VA_ARGS__) ; ++_i) { \
|
for(size_t _i = 0, nArgs = 0; nArgs < tser::detail::n_args(#__VA_ARGS__) ; ++_i) { \
|
||||||
while(Type::_memberNameData[_i] == '\0') _i++; out[nArgs++] = &Type::_memberNameData[_i]; \
|
while(Type::_memberNameData[_i] == '\0') {_i++;} out[nArgs++] = &Type::_memberNameData[_i]; \
|
||||||
while(Type::_memberNameData[++_i] != '\0'); } return out;}();
|
while(Type::_memberNameData[++_i] != '\0'); } return out;}();
|
||||||
|
|
|
@ -135,7 +135,9 @@ void WorldBuilder::generate() {
|
||||||
}
|
}
|
||||||
|
|
||||||
for(matrix::each_cell it{$map.$walls}; it.next();) {
|
for(matrix::each_cell it{$map.$walls}; it.next();) {
|
||||||
$map.$walls[it.y][it.x] = !$map.$walls[it.y][it.x];
|
int is_wall = !$map.$walls[it.y][it.x];
|
||||||
|
$map.$walls[it.y][it.x] = is_wall;
|
||||||
|
$map.$tiles[it.y][it.x] = is_wall ? L'#' : L'.';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue