New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Button added #58
Button added #58
Conversation
Added files to CMakeLists.txt
Example usage: SDL_Color red, blue, green;
red.r = 200;
red.g = 0;
red.b = 0;
red.a = 255;
blue.r = 0;
blue.g = 0;
blue.b = 200;
blue.a = 255;
green.r = 0;
green.g = 200;
green.b = 0;
green.a = 255;
SDL_Color redHighlighted, blueHighlighted, greenHighlighted;
red.r = 255;
red.g = 0;
red.b = 0;
red.a = 255;
blue.r = 0;
blue.g = 0;
blue.b = 255;
blue.a = 255;
green.r = 0;
green.g = 255;
green.b = 0;
green.a = 255;
Entity *entity = entityManager.addEntity("entity");
Button *button = entity->addComponent<Button>("Text", siz, "opensans", TextAlignment::TOP_LEFT, red, blue);
entity->getComponent<Transform>()->setPosition(250, 250);
button->setButtonPressEffect(true);
button->setButtonHoverColor(blueHighlighted);
button->setButtonPressColor(greenHighlighted);
button->setTextHoverColor(redHighlighted);
button->setTextPressColor(green); |
@requizm thanks a lot for the big contribution, awesome! I did refactor a bit of the code because there was a lot of the BoxCollider2D class that was duplicated. With this code I don't have any problems with the colors like you mentioned. I really like how you made the text alignment. I see the problem with the fill and the text disapearing under it. I don't think this is a quick fix so for now we could just let it be and I could open a bug issue for it. You should check out my refactored version of the code and let me know what you think and if you want to make any changes feel free to do so, if not let me know and then I will merge it. Again big thanks for the contribution and if you ever want to pick up another issue or open one yourself if you have a cool idea feel free to do so! |
@JelleVos1
TLDR; You can merge it. |
Oh I didn't know I used in the Label class before too. I will change that too. I think you have a good point about the collision system for in the future because then this will become an issue however now it was many duplicated code. I think your suggestion of building a second collider system for the UI is a very good idea and I will note that. For now I will merge it. Big thanks for the contribution, you did a great job! Feel free to pick up or create other issues. |
#51
Features
Issues
Screenshots
I am open to discussion.