00001 #include "LifeVariables.h"
00002 #include "GuiComponent.h"
00003 #include "OrthographicCamera.h"
00004
00005
00006 GuiComponent::GuiComponent(int left, int right, int bottom, int top,
00007 int x, int y, int width, int height):
00008 OrthographicCamera(left, right, bottom, top, x, y, width, height)
00009 {}
00010
00011
00012 void GuiComponent::moveTo(int newX, int newY) {
00013 this->x = newX;
00014 this->y = newY;
00015 }
00016
00017 void GuiComponent::enable() {
00018 this->state = ENABLED;
00019 }
00020
00021
00022 void GuiComponent::disable() {
00023 this->state = DISABLED;
00024 }
00025
00026 void GuiComponent::hide() {
00027 this->state = HIDDEN;
00028 }
00029
00030
00031 void GuiComponent::updating() {
00032 this->state = UPDATING;
00033 }
00034
00035 bool GuiComponent::isEnabled() {
00036 return (this->state == ENABLED);
00037 }
00038
00039
00040 bool GuiComponent::isHidden() {
00041 return (this->state == HIDDEN);
00042 }
00043
00044
00045 bool GuiComponent::isDisabled() {
00046 return (this->state == DISABLED);
00047 }
00048
00049
00050 bool GuiComponent::isUpdating() {
00051 return (this->state == UPDATING);
00052 }
00053
00054
00055 bool GuiComponent::hit(int x, int y) {
00056 return ((x >= this->x) &&
00057 (x <= (this->x+this->w)) &&
00058 (y >= this->y) &&
00059 (y <= (this->y+this->h)));
00060 }