First cut at a replica of the python raycaster. Left side almost works the same but have to sort out math differences.
This commit is contained in:
parent
6b181382bd
commit
ca80736d7c
21 changed files with 2165 additions and 90 deletions
40
dbc.cpp
Normal file
40
dbc.cpp
Normal file
|
@ -0,0 +1,40 @@
|
|||
#include "dbc.hpp"
|
||||
|
||||
void dbc::log(const string &message) {
|
||||
fmt::print("{}\n", message);
|
||||
}
|
||||
|
||||
void dbc::sentinel(const string &message) {
|
||||
string err = fmt::format("[SENTINEL!] {}\n", message);
|
||||
throw dbc::SentinelError{err};
|
||||
}
|
||||
|
||||
void dbc::pre(const string &message, bool test) {
|
||||
if(!test) {
|
||||
string err = fmt::format("[PRE!] {}\n", message);
|
||||
throw dbc::PreCondError{err};
|
||||
}
|
||||
}
|
||||
|
||||
void dbc::pre(const string &message, std::function<bool()> tester) {
|
||||
dbc::pre(message, tester());
|
||||
}
|
||||
|
||||
void dbc::post(const string &message, bool test) {
|
||||
if(!test) {
|
||||
string err = fmt::format("[POST!] {}\n", message);
|
||||
throw dbc::PostCondError{err};
|
||||
}
|
||||
}
|
||||
|
||||
void dbc::post(const string &message, std::function<bool()> tester) {
|
||||
dbc::post(message, tester());
|
||||
}
|
||||
|
||||
void dbc::check(bool test, const string &message) {
|
||||
if(!test) {
|
||||
string err = fmt::format("[CHECK!] {}\n", message);
|
||||
fmt::println("{}", err);
|
||||
throw dbc::CheckError{err};
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue