Gamestudio Links
Zorro Links
Newest Posts
zorro with ccxt?
by opm. 03/03/26 03:17
ZorroGPT
by TipmyPip. 03/02/26 18:13
WFO Training with parallel cores Zorro64
by Martin_HH. 02/26/26 16:03
Zorro version 3.0 prerelease!
by TipmyPip. 02/25/26 16:38
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
4 registered members (TipmyPip, Quad, AndrewAMD, USER0328), 5,042 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
the1, alx, ApprenticeInMuc, PatrickH90, USER0328
19200 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
selection box #289504
09/13/09 16:43
09/13/09 16:43
Joined: Apr 2009
Posts: 141
dakilla Offline OP
Member
dakilla  Offline OP
Member

Joined: Apr 2009
Posts: 141
i am currently making an rts game, but when i added a selection box for selecting troops, there became massive fps lag.
So basically i am asking for some code to create a click-and- drag box, because i must be doing something wrong.

Thanks


One day there will be an unfixable bug,
That day is not today.
Re: selection box [Re: dakilla] #289508
09/13/09 17:03
09/13/09 17:03
Joined: Dec 2008
Posts: 271
Saturnus Offline
Member
Saturnus  Offline
Member

Joined: Dec 2008
Posts: 271
The selection box can be drawn using draw_line, draw_quad or something similar.

To check if any entity is within the box, you could cycle through all visible entities (with ent_next() + CLIPPED flag or ent_pvs()) and convert their world coordinates to screen coordinates (vec_to_screen()). Each entities screen coords have to be compared with the screen coords of the selection box.

Re: selection box [Re: Saturnus] #289509
09/13/09 17:11
09/13/09 17:11
Joined: Apr 2009
Posts: 141
dakilla Offline OP
Member
dakilla  Offline OP
Member

Joined: Apr 2009
Posts: 141
thanks, but i have made the code already, its just it impacts loads on the fps, so i was looking for ways to avoid this


One day there will be an unfixable bug,
That day is not today.
Re: selection box [Re: dakilla] #291607
09/26/09 17:44
09/26/09 17:44
Joined: Sep 2009
Posts: 12
Z
zero_karma Offline
Newbie
zero_karma  Offline
Newbie
Z

Joined: Sep 2009
Posts: 12
Maybe if there is no way to avoid it you should just use the code that calculates the vectors to draw the borders of the box then NOT draw the borders; you could point and drag and the troops that WOULD be inside the box are selected as you drag the "would-be" box over them. I've seen this in pro games before so it isn't that bad of a work around.


Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1