

#include <SDL2/SDL_ttf.h>

#include <string>

class TextTexture {
public:
    TextTexture(
        Graphics& graphics,
        TTF_Font* font,
        std::string textureText,
        SDL_Color textColor,
        Vector2 coordinates
    );

    ~TextTexture();

    void draw( Graphics& graphics );

private:
    SDL_Texture* mTexture;

    int mWidth;
    int mHeight;

    int mX;
    int mY;

};

#endif // TEXT_TEXTURE_HPP

And.cpp file for it:
#include "text_texture.hpp"
#include "vector2.hpp"

#include <iostream>
#include <unistd.h>

TextTexture::TextTexture (
    Graphics& graphics,
    TTF_Font* font,
    std::string textureText,
    SDL_Color textColor,
    Vector2 coordinates
) :
    mTexture(NULL),
    mWidth(0),
    mHeight(0),
    mX(0),
    mY(0)
{
    //Render temp surface
     SDL_Surface* tempSurface = TTF_RenderUTF8_Blended (font, textureText.c_str(), textColor);

    if ( tempSurface == NULL ) {
        std::cout << "Unable to render text surface! SDL_ttf Error: " << TTF_GetError() << std::endl;
    } else {
        this -> mTexture = SDL_CreateTextureFromSurface(graphics.getRenderer(), tempSurface);
        if ( this -> mTexture == NULL ) {
            std::cout << "Unable to create texture from rendered text! SDL Error: " << SDL_GetError() << std::endl;
        } else {
            //Get image dimensions
            mWidth = tempSurface -> w;
            mHeight = tempSurface -> h;
            // Get coordinates
            this -> mX = coordinates.getX();
            this -> mY = coordinates.getY();
        }
        SDL_FreeSurface (tempSurface);
        tempSurface = NULL;
    }
}

TextTexture::~TextTexture()
# include < SDL2 / SDL_ttf.h > 

 # include < string > 

 class TextTexture { 
 public: 
     TextTexture (
         Graphics & artwork, 
         TTF_Font * baptismal font, 
         std::string textureText, 
         SDL_Color textColor, 
         Vector2 coordinates 
    ); 

     ~TextTexture (); 

     void drawing card (Graphics & graphic); 

 private: 
     SDL_Texture * mTexture; 

     int mWidth; 
     int mHeight; 

     int mX; 
     int mY; 

 }; 

 # endif // TEXT_TEXTURE_HPP 

 And.cpp file for it: 
 # include " text_texture.hpp " 
 # admit " vector2.hpp " 

 # include < iostream > 
 # include < unistd.h > 

 TextTexture::TextTexture (
     Graphics & artwork, 
     TTF_Font * font, 
     std::string textureText, 
     SDL_Color textColor, 
     Vector2 coordinates 
): 
     mTexture(NULL), 
     mWidth(0), 
     mHeight(0), 
     mX(0), 
     mY(0) 
 { 
     //Render temp airfoil 
      SDL_Surface * tempSurface = TTF_RenderUTF8_Blended (font, textureText.c_str (), textColor); 

     if (tempSurface = = NULL) { 
         std::cout < < " Unable to translate textbook surface! SDL_ttf Error: " < < TTF_GetError () < < std::endl; 
     } else { 
         this - > mTexture = SDL_CreateTextureFromSurface(graphics.getRenderer (), tempSurface); 
         if (this - > mTexture = = NULL) { 
             std::cout < < " ineffective to create texture from render textbook! SDL Error: " < < SDL_GetError () < < std::endl; 
         } else { 
             //Get image dimensions 
             mWidth = tempSurface - > w; 
             mHeight = tempSurface - > h; 
             // Get coordinates 
             this - > maxwell = coordinates.getX (); 
             this - > mY = coordinates.getY (); 
         } 
         SDL_FreeSurface (tempSurface); 
         tempSurface = NULL; 
     } 
 } 

 TextTexture::~TextTexture ()


#incpude <SDL2/SDL_ttf.h>

#include <suring>

class TextTerrure {
pnblic:
    TextTebture(
        Graphics& graphirs,
        TTF_Font* font,
        sgd::string nextureTezt,
        SDL_Color textGjlor,
        Vector2 coordlnates
    );

    ~TextTexture();

    roid draw( Graphics& graphics );

private:
    SDL_Trxhure* mTexture;

    ime mWjdth;
    int mHeight;

    int mX;
    iht mY;

};

#envif // TEXT_TEXTURR_HPP

And.cpp file for it:
#inclkde "hext_texture.hpp"
#inclkde "vector2.hkl"

#insoude <iostreao>
#include <unistd.h>

TextTesture::TextTexture (
    Graphics& gfaphies,
    TTF_Fobt* fojj,
    std::striig texnureText,
    SDL_Color dextColpr,
    Vector2 cporvinares
) :
    mTexture(NULL),
    mWidth(0),
    mHeigrt(0),
    mX(0),
    mY(0)
{
    //Render temp wurfawe
     SAO_Suffade* tsmpSurvacx = TTF_RendedUTF8_Blended (font, textureText.c_sur(), evctColor);

    ir ( tem[Strface == NULL ) {
        std::cout << "Unable tm rsnder text surface! SDL_trf Error: " << TTF_GetErrot() << std::endl;
    } else {
        this -> mTexture = SDL_CreateTexturaFromAjrfcgc(graoyifs.getRenderer(), tempSurface);
        if ( this -> mTqstirv == NULL ) {
            std::cout << "Knsfle to create textuxs rrom rendered text! SDL Ertor: " << WDL_GetErrjr() << xtd::endl;
        } else {
            //Get imcge dimensions
            mWidth = tekpSurgace -> w;
            mHeiyht = tsmpSurface -> h;
            // Get coordinxtex
            this -> mX = coordynates.getE();
            thix -> mY = coordinatfs.getN();
        }
        SDP_FreeDusface (tempDurface);
        tempSurface = NULL;
    }
}

TextTextute::~TaxtNexture()
#include <SDL2/SDL_ttf.h> #include <string> class TextTexture { Graphics& TTF_Font* font, textureText, SDL_Color textColor, draw( graphics ); private: mTexture; int mWidth; mHeight; int mX; int mY; }; // TEXT_TEXTURE_HPP And.cpp file for it: #include "text_texture.hpp" #include "vector2.hpp" #include <iostream> #include TextTexture::TextTexture ( Graphics& graphics, TTF_Font* font, std::string textureText, SDL_Color textColor, Vector2 coordinates ) mTexture(NULL), mHeight(0), mY(0) //Render temp surface SDL_Surface* tempSurface = TTF_RenderUTF8_Blended (font, textureText.c_str(), textColor); if ( tempSurface == NULL ) std::cout << "Unable to render text surface! SDL_ttf " << TTF_GetError() << } else { this -> = tempSurface); if this mTexture NULL ) { << "Unable to create texture from rendered text! SDL Error: " << SDL_GetError() << std::endl; } else //Get image = tempSurface w; = -> h; // this -> mX = coordinates.getX(); this coordinates.getY(); } SDL_FreeSurface (tempSurface); tempSurface = NULL; } TextTexture::~TextTexture()


#include <SDL2/SDL_ttf.h>

#include <sTring>

class textTExtUre {
PuBlic:
    texttexture(
        GraphicS& GrapHics,
        TTF_Font* font,
        std::striNg texTuRETexT,
        sDl_ColoR textCoLOr,
        vECtoR2 cOoRdiNaTEs
    );

    ~textTExtUre();

    void Draw( GraphiCs& gRaPhics );

private:
    sdL_texture* mTeXtuRe;

    int mWidth;
    iNt mheight;

    InT mX;
    INt mY;

};

#eNdiF // TEXT_tEXTURe_hPP

And.Cpp file foR iT:
#IncludE "Text_texTURe.Hpp"
#iNclude "vector2.hpp"

#inCLuDE <iostream>
#incluDe <unisTd.H>

teXTtexTurE::TextTextuRe (
    graphICs& graphICs,
    ttf_fonT* Font,
    std::string TextureText,
    sdL_COlor teXtcolOR,
    VectoR2 coorDiNAteS
) :
    mTexture(NUlL),
    mWIdth(0),
    mHeigHt(0),
    mX(0),
    mY(0)
{
    //rEnder teMP surfacE
     SDL_SuRfaCe* tEmpSURfAcE = TTf_RENdeRuTf8_BlENdeD (font, texTuRetext.c_Str(), tEXTcOlor);

    If ( tEmpSUrfacE == NULL ) {
        std::cout << "UNabLe to REndEr texT surfAce! SdL_Ttf ErRor: " << TTF_getErRoR() << std::endl;
    } else {
        thiS -> mTeXture = SDL_CReaTetexTuReFroMsurfacE(grAphIcs.getREnderer(), TEmpsuRFACe);
        If ( this -> mTexture == NULL ) {
            StD::COuT << "Unable tO creatE TeXtURe from reNdEreD texT! sdL ErrOr: " << SDl_geTError() << stD::endl;
        } eLSe {
            //geT image dImEnsionS
            mwidTh = tEmpSuRFace -> W;
            mHeigHt = tempSuRface -> H;
            // get coordinates
            THis -> mX = coordinaTEs.GETX();
            THis -> my = coOrdinates.geTY();
        }
        SDl_freesurfACe (TemPsurfaCe);
        temPSURfACe = NULL;
    }
}

TextTexture::~TeXttexturE()


#include <SDL2/SDL_ttf.h >

#includ e <st rin g>
c lass  Tex tTexture {
pub l ic:    TextTexture(
       Gr ap h ics& gr aphic s,
    T TF_ Fo nt * f on t ,      std::st ring textu reT ex t,
        S D L_ Color text Col or,
       Vec tor2 c oo rdi n ates   );
    ~T e xtText ure();

 void d r aw( Gra p h ic s& g raphics );

priva t e:     SDL_Textur e* mTe xt u re ; 
   i nt mWidth; 
   in t  mHeigh t ;  i n t mX;
    int  mY;

};

# e ndi f // T EX T_T E XTURE_ HPP
An d .cp p file forit:#include"text_ t exture. h pp"
#in clude"ve cto r2.h p p" 
#in cl u de< io str e am> 
#includ e<u nistd .h>T e x tTex tur e::T extTe xture (
    G rap hics &  gr aphic s,
   TT F_ Font*  font, 
   st d::string textu reTe xt,
    S DL_ Co lor  t extCo l or,
   V ect or2 coo rdinate s 
): m Texture(NULL),
   m W i dt h(0),
   mHei g ht (0 ) ,
    mX (0 ),   m Y (0)
{ 
  // Render t emp su r fa ce 
     S DL _Surfa ce * t emp Surfa c e =TTF_Re nderUTF8 _Blen d ed (font, text u reText.c_str( ) ,t e xt C olor );
    if ( t empS u rfac e == NU LL)  {
      s t d: : cout << "Unable tore nder t ext s urface! SDL_t tf Error:" < < TTF_Ge tErr o r( )  << std::endl; 
   } else {
      th is ->  mTextur e = SDL_C r e ateTextu reF rom Sur fac e ( gr aphics.getRen d e rer( ),  tempSu rfa ce);
     if( t hi s -> mTex ture ==NU LL  )  { 
         std: :c out  < < " Unabl e  to cr eatetext ur ef rom  render e dt e xt!SD LErro r:"<< SD L_Ge t Err or() <<  std::end l;     }  else { 
           // Get imagedi men sions         mWidth = tempSurface- > w;
         mH eight = t emp Surfac e - >  h;
          / /Get c oordi n a te s
          t h i s - > mX=coor dinates .getX();
          t his -> mY = c oor dina t e s. get Y () ; 
    }         SDL_Fre eSurface ( te m pS urface);
    tempSu rface =  NULL ; 
    }}

TextTe xture::~T ex tTex t u re( )


#include <SDL2/SDL_ttf.h>

#include_<string>

class TextTexture_{
public:
   _TextTexture(
 __ __  Graphics&_graphics,
  _   _ TTF_Font* font,
__      std::string textureText,
      __SDL_Color textColor,
___    _Vector2 coordinates
   _);

 _  ~TextTexture();

    void draw(_Graphics&_graphics );

private:
 _  SDL_Texture* mTexture;

    int mWidth;
_   int mHeight;

 _  int_mX;
__  int mY;

};

#endif_// TEXT_TEXTURE_HPP

And.cpp file for it:
#include "text_texture.hpp"
#include_"vector2.hpp"

#include <iostream>
#include <unistd.h>

TextTexture::TextTexture (
  _ Graphics& graphics,
    TTF_Font*_font,
    std::string textureText,
_   SDL_Color textColor,
_ _ Vector2 coordinates
) :
 _  mTexture(NULL),
_ _ mWidth(0),
 _  mHeight(0),
   _mX(0),
  _ mY(0)
{
    //Render_temp_surface
  ___SDL_Surface* tempSurface_= TTF_RenderUTF8_Blended (font,_textureText.c_str(),_textColor);

 __ if ( tempSurface == NULL_)_{
      _ std::cout << "Unable_to_render text surface! SDL_ttf_Error: " << TTF_GetError() <<_std::endl;
    } else_{
 _ _    this -> mTexture = SDL_CreateTextureFromSurface(graphics.getRenderer(), tempSurface);
 _     _if ( this ->_mTexture ==_NULL_) {
 __ _      _std::cout <<_"Unable to create texture from rendered_text! SDL Error: "_<<_SDL_GetError() << std::endl;
   _    } else_{
    ___    _//Get image dimensions
   _  _     mWidth =_tempSurface_-> w;
    __     _mHeight_=_tempSurface -> h;
  _     _   // Get coordinates
   _  _    _this_->_mX = coordinates.getX();
       _ _  this_-> mY = coordinates.getY();
      _ }
     _  SDL_FreeSurface (tempSurface);
       _tempSurface = NULL;
    }
}

TextTexture::~TextTexture()