Why does game GUI have to be rectangles?

Started by
12 comments, last by Dim_Yimma_H 9 years, 10 months ago

Why does game GUI buttoins have to be rectangles?, why cant they be abnormal shapes?

:)
Advertisement

Buttons don't have to be rectangular, but it's generally easier to implement/create a framework for buttons which have a nice geometrical/symmetrical shape.

If you want, you can create buttons which are whatever shape you can think of.

Edit: Being a ninja.

Hello to all my stalkers.

blink.png

It doesn't have to. There's plenty of games with round buttons or buttons that look like icons.

It's pretty standard though. People immediately recognize a button when it's more or less rectangular, not so much when it looks like a star.

It's also a whole lot easier to code, not only for detecting if the mouse cursor is over said button, but you can inherit from an existing button class (depending on language/framework)

edit: Ninja'd :)

yes i understand that its easier to implement as a rectangle for easy functionality with the mouse coordinates,but its is possible to make a star button and been able to click it without it being a rectangle point checking.

:)

I also feel like an interface that has a regular pattern is easier for the user to process. If you include too many weird shapes and layouts it may be confusing to the user. I'm not saying that irregular button shapes can't be done well so it isn't confusing, but you just need to be careful not to let innovation in the UI to over complicate it. Cool idea though.

My current game project Platform RPG

is possible to make a star button and been able to click it without it being a rectangle point checking.

There has to be some means of determining if the user intends to click on the button, or is clicking somewhere else. It doesn't have to be a "rectangle point" check. You can come up with another way to check if the mouse-click location is within the shape of the button - that's just a lot more difficult.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

yes i understand that its easier to implement as a rectangle for easy functionality with the mouse coordinates,but its is possible to make a star button and been able to click it without it being a rectangle point checking.


Of course. Why wouldn't it be possible? It's software - you can make the screen show anything you want and process input any way you want. You can take a mouse position, check if it's contained by any arbitrary shape, and then do whatever the heck you want with that information.

Sean Middleditch – Game Systems Engineer – Join my team!


yes i understand that its easier to implement as a rectangle for easy functionality with the mouse coordinates,but its is possible to make a star button and been able to click it without it being a rectangle point checking.

Sure. Plenty of software does this.

One of the easiest ways is to store the hit regions of your icons as 1-bit (i.e. black and white) bitmap images. Then you can supply arbitrary shapes as images, and the hit test is as simple as "is the pixel under the mouse white?".

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Well, if you work with non-mouse input, it is very good practice to actually detect selection with an area that is a little bit smaller that what you show graphically (or displaced).

If I remember correctly the main menu of Starcraft was a gallactic map. One of the coolest things I've seen in my childhood for game UI :) So, sure, go ahead and do something awesome. Besides, the algorithms for determining whether a point belongs to a closed geometric shape are known, so you don't have to invent anything new. And swiftcoder's idea is even more awesome, because it is simple and fast.

yes i understand that its easier to implement as a rectangle for easy functionality with the mouse coordinates,but its is possible to make a star button and been able to click it without it being a rectangle point checking.


Of course. Why wouldn't it be possible? It's software - you can make the screen show anything you want and process input any way you want. You can take a mouse position, check if it's contained by any arbitrary shape, and then do whatever the heck you want with that information.

On the technical side, the shape can be arbitrary.

On the human size, one have to consider how we are procesing shapes. If it's a bit complex we'll lost the purpose of the button and we'll focus on the button itself. That makes it less readable. If it's really complex (for example a really weird concave shape with numerous holes and so on) we'll have problem discerning the button itself, and we won't know where we are supposed to click.

So while we're not limited to rectangle, it's still a good idea to limit ourselves to simple, convex shapes - unless they represent a pattern which is easily understood (such as a country on a world map). Noone wants to make something that is too complex to be parsed by an average humain brain.

This topic is closed to new replies.

Advertisement