mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-11 22:53:34 +00:00
working on texts and fonts
This commit is contained in:
@@ -2,7 +2,10 @@
|
||||
#define __MLX_SCENE__
|
||||
|
||||
#include <Renderer/Renderer.h>
|
||||
#include <Graphics/Text.h>
|
||||
#include <Graphics/Font.h>
|
||||
#include <Graphics/Sprite.h>
|
||||
#include <Graphics/Drawable.h>
|
||||
#include <Renderer/ViewerData.h>
|
||||
|
||||
namespace mlx
|
||||
@@ -14,20 +17,28 @@ namespace mlx
|
||||
|
||||
Sprite& CreateSprite(NonOwningPtr<class Texture> texture) noexcept;
|
||||
NonOwningPtr<Sprite> GetSpriteFromTextureAndPosition(NonOwningPtr<Texture> texture, const Vec2f& position) const;
|
||||
void BringToFront(NonOwningPtr<Sprite> sprite);
|
||||
void TryEraseSpriteFromTexture(NonOwningPtr<Texture> texture);
|
||||
bool IsTextureAtGivenDrawLayer(NonOwningPtr<Texture> texture, std::uint64_t draw_layer) const;
|
||||
|
||||
inline void ResetSprites() { m_sprites.clear(); }
|
||||
Text& CreateText(const std::string& text) noexcept;
|
||||
NonOwningPtr<Text> GetTextFromPositionAndColor(const std::string& text, const Vec2f& position, const Vec4f& color) const;
|
||||
bool IsTextAtGivenDrawLayer(const std::string& text, std::uint64_t draw_layer) const;
|
||||
|
||||
[[nodiscard]] MLX_FORCEINLINE const std::vector<std::shared_ptr<Sprite>>& GetSprites() const noexcept { return m_sprites; }
|
||||
inline void BindFont(std::shared_ptr<Font> font) { Verify((bool)font, "invalid fond pointer"); p_bound_font = font; }
|
||||
|
||||
void BringToFront(NonOwningPtr<Drawable> drawable);
|
||||
|
||||
inline void ResetScene() { m_drawables.clear(); }
|
||||
|
||||
[[nodiscard]] MLX_FORCEINLINE const std::vector<std::shared_ptr<Drawable>>& GetDrawables() const noexcept { return m_drawables; }
|
||||
[[nodiscard]] MLX_FORCEINLINE ViewerData& GetViewerData() noexcept { return m_viewer_data; }
|
||||
|
||||
~Scene() = default;
|
||||
|
||||
private:
|
||||
std::vector<std::shared_ptr<Sprite>> m_sprites;
|
||||
std::vector<std::shared_ptr<Drawable>> m_drawables;
|
||||
ViewerData m_viewer_data;
|
||||
std::shared_ptr<Font> p_bound_font;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user