GUI
TextField.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 by Maciej Wiecierzewski
3  */
4 
5 #include "TextField.h"
6 
7 using namespace gui;
8 
9 TextField::TextField(GUISystem *guiSystem, int x, int y, int w, int h, std::string text) :
10  Widget(x, y, w, h),
11  text(text)
12 {
13 }
14 
15 void TextField::render(Renderer *renderer)
16 {
17  int x = xAbs, y = yAbs;
18  renderer->setTarget(x, y, w, h);
19 
20  renderer->drawText(0, 0, text, textColor);
21 }
22 
23 void TextField::setText(const std::string &text)
24 {
25  this->text = text;
26 }
27 
28 std::string TextField::getText()
29 {
30  return text;
31 }