aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/facade/SDLContext.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/crepe/facade/SDLContext.h')
-rw-r--r--src/crepe/facade/SDLContext.h39
1 files changed, 32 insertions, 7 deletions
diff --git a/src/crepe/facade/SDLContext.h b/src/crepe/facade/SDLContext.h
index b9c7fbd..01d82a0 100644
--- a/src/crepe/facade/SDLContext.h
+++ b/src/crepe/facade/SDLContext.h
@@ -12,16 +12,19 @@
#include <unordered_map>
#include "../types.h"
+#include "EventData.h"
#include "api/Camera.h"
#include "api/Color.h"
#include "api/KeyCodes.h"
#include "api/Sprite.h"
#include "api/Transform.h"
-#include "EventData.h"
+#include "FontFacade.h"
namespace crepe {
class Texture;
+class Text;
+class Font;
class Mediator;
/**
@@ -69,12 +72,11 @@ public:
const double & scale;
};
-public:
- /**
- * \brief Gets the singleton instance of SDLContext.
- * \return Reference to the SDLContext instance.
- */
- static SDLContext & get_instance();
+ struct RenderText {
+ const Text & text;
+ const Font & font;
+ const Transform & transform;
+ };
public:
SDLContext(const SDLContext &) = delete;
@@ -184,6 +186,13 @@ public:
*/
void draw(const RenderContext & ctx);
+ /**
+ * \brief draws a text to the screen
+ *
+ * \param data Reference to the rendering data needed to draw
+ */
+ void draw_text(const RenderText & data);
+
//! Clears the screen, preparing for a new frame.
void clear_screen();
@@ -344,6 +353,22 @@ private:
{SDL_SCANCODE_RALT, Keycode::RIGHT_ALT},
{SDL_SCANCODE_RGUI, Keycode::RIGHT_SUPER},
{SDL_SCANCODE_MENU, Keycode::MENU}};
+
+private:
+ //! instance of the font_facade
+ FontFacade font_facade{};
+
+public:
+ /**
+ * \brief Function to Get asset from font_family
+ *
+ * This function uses the FontFacade function to convert a font_family to an asset.
+ *
+ * \param font_family name of the font style that needs to be used (will return an asset with default font path of the font_family doesnt exist)
+ *
+ * \return asset with the font style absolute path
+ */
+ Asset get_font_from_name(const std::string & font_family);
};
} // namespace crepe