[.net] Iregular GUI elements

Started by
6 comments, last by GameDev.net 17 years, 6 months ago
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?
Advertisement
Clicky

Former Microsoft XNA and Xbox MVP | Check out my blog for random ramblings on game development

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.
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.

Former Microsoft XNA and Xbox MVP | Check out my blog for random ramblings on game development

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?
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?

Former Microsoft XNA and Xbox MVP | Check out my blog for random ramblings on game development

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
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...

This topic is closed to new replies.

Advertisement