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

Last change on this file since d6b5f74 was f63aa57, checked in by dportnoy <dmp1488@…>, 11 years ago

The old Game window has been completely removed from the client and the client frees all gui components on its own, instead of relying on the Window destructor

  • Property mode set to 100644
File size: 715 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}
11
12GuiComponent* Window::addComponent(GuiComponent* comp)
13{
14 this->vctGui.push_back(comp);
15 return comp;
16}
17
18GuiComponent* Window::getComponent(int x)
19{
20 return this->vctGui[x];
21}
22
23void Window::draw(ALLEGRO_DISPLAY *display)
24{
25 al_clear_to_color(al_map_rgb(0, 0, 0));
26
27 for(unsigned int x=0; x<this->vctGui.size(); x++)
28 this->vctGui[x]->draw(display);
29}
30
31bool Window::handleEvent(ALLEGRO_EVENT& e)
32{
33 for(unsigned int x=0; x<this->vctGui.size(); x++) {
34 if(this->vctGui[x]->handleEvent(e)) {
35 return true;
36 }
37 }
38
39 return false;
40}
Note: See TracBrowser for help on using the repository browser.