Removed dbc and replaced with plain asserts everywhere.
This commit is contained in:
parent
767147c301
commit
adc192c6dc
17 changed files with 69 additions and 185 deletions
|
@ -1,6 +1,5 @@
|
|||
#include "guecs/sfml/shaders.hpp"
|
||||
#include "guecs/sfml/config.hpp"
|
||||
#include "guecs/dbc.hpp"
|
||||
#include <SFML/Graphics/Image.hpp>
|
||||
#include <fmt/core.h>
|
||||
#include <memory>
|
||||
|
@ -30,21 +29,21 @@ namespace shaders {
|
|||
|
||||
void init() {
|
||||
if(!INITIALIZED) {
|
||||
dbc::check(sf::Shader::isAvailable(), "no shaders?!");
|
||||
assert(sf::Shader::isAvailable() && "no shaders?!");
|
||||
INITIALIZED = true;
|
||||
Config config("assets/shaders.json");
|
||||
bool good = load_shader("ERROR", config["ERROR"]);
|
||||
dbc::check(good, "Failed to load ERROR shader. Look in assets/shaders.json");
|
||||
assert(good && "Failed to load ERROR shader. Look in assets/shaders.json");
|
||||
|
||||
for(auto& [name, settings] : config.json().items()) {
|
||||
if(name == "ERROR") continue;
|
||||
|
||||
dbc::check(!SMGR.shaders.contains(name),
|
||||
fmt::format("shader name '{}' duplicated in assets/shaders.json", name));
|
||||
assert(!SMGR.shaders.contains(name) &&
|
||||
"shader name duplicated in assets/shaders.json");
|
||||
good = load_shader(name, settings);
|
||||
|
||||
if(!good) {
|
||||
dbc::log(fmt::format("failed to load shader {}", name));
|
||||
fmt::println("[SOUND] failed to load shader {}", name);
|
||||
SMGR.shaders.insert_or_assign(name, SMGR.shaders.at("ERROR"));
|
||||
}
|
||||
}
|
||||
|
@ -52,9 +51,9 @@ namespace shaders {
|
|||
}
|
||||
|
||||
std::shared_ptr<sf::Shader> get(const std::string& name) {
|
||||
dbc::check(INITIALIZED, "you forgot to shaders::init()");
|
||||
dbc::check(SMGR.shaders.contains(name),
|
||||
fmt::format("shader name '{}' not in assets/shaders.json", name));
|
||||
assert(INITIALIZED && "you forgot to shaders::init()");
|
||||
assert(SMGR.shaders.contains(name) &&
|
||||
"shader name not in assets/shaders.json");
|
||||
auto& rec = SMGR.shaders.at(name);
|
||||
return rec.ptr;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue