[BROKEN] This build is totally broken. DONOT USE.
This commit is contained in:
parent
8dc70ad1ed
commit
f3f2e90cd2
15 changed files with 123 additions and 81 deletions
|
@ -1,16 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <array>
|
||||
|
||||
constexpr const int SCREEN_WIDTH=1280;
|
||||
constexpr const int SCREEN_HEIGHT=720;
|
||||
|
||||
constexpr const bool VSYNC=false;
|
||||
constexpr const int FRAME_LIMIT=60;
|
||||
|
||||
#ifdef NDEBUG
|
||||
constexpr const bool DEBUG_BUILD=false;
|
||||
#else
|
||||
constexpr const bool DEBUG_BUILD=true;
|
||||
#endif
|
|
@ -38,6 +38,26 @@ namespace guecs {
|
|||
string name;
|
||||
};
|
||||
|
||||
struct SpriteTexture {
|
||||
std::shared_ptr<sf::Sprite> sprite = nullptr;
|
||||
std::shared_ptr<sf::Texture> texture = nullptr;
|
||||
};
|
||||
|
||||
class Backend {
|
||||
public:
|
||||
virtual SpriteTexture texture_get(const string& name) = 0;
|
||||
|
||||
virtual void sound_play(const string& name) = 0;
|
||||
|
||||
virtual void sound_stop(const string& name) = 0;
|
||||
|
||||
virtual std::shared_ptr<sf::Shader> shader_get(const std::string& name) = 0;
|
||||
|
||||
virtual bool shader_updated() = 0;
|
||||
};
|
||||
|
||||
void init(Backend* backend);
|
||||
|
||||
class UI {
|
||||
public:
|
||||
Entity MAIN = 0;
|
||||
|
|
16
include/sfml/backend.hpp
Normal file
16
include/sfml/backend.hpp
Normal file
|
@ -0,0 +1,16 @@
|
|||
#include "guecs.hpp"
|
||||
|
||||
namespace sfml {
|
||||
class Backend : public guecs::Backend {
|
||||
int $shaders_version = 0;
|
||||
|
||||
public:
|
||||
|
||||
Backend();
|
||||
guecs::SpriteTexture texture_get(const string& name);
|
||||
void sound_play(const string& name);
|
||||
void sound_stop(const string& name);
|
||||
std::shared_ptr<sf::Shader> shader_get(const std::string& name);
|
||||
bool shader_updated();
|
||||
};
|
||||
}
|
|
@ -1,10 +1,11 @@
|
|||
#pragma once
|
||||
#include <SFML/Graphics.hpp>
|
||||
|
||||
#include "dbc.hpp"
|
||||
#include "sfml/color.hpp"
|
||||
#include "lel.hpp"
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <SFML/Graphics.hpp>
|
||||
#include <functional>
|
||||
#include <any>
|
||||
|
||||
|
@ -48,6 +49,12 @@ namespace guecs {
|
|||
};
|
||||
|
||||
struct Sprite {
|
||||
// either you set a filename here,
|
||||
// or some kind of config,
|
||||
// or a callback that does the loading,
|
||||
// or a virtual function and you subclass
|
||||
// or there's a static config function you call once,
|
||||
// that's passed an object with all the necessary gear
|
||||
string name;
|
||||
int padding = PADDING;
|
||||
std::shared_ptr<sf::Sprite> sprite = nullptr;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue