#include "KText.hpp" ➔ class KText

KText

A class that regroups a KSurface, a KFont, a std::string and a KColor.

#include "KSurface.hpp"
#include "KFont.hpp"
#include "KColor.hpp"

class KText : KSurface {};

Constructor

KText(std::string str, KFont font, KColor color);

Set all its attributes.

Method

void change(std::string str);
void change(KFont font);
void change(KColor color);

Change one of its attributes.

Example

KFont font("font.ttf", 32);

if (font.is_opened()) {
    KText text("hello world", font, KColor(40, 40, 40));

    KWindow window("example", 400, 400);
    window.print(text, 10, 10);
    window.display();
}