Fully converted to using the lel-guecs library externally now.
This commit is contained in:
parent
7c90eb6da1
commit
74a8599977
30 changed files with 139 additions and 1194 deletions
67
backend.cpp
Normal file
67
backend.cpp
Normal file
|
@ -0,0 +1,67 @@
|
|||
#include "backend.hpp"
|
||||
#include "shaders.hpp"
|
||||
#include "sound.hpp"
|
||||
#include "textures.hpp"
|
||||
#include "config.hpp"
|
||||
|
||||
namespace sfml {
|
||||
guecs::SpriteTexture Backend::texture_get(const string& name) {
|
||||
auto sp = textures::get(name);
|
||||
return {sp.sprite, sp.texture};
|
||||
}
|
||||
|
||||
Backend::Backend() {
|
||||
sound::init();
|
||||
shaders::init();
|
||||
textures::init();
|
||||
}
|
||||
|
||||
void Backend::sound_play(const string& name) {
|
||||
sound::play(name);
|
||||
}
|
||||
|
||||
void Backend::sound_stop(const string& name) {
|
||||
sound::stop(name);
|
||||
}
|
||||
|
||||
std::shared_ptr<sf::Shader> Backend::shader_get(const std::string& name) {
|
||||
return shaders::get(name);
|
||||
}
|
||||
|
||||
bool Backend::shader_updated() {
|
||||
if(shaders::updated($shaders_version)) {
|
||||
$shaders_version = shaders::version();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
guecs::Theme Backend::theme() {
|
||||
guecs::Theme theme {
|
||||
.BLACK={0, 0, 0},
|
||||
.DARK_DARK={10, 10, 10},
|
||||
.DARK_MID={30, 30, 30},
|
||||
.DARK_LIGHT={60, 60, 60},
|
||||
.MID={100, 100, 100},
|
||||
.LIGHT_DARK={150, 150, 150},
|
||||
.LIGHT_MID={200, 200, 200},
|
||||
.LIGHT_LIGHT={230, 230, 230},
|
||||
.WHITE={255, 255, 255},
|
||||
.TRANSPARENT = sf::Color::Transparent
|
||||
};
|
||||
|
||||
theme.PADDING = 3;
|
||||
theme.BORDER_PX = 1;
|
||||
theme.TEXT_SIZE = 20;
|
||||
theme.LABEL_SIZE = 20;
|
||||
theme.FILL_COLOR = theme.DARK_DARK;
|
||||
theme.TEXT_COLOR = theme.LIGHT_LIGHT;
|
||||
theme.BG_COLOR = theme.MID;
|
||||
theme.BORDER_COLOR = theme.LIGHT_DARK;
|
||||
theme.BG_COLOR_DARK = theme.BLACK;
|
||||
theme.FONT_FILE_NAME = Config::path_to("assets/text.otf").string();
|
||||
|
||||
return theme;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue