First commit of the starter kit.
This commit is contained in:
parent
20dc00e62f
commit
612ad717c0
42 changed files with 1853 additions and 0 deletions
69
backend.cpp
Normal file
69
backend.cpp
Normal file
|
@ -0,0 +1,69 @@
|
|||
#include "backend.hpp"
|
||||
#include <guecs/sfml/shaders.hpp>
|
||||
#include <guecs/sfml/sound.hpp>
|
||||
#include <guecs/sfml/textures.hpp>
|
||||
#include <guecs/sfml/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={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 = Config::path_to("assets/text.otf").string();
|
||||
|
||||
return theme;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue