Skip to content
Snippets Groups Projects
Select Git revision
  • a2c4acfa4456d65b803e1018998285d91378554f
  • main default protected
2 results

textwidget.cpp

Blame
  • textwidget.cpp 732 B
    #include "textwidget.h"
    
    using namespace std;
    using namespace genv;
    
    TextWidget::TextWidget(Palya* _p, int _x, int _y, int _w, int _h, string _content) : Widget(_p, _x, _y, _w, _h), content(_content)
    {
        kezdo_hossz = (w - gout.twidth(content))/8;
        kezdo_mag = (h - (gout.cascent()+gout.cdescent()))/2;
    }
    
    void TextWidget::set_text(string vmi)   {content = vmi;}
    
    void TextWidget::draw(){
        gout << color(0,0,0)<<move_to(x,y)<< box(w,h);                                      //border
        gout << color(0,0,0) << move_to(x+1,y+1)<<box(w-2,h-2);                             //fill
        gout << color(255,255,255)<<move_to(x+kezdo_hossz,y+kezdo_mag) << text(content);    //text
    }
    
    TextWidget::~TextWidget(){}