source: network-game/client/Client/Window.cpp@ 3b1efcc

Last change on this file since 3b1efcc was 87b3ee2, checked in by dportnoy <dmp1488@…>, 12 years ago

Created a simple gui for the client

  • Property mode set to 100644
File size: 746 bytes
Line 
1#include "Window.h"
2
3Window::Window(int x, int y, int width, int height) :
4 GuiComponent(x, y, width, height, NULL)
5{
6}
7
8Window::~Window(void)
9{
10 for(int x=0; x<this->vctGui.size(); x++)
11 delete this->vctGui[x];
12}
13
14void Window::addComponent(GuiComponent *comp)
15{
16 this->vctGui.push_back(comp);
17}
18
19GuiComponent* Window::getComponent(int x)
20{
21 return this->vctGui[x];
22}
23
24void Window::draw(ALLEGRO_DISPLAY *display)
25{
26 al_clear_to_color(al_map_rgb(0, 0, 0));
27
28 for(int x=0; x<this->vctGui.size(); x++)
29 this->vctGui[x]->draw(display);
30}
31
32bool Window::handleEvent(ALLEGRO_EVENT& e)
33{
34 for(int x=0; x<this->vctGui.size(); x++) {
35 if(this->vctGui[x]->handleEvent(e)) {
36 return true;
37 }
38 }
39
40 return false;
41}
Note: See TracBrowser for help on using the repository browser.