You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.5 KiB
66 lines
1.5 KiB
#include "backend.hpp"
|
|
#include "shaders.hpp"
|
|
#include "sound.hpp"
|
|
#include "textures.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={1, 4, 2},
|
|
.DARK_DARK={9, 29, 16},
|
|
.DARK_MID={14, 50, 26},
|
|
.DARK_LIGHT={0, 109, 44},
|
|
.MID={63, 171, 92},
|
|
.LIGHT_DARK={161, 217, 155},
|
|
.LIGHT_MID={199, 233, 192},
|
|
.LIGHT_LIGHT={229, 245, 224},
|
|
.WHITE={255, 255, 255},
|
|
.TRANSPARENT = sf::Color::Transparent
|
|
};
|
|
|
|
theme.PADDING = 3;
|
|
theme.BORDER_PX = 1;
|
|
theme.TEXT_SIZE = 40;
|
|
theme.LABEL_SIZE = 40;
|
|
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 = "assets/text.ttf";
|
|
|
|
return theme;
|
|
}
|
|
}
|
|
|