Fixed up dbc.cpp so now just use it everywhere. I next need to find a way to pass that to format automatically.
This commit is contained in:
parent
2baa044695
commit
a6d83db20c
10 changed files with 25 additions and 21 deletions
|
@ -41,7 +41,7 @@ Pathing compute_paths(gui::FSM& fsm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Autowalker::log(std::string msg) {
|
void Autowalker::log(std::string msg) {
|
||||||
fmt::println(">>> AUTOWALK: {}", msg);
|
dbc::log(fmt::format(">>> AUTOWALK: {}", msg));
|
||||||
fsm.$status_ui.log(msg);
|
fsm.$status_ui.log(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,8 +254,7 @@ void Autowalker::handle_player_walk(ai::State& start, ai::State& goal) {
|
||||||
send_event(gui::Event::STAIRS_DOWN);
|
send_event(gui::Event::STAIRS_DOWN);
|
||||||
} else {
|
} else {
|
||||||
close_status();
|
close_status();
|
||||||
log("Autowalk has a bug. Unknown action.");
|
dbc::log(fmt::format("Unknown action: {}", action.name));
|
||||||
fmt::println("Unknown action: {}", action.name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,9 @@ namespace gui {
|
||||||
auto button = $status.entity(name);
|
auto button = $status.entity(name);
|
||||||
$status.set<Rectangle>(button, {});
|
$status.set<Rectangle>(button, {});
|
||||||
$status.set<Clickable>(button, {
|
$status.set<Clickable>(button, {
|
||||||
[this, name](auto, auto){ fmt::println("STATUS: {}", name); }
|
[this, name](auto, auto){
|
||||||
|
dbc::log(fmt::format("STATUS: {}", name));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
if(name == "main_status") {
|
if(name == "main_status") {
|
||||||
$status.set<Textual>(button, {fmt::format("HP: {}", $combat.hp)});
|
$status.set<Textual>(button, {fmt::format("HP: {}", $combat.hp)});
|
||||||
|
@ -80,7 +82,9 @@ namespace gui {
|
||||||
for(auto& [name, cell] : $overlay.cells()) {
|
for(auto& [name, cell] : $overlay.cells()) {
|
||||||
auto region = $overlay.entity(name);
|
auto region = $overlay.entity(name);
|
||||||
$overlay.set<Clickable>(region, {
|
$overlay.set<Clickable>(region, {
|
||||||
[this, name](auto, auto){ fmt::println("OVERLAY: {}", name); }
|
[this, name](auto, auto){
|
||||||
|
dbc::log(fmt::format("OVERLAY: {}", name));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,7 +140,7 @@ namespace gui {
|
||||||
|
|
||||||
bool BossFightUI::mouse(float x, float y) {
|
bool BossFightUI::mouse(float x, float y) {
|
||||||
if($status.mouse(x, y)) {
|
if($status.mouse(x, y)) {
|
||||||
fmt::println("STATUS");
|
dbc::log("STATUS button pressed");
|
||||||
}
|
}
|
||||||
|
|
||||||
if($overlay.mouse(x, y)) {
|
if($overlay.mouse(x, y)) {
|
||||||
|
|
|
@ -230,7 +230,7 @@ namespace gui {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FSM::END(Event ev) {
|
void FSM::END(Event ev) {
|
||||||
fmt::println("END: received event after done: {}", int(ev));
|
dbc::log(fmt::format("END: received event after done: {}", int(ev)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void FSM::keyboard_mouse() {
|
void FSM::keyboard_mouse() {
|
||||||
|
|
|
@ -15,7 +15,9 @@ namespace components {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Inventory::has_item(size_t at) {
|
bool Inventory::has_item(size_t at) {
|
||||||
fmt::println(">>> INVENTORY: requesting item at {}, have {} items in stock", at, items.size());
|
dbc::log(
|
||||||
|
fmt::format("requesting item at {}, have {} items in stock",
|
||||||
|
at, items.size()));
|
||||||
return at < items.size();
|
return at < items.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -252,7 +252,7 @@ _again:
|
||||||
if(good) {
|
if(good) {
|
||||||
finalize();
|
finalize();
|
||||||
} else {
|
} else {
|
||||||
fmt::println("error at");
|
dbc::log("error at:");
|
||||||
std::cout << p;
|
std::cout << p;
|
||||||
}
|
}
|
||||||
return good;
|
return good;
|
||||||
|
|
|
@ -57,7 +57,7 @@ bool Parser::parse(std::string input) {
|
||||||
if(good) {
|
if(good) {
|
||||||
finalize();
|
finalize();
|
||||||
} else {
|
} else {
|
||||||
fmt::println("error at");
|
dbc::log("error at:");
|
||||||
std::cout << p;
|
std::cout << p;
|
||||||
}
|
}
|
||||||
return good;
|
return good;
|
||||||
|
|
|
@ -140,10 +140,10 @@ void Raycaster::sprite_casting(sf::RenderTarget &target) {
|
||||||
float x = float(draw_start_x + $screen_pos_x);
|
float x = float(draw_start_x + $screen_pos_x);
|
||||||
float y = float(draw_start_y + $screen_pos_y);
|
float y = float(draw_start_y + $screen_pos_y);
|
||||||
|
|
||||||
if(x < $screen_pos_x) fmt::println("X < rayview left bounds");
|
if(x < $screen_pos_x) dbc::log("X < rayview left bounds");
|
||||||
if(y < $screen_pos_y) fmt::println("Y < rayview top bounds");
|
if(y < $screen_pos_y) dbc::log("Y < rayview top bounds");
|
||||||
if(x >= SCREEN_WIDTH) fmt::println("OUT OF BOUNDS X");
|
if(x >= SCREEN_WIDTH) dbc::log("OUT OF BOUNDS X");
|
||||||
if(y >= $height) fmt::println("OUT OF BOUNDS Y");
|
if(y >= $height) dbc::log("OUT OF BOUNDS Y");
|
||||||
|
|
||||||
float sprite_scale_w = float(sprite_width) / float(texture_width);
|
float sprite_scale_w = float(sprite_width) / float(texture_width);
|
||||||
float sprite_scale_h = float(sprite_height) / float(texture_height);
|
float sprite_scale_h = float(sprite_height) / float(texture_height);
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
#include "stats.hpp"
|
#include "stats.hpp"
|
||||||
#include <fmt/core.h>
|
#include <fmt/core.h>
|
||||||
|
#include "dbc.hpp"
|
||||||
|
|
||||||
void Stats::dump(std::string msg)
|
void Stats::dump(std::string msg)
|
||||||
{
|
{
|
||||||
fmt::println("{}: sum: {}, sumsq: {}, n: {}, "
|
dbc::log(fmt::format("{}: sum: {}, sumsq: {}, n: {}, "
|
||||||
"min: {}, max: {}, mean: {}, stddev: {}",
|
"min: {}, max: {}, mean: {}, stddev: {}",
|
||||||
msg, sum, sumsq, n, min, max, mean(),
|
msg, sum, sumsq, n, min, max, mean(),
|
||||||
stddev());
|
stddev()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -293,7 +293,7 @@ void System::collision(GameLevel &level) {
|
||||||
} else if(world.has<Device>(entity)) {
|
} else if(world.has<Device>(entity)) {
|
||||||
System::device(world, player.entity, entity);
|
System::device(world, player.entity, entity);
|
||||||
} else {
|
} else {
|
||||||
println("UNKNOWN COLLISION TYPE {}", entity);
|
dbc::log(fmt::format("UNKNOWN COLLISION TYPE {}", entity));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,7 +308,7 @@ void System::device(DinkyECS::World &world, DinkyECS::Entity actor, DinkyECS::En
|
||||||
auto& device = world.get<Device>(item);
|
auto& device = world.get<Device>(item);
|
||||||
|
|
||||||
for(auto event : device.events) {
|
for(auto event : device.events) {
|
||||||
fmt::println("Device event received {}", event);
|
dbc::log(fmt::format("Device event received {}", event));
|
||||||
|
|
||||||
if(event == "Events::GUI::STAIRS_DOWN") {
|
if(event == "Events::GUI::STAIRS_DOWN") {
|
||||||
world.send<Events::GUI>(Events::GUI::STAIRS_DOWN, actor, device);
|
world.send<Events::GUI>(Events::GUI::STAIRS_DOWN, actor, device);
|
||||||
|
@ -317,7 +317,7 @@ void System::device(DinkyECS::World &world, DinkyECS::Entity actor, DinkyECS::En
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
println("entity {} INTERACTED WITH DEVICE {}", actor, item);
|
dbc::log(fmt::format("entity {} INTERACTED WITH DEVICE {}", actor, item));
|
||||||
}
|
}
|
||||||
|
|
||||||
void System::plan_motion(DinkyECS::World& world, Point move_to) {
|
void System::plan_motion(DinkyECS::World& world, Point move_to) {
|
||||||
|
|
|
@ -295,8 +295,6 @@ void WorldBuilder::make_room(size_t origin_x, size_t origin_y, size_t w, size_t
|
||||||
|
|
||||||
void WorldBuilder::place_rooms() {
|
void WorldBuilder::place_rooms() {
|
||||||
for(auto &cur : $map.$rooms) {
|
for(auto &cur : $map.$rooms) {
|
||||||
// println("ROOM x/y={},{}; w/h={},{}; map={},{}",
|
|
||||||
// cur.x, cur.y, cur.width, cur.height, $map.$width, $map.$height);
|
|
||||||
add_door(cur);
|
add_door(cur);
|
||||||
make_room(cur.x, cur.y, cur.width, cur.height);
|
make_room(cur.x, cur.y, cur.width, cur.height);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue