Any problem from constantly deleting and creating Buttons?

Discuss any general programming issues here
Post Reply
Bugala
Posts: 1181
Joined: Sun Feb 14, 2010 7:11 pm

Any problem from constantly deleting and creating Buttons?

Post by Bugala »

I am wondering what solution I should take to my problem.

Thing is, I have these boxes that are buttons (Could use #SIMPLEBUTTON), but user can scroll around and zoom and unzoom as well, which means that the size and location of the box might change (even outside of the screen), which means that if I used #SIMPLEBUTTON, then that Button wont work properly anymore, since the size of the button have changed.

I am wondering what way should I solve this problem. Should I make my own button system, in which I can dynamically change the size and locations of buttons, or should I just keep deleting and doing MakeButton for all the buttons again and again and again every time something changes on screen.

But Is there any problem in continuously deleting buttons and making them again? I suppose at least from power point of view just making and deleting buttons wont slow down the program much, even if there's hundred of them?

And no, I don't plan on using LayerButtons, which could be a solution too, but I don't intend to use Layers on at all.
plouf
Posts: 473
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: Any problem from constantly deleting and creating Buttons?

Post by plouf »

Shall i guess that its a kind of strategy top view game !?

I dont think any problem exist in recreating buttons
But if its agame style I would use a brush/sprite for "button" and check it onmouseup with Collision()
Christos
Bugala
Posts: 1181
Joined: Sun Feb 14, 2010 7:11 pm

Re: Any problem from constantly deleting and creating Buttons?

Post by Bugala »

No, it is actually an editor I am making for own use. You add boxes which represent locations, and then I am planning on being able to scroll around, zoom and unzoom. Since It is, at least currently, only planned for my own use, I am simply using rectangles as graphics, and hence can use #SIMPLEBUTTON for button creation.

But thanks from that tip. I have sometimes been wondering about how to solve that problem since I do have couple of games in my mind that you could at least in this sense call as strategy top view game, and I had completely missed you could do collision check with your mouse against brushes, which I think will be very good solution to those ones. So while you didn't solve this problem I was asking for, you solved me another problem I was expecting to tackle in future.
Post Reply