Last change
on this file 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
|
Rev | Line | |
---|
[87b3ee2] | 1 | #include "Window.h"
|
---|
| 2 |
|
---|
| 3 | Window::Window(int x, int y, int width, int height) :
|
---|
| 4 | GuiComponent(x, y, width, height, NULL)
|
---|
| 5 | {
|
---|
| 6 | }
|
---|
| 7 |
|
---|
| 8 | Window::~Window(void)
|
---|
| 9 | {
|
---|
| 10 | }
|
---|
| 11 |
|
---|
[f63aa57] | 12 | GuiComponent* Window::addComponent(GuiComponent* comp)
|
---|
[87b3ee2] | 13 | {
|
---|
| 14 | this->vctGui.push_back(comp);
|
---|
[f63aa57] | 15 | return comp;
|
---|
[87b3ee2] | 16 | }
|
---|
| 17 |
|
---|
| 18 | GuiComponent* Window::getComponent(int x)
|
---|
| 19 | {
|
---|
| 20 | return this->vctGui[x];
|
---|
| 21 | }
|
---|
| 22 |
|
---|
| 23 | void Window::draw(ALLEGRO_DISPLAY *display)
|
---|
| 24 | {
|
---|
| 25 | al_clear_to_color(al_map_rgb(0, 0, 0));
|
---|
| 26 |
|
---|
[1a1aebd] | 27 | for(unsigned int x=0; x<this->vctGui.size(); x++)
|
---|
[87b3ee2] | 28 | this->vctGui[x]->draw(display);
|
---|
| 29 | }
|
---|
| 30 |
|
---|
| 31 | bool Window::handleEvent(ALLEGRO_EVENT& e)
|
---|
| 32 | {
|
---|
[1a1aebd] | 33 | for(unsigned int x=0; x<this->vctGui.size(); x++) {
|
---|
[87b3ee2] | 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.