[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 379: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4690: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4692: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4693: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4694: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
Adam's Lair Forum • View topic - Clicking on game objects.

Adam's Lair Forum

game development and casual madness
It is currently 2019/06/27, 05:08

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 13 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: 2014/11/14, 02:12 
Novice Member
Novice Member

Joined: 2014/11/12, 09:55
Posts: 14
Role: Hobbyist


Top
 Profile  
 
PostPosted: 2014/11/14, 09:08 
Forum Addict
Forum Addict
User avatar

Joined: 2013/09/19, 14:31
Posts: 883
Location: Italy
Role: Hobbyist


Top
 Profile  
 
PostPosted: 2014/11/14, 12:24 
Novice Member
Novice Member

Joined: 2014/11/12, 09:55
Posts: 14
Role: Hobbyist
Well, now I know how to register button clicks. What I need to do now, is to somehow know that my mouse pointer is inside the rigid body, so that when I click while it is, something will happen. I'm not asking you to give me the code for this or anything, I just need a little bit of insight on how this could be achieved. I appreciate the time and effort you put into helping me man, appreciate it a lot! :D


Top
 Profile  
 
PostPosted: 2014/11/14, 15:47 
Forum Addict
Forum Addict
User avatar

Joined: 2013/09/19, 14:31
Posts: 883
Location: Italy
Role: Hobbyist


Top
 Profile  
 
PostPosted: 2014/11/15, 12:48 
Site Admin
Site Admin
User avatar

Joined: 2013/05/11, 22:30
Posts: 2073
Location: Germany
Role: Professional
I just wanted to say that your above explanation is great. :) Thanks for putting all the effort into a thorough posting like this.

Nothing to do for me here. *vanishes*



Top
 Profile  
 
PostPosted: 2014/11/15, 15:49 
Novice Member
Novice Member

Joined: 2014/11/12, 09:55
Posts: 14
Role: Hobbyist
Thank's a ton mate! I'm gonna have a go and look through some of the classes in the source to get a better understanding of this. I hope it's commented, Adam! :D


Top
 Profile  
 
PostPosted: 2016/08/22, 15:05 
Junior Member
Junior Member
User avatar

Joined: 2016/07/22, 12:27
Posts: 49
Role: Professional
Sorry to revive an old topic but I am in a bit of a jam here.

I have buttons / menus that appear above a map. For now I was using Rects and mouse picking but I can't filter the objects to prevent clicking through the buttons. My code has become a bunch of if's, and bools and becoming unreadable.

I think I have to add rigidbodies and use them but doesn't that affect performance too much. I am looking at hundreds of objects at most on the map, it's an RTS though so it may exceed that. I'm used to adding a GUI library for context menus so I am lost. Please help.

_________________
while(!asleep) {sheep++}


Top
 Profile  
 
PostPosted: 2016/08/22, 15:15 
Forum Adept
Forum Adept
User avatar

Joined: 2015/03/15, 02:49
Posts: 354
Location: Out there
Role: Hobbyist
I usually add a method in the object's class that checks if the mouse is over the object's rectangle and do stuff on mouse down.

If you have that many objects and they overlap, than I think you might need to look at it a bit differently.

Can you add a bit more details, please?

_________________
Hello there! Nice to meet you!
I have . Apologies in advance for bad coding practices.


Top
 Profile  
 
PostPosted: 2016/08/22, 15:51 
Junior Member
Junior Member
User avatar

Joined: 2016/07/22, 12:27
Posts: 49
Role: Professional

_________________
while(!asleep) {sheep++}


Top
 Profile  
 
PostPosted: 2016/08/22, 16:43 
Forum Adept
Forum Adept
User avatar

Joined: 2015/03/15, 02:49
Posts: 354
Location: Out there
Role: Hobbyist
Using just an if could solve your problem. Just check if the menu is active, making the rest of the object ignore clicks if it is?

I'd have to try to implement something like that to be of further help. Apologies.

_________________
Hello there! Nice to meet you!
I have . Apologies in advance for bad coding practices.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group