123456789101112131415161718192021222324252627282930313233343536373839 |
- #include "client/gui/StartGUI.h"
- #include "client/rendering/Engine.h"
- StartGUI::StartGUI()
- : info(base.addLabel("Connect to server ...")), address(base.addInput()),
- connect(base.addButton("Connect ...")) {
- address.text.clear().append("127.0.0.1");
- }
- void StartGUI::tick() {
- base.tick();
- }
- void StartGUI::render() {
- base.updateScale();
- Vector2 size = Vector2(BaseGUI::FIXED_SIZE[0] - 80.0f, 110.0f);
- Vector2 pos = (base.scaledSize - size) * 0.5f;
- info.base.pos = pos;
- info.base.size = Vector2(size[0], 30.0f);
- address.base.pos = pos + Vector2(40.0f, 30.0f);
- address.base.size = Vector2(size[0] - 80.0f, 30.0f);
- connect.base.pos = pos + Vector2(40.0f, 70.0f);
- connect.base.size = Vector2(size[0] - 80.0f, 30.0f);
- Engine::renderer.renderRectangle(pos, size, Color4(0x50, 0x50, 0x50, 0xFF));
- base.render();
- }
- bool StartGUI::getAddress(Address& a) const {
- if(connect.base.pressed) {
- address.text.toString(a);
- return true;
- }
- return false;
- }
|