Devlog #5 Adding GUI

I need to GUI for my game. So, I'm going to type some different components for GUI that is going to be a user-defined module. So firstly, I'm going to create a Canvas component. This component has some features that should contain. These features are color, texture, opacity, size, and position, etc.
canvas in pygame
Of course, I won't use GUI like the image above, it's just a test. Now, we need to add text on our yellow canvas, and it was easy. The important goal is to create a button on the canvas for now. I try to change the building type with this button which I will implement. There is a significant factor about clicking on the button. If we click the button or the canvas, this event shouldn't affect the game map.
inventory of prototype
The buttons that I added it works fine, however, we build this building on the map at the same time. This issue can be seen in the gif above. So, let's prevent this double-event process. As a solution, I made up the ownership of the mouse location and it worked.  

No comments:

Post a Comment