Logo Search packages:      
Sourcecode: qonk version File versions  Download package

void gcn::Graphics::drawText ( const std::string &  text,
int  x,
int  y,
unsigned int  alignment = LEFT 
) [virtual, inherited]

Draws text.

text the text to draw.
x the x coordinate where to draw the text.
y the y coordinate where to draw the text.
alignment Graphics::LEFT, Graphics::CENTER or Graphics::RIGHT.
Exception when no Font is set.

Definition at line 134 of file graphics.cpp.

References gcn::Font::drawString(), and gcn::Font::getWidth().

Referenced by gcn::Window::draw(), gcn::TextField::draw(), gcn::TextBox::draw(), gcn::RadioButton::draw(), gcn::ListBox::draw(), gcn::Label::draw(), gcn::DropDown::draw(), gcn::CheckBox::draw(), and gcn::Button::draw().

        if (mFont == NULL)
            throw GCN_EXCEPTION("No font set.");

        switch (alignment)
          case LEFT:
              mFont->drawString(this, text, x, y);
          case CENTER:
              mFont->drawString(this, text, x - mFont->getWidth(text) / 2, y);
          case RIGHT:
              mFont->drawString(this, text, x - mFont->getWidth(text), y);
              throw GCN_EXCEPTION("Unknown alignment.");

Generated by  Doxygen 1.6.0   Back to index