mirror of
https://github.com/HowestDAE/dae16-VerhulstBram.git
synced 2025-12-16 04:41:47 +01:00
41 lines
1.3 KiB
C++
41 lines
1.3 KiB
C++
#pragma once
|
|
#include "base.h"
|
|
|
|
class Texture final
|
|
{
|
|
public:
|
|
explicit Texture( const std::string& imagePath );
|
|
explicit Texture( const std::string& text, TTF_Font *pFont, const Color4f& textColor );
|
|
explicit Texture( const std::string& text, const std::string& fontPath, int ptSize, const Color4f& textColor );
|
|
Texture( const Texture& other ) = delete;
|
|
Texture& operator=( const Texture& other ) = delete;
|
|
Texture( Texture&& other ) noexcept;
|
|
Texture& operator=( Texture&& other ) noexcept;
|
|
~Texture();
|
|
|
|
void Draw(const Point2f& dstBottomLeft = {}, const Rectf& srcRect = {}, bool flip = false) const;
|
|
void Draw( const Rectf& dstRect, const Rectf& srcRect = {}, bool flip = false) const;
|
|
|
|
float GetWidth() const;
|
|
float GetHeight() const;
|
|
bool IsCreationOk( ) const;
|
|
|
|
static int m_TextureCounter;
|
|
|
|
private:
|
|
//DATA MEMBERS
|
|
GLuint m_Id;
|
|
float m_Width;
|
|
float m_Height;
|
|
bool m_CreationOk;
|
|
|
|
// FUNCTIONS
|
|
void CreateFromImage( const std::string& path );
|
|
void CreateFromString( const std::string& text, TTF_Font *pFont, const Color4f& textColor );
|
|
void CreateFromString( const std::string& text, const std::string& fontPath, int ptSize, const Color4f& textColor );
|
|
void CreateFromSurface( SDL_Surface *pSurface );
|
|
SDL_Surface * STBImageLoad( const std::string& path );
|
|
void DrawFilledRect(const Rectf& dstRect) const;
|
|
};
|
|
|