Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianMeizoso committed Mar 15, 2018
2 parents 9241652 + 3151dd4 commit 94211fe
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
7 changes: 3 additions & 4 deletions LCSEngine/ModuleGameUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ void ModuleGameUI::printGameUI()
GLint projectLoc = glGetUniformLocation(program, "projection");
glUniformMatrix4fv(projectLoc, 1, GL_FALSE, &identity[0][0]);

glDisable(GL_DEPTH_TEST);

for (vector<ElementGameUI*>::iterator it = elements.begin(); it != elements.end(); ++it)
{

Expand Down Expand Up @@ -75,8 +77,6 @@ void ModuleGameUI::printGameUI()
}
case BUTTON:
{


UIImage* image = ((UIButton*)(*it))->activeImage;
glUniform1i(glGetUniformLocation(program, "useText"), image->hasTexture);

Expand Down Expand Up @@ -104,7 +104,6 @@ void ModuleGameUI::printGameUI()

glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, NULL);

glDisable(GL_DEPTH_TEST);
UILabel* label = (UILabel*)((UIButton*)(*it))->label;
UIImage* imageLabel = (UIImage*)label->textImage;

Expand Down Expand Up @@ -201,6 +200,6 @@ void ModuleGameUI::printGameUI()
}
}
}

glEnable(GL_DEPTH_TEST);
elements.clear();
}
6 changes: 3 additions & 3 deletions LCSEngine/UIButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,15 @@ void UIButton::updateState()
{
KeyState click = App->input->getMouseButtonDown(1);
bool mouseHoverButton = isHover();
if (!enable)
if (disabled->textureName != "" && !enable)
{
activeImage = disabled;
}
else if ((click == KEY_DOWN && mouseHoverButton) || (click == KEY_REPEAT && activeImage == pressed && mouseHoverButton))
else if (pressed->textureName != "" && ((click == KEY_DOWN && mouseHoverButton) || (click == KEY_REPEAT && activeImage == pressed && mouseHoverButton)))
{
activeImage = pressed;
}
else if (mouseHoverButton)
else if (mouseHoverButton && hover->textureName != "")
{
activeImage = hover;
}
Expand Down
1 change: 1 addition & 0 deletions LCSEngine/UILabel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ UILabel::UILabel(GameObject* parent, int x, int y, int h, int w, bool isVisible)
textImage = (UIImage*)factoryElements->getComponent(IMAGE, nullptr, x, y, h, w, true);

glGenTextures(1, &idTexture);
fillBufferData();
}

UILabel::~UILabel() {}
Expand Down
2 changes: 1 addition & 1 deletion LCSEngine/UILabel.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class UILabel : public ElementGameUI
public:
std::string text;
std::string fontPath;
float textColor[4] = { 1.0f, 1.0f, 1.0f, 1.5f };
float textColor[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
SDL_Color color = {255, 255, 255, 255};
GLuint idTexture;
FontData* fontData = nullptr;
Expand Down

0 comments on commit 94211fe

Please sign in to comment.