Sign in to follow this  
95CKILMA

[.net] Iregular GUI elements

Recommended Posts

Ok I've figured how to do this (i belive) however i don think its the best way so im looking for more experience insite. what im looking at is making gui elements (buttons being the best example) that are iregular shapes, such as circles or arrows. Now drawing and rendering isnt a prob however clicking them... normaly id do a rectangle and a x y contain check but well they aint square are they. My solution is to do a IsVisible check on a region that is the shape of the element, the region being generated by a graphicpath which would have to be either made at the load or made though another app and then loaded. this is do able but i dont think the best way so any input would be good btw im using MDX (looking to move to XNA eventualy, either solution will do) thx Ant p.s anyone know why i can post at home but not at work?

Share this post


Link to post
Share on other sites
thx 4 the reply that seams to back up my idea then of usng graphics paths to regions although he dosnt actually check the region when trying to click.

the one thing id know now is the quickst way to get a graphics path out of an image. the only way i know is checkign each pixle.

Share this post


Link to post
Share on other sites
Ideally, you check the pixel in the texture that's clicked to see if it's transparent or not. Here's an article on pixel collision detection in XNA that can be modified to do the job. Instead of checking the pixels in a bounding box of the intersection of the two sprites you just check the one pixel.

Share this post


Link to post
Share on other sites
but if ive generated a region feom distinguishing previously whats transparent and whats not surly thats the same? and it would also be quicker than checking hte pixle in real time?

Share this post


Link to post
Share on other sites
Is speed really that necessary? Unless you're talking about 100 clicks/minute or something silly. Also, if you have a lot of GUI elements do you really want to have to pre-generate all those regions?

Share this post


Link to post
Share on other sites
yer tbh u got a point their, that just me thinking well if im gona do summet i dont wanta have to redress it later, but your right the difference wouldnt be significant i guess

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by Machaira
Is speed really that necessary? Unless you're talking about 100 clicks/minute or something silly.


Ya, but you know some dumbassed end user will try it at some point. :-)



P.S. I'm just joking, but it is kinda true...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this