Hay! Ich habe jetzt eine Font-Klasse geschrieben, damit ich kein Image nutzen muss.
Jetzt kommt wie bei den Sprites der gleiche Fehler heraus. Doch ich habe doch Pointer und Referenzen genutzt, oder?
Alles anzeigen
Alles anzeigen
MfG
Check
Jetzt kommt wie bei den Sprites der gleiche Fehler heraus. Doch ich habe doch Pointer und Referenzen genutzt, oder?
Quellcode
- class DLL_GRAPHIC_API Font
- {
- public:
- void Init(const string Filename, sf::Font &Font, unsigned int Size, const string ttf);
- void Color(sf::String &String, int R, int G, int B);
- void Size(sf::String &String, float Size);
- void Position(sf::String &String, float x, float y);
- void Rotation(sf::String &String, float angle);
- void ttf(sf::String &String, sf::Font &Font);
- void Text(sf::String &String, const string Text);
- void SetStyle(sf::String &String, bool bold, bool italic, bool underlined);
- void Move(sf::String &Sring, float x, float y);
- void Render(sf::String &String, sf::RenderWindow App);
- private:
- sf::Font *Fonts;
- sf::String *String;
- };
Quellcode
- void lwtGraphic::Font::Init(const string Filename, sf::Font &Fonts, unsigned int Size, const string ttf)
- {
- if(!Fonts.LoadFromFile(Filename, Size, ttf))
- exit (3);
- }
- void lwtGraphic::Font::Color(sf::String &String, int R, int G, int B)
- {
- String.SetColor(sf::Color(R, G, B));
- }
- void lwtGraphic::Font::Size(sf::String &String, float Size)
- {
- String.SetSize(Size);
- }
- void lwtGraphic::Font::Position(sf::String &String, float x, float y)
- {
- String.SetPosition(x, y);
- }
- void lwtGraphic::Font::Rotation(sf::String &String, float angle)
- {
- String.Rotate(angle);
- }
- void lwtGraphic::Font::Text(sf::String &String, const string Text)
- {
- String.SetText(Text);
- }
- void lwtGraphic::Font::ttf(sf::String &String, sf::Font &Fonts)
- {
- String.SetFont(Fonts);
- }
- void lwtGraphic::Font::SetStyle(sf::String &String, bool bold, bool italic, bool underlined)
- {
- String.SetStyle(sf::String::Regular);
- if(bold==true)
- String.SetStyle(sf::String::Bold);
- if(italic==true)
- String.SetStyle(sf::String::Italic);
- if(underlined==true)
- String.SetStyle(sf::String::Underlined);
- }
- void lwtGraphic::Font::Move(sf::String &String, float x, float y)
- {
- String.Move(x, y);
- }
- void lwtGraphic::Font::Render(sf::String &String, sf::RenderWindow App)
- {
- App.Draw(String);
- }
MfG
Check