Nazaj na multithreadanje - fonti
This commit is contained in:
27
include/renderer/font.hpp
Normal file
27
include/renderer/font.hpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
#include <SDL3_ttf/SDL_ttf.h>
|
||||
#include <utils.hpp>
|
||||
#include <string>
|
||||
#include <renderer/texture.hpp>
|
||||
|
||||
namespace Game::Renderer {
|
||||
class Font : public Texture {
|
||||
public:
|
||||
Font(const std::string& path, SDL_Renderer* renderer, int ptSize, std::string id = "noname");
|
||||
Font(const Font&);
|
||||
Font& operator=(const Font&);
|
||||
DISABLE_MOVE(Font);
|
||||
~Font();
|
||||
|
||||
// Build the texture for the font; Call getSDLTexture() afterwards
|
||||
void build(SDL_Color color, std::string text);
|
||||
|
||||
SDL_Texture* getSDLTexture();
|
||||
std::string getId();
|
||||
private:
|
||||
TTF_Font* mFont;
|
||||
SDL_Renderer* mRenderer;
|
||||
};
|
||||
}
|
||||
@@ -8,15 +8,16 @@
|
||||
namespace Game::Renderer {
|
||||
class Texture {
|
||||
public:
|
||||
Texture(std::string id = "noname");
|
||||
Texture(const std::string& path, SDL_Renderer* renderer, std::string id = "noname");
|
||||
Texture(const Texture&);
|
||||
Texture& operator=(const Texture&);
|
||||
DISABLE_MOVE(Texture);
|
||||
~Texture();
|
||||
virtual ~Texture();
|
||||
|
||||
SDL_Texture* getSDLTexture();
|
||||
std::string getId();
|
||||
private:
|
||||
protected:
|
||||
SDL_Texture* mTex;
|
||||
std::string mId;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user