Custom Controls

⌘-R in Chief
Posts: 1,277
Joined: 2002.05
Post: #1
In just about every game the UI is never the standard OS interface. How do I go about making custom controls to create my own interface?
Quote this message in a reply
Post: #2
Usually they just use pictures and move them around or switch as necessary. I.e. if you wanted a custom button you can create two pictures, one for when it is unpressed and one for when it is pressed ( another for when it is disabled if needed ). When you get a mouse click you can check to see if the location is in the bounding rectangle of the button picture and switch the picture to show that it is pressed.

Personally, if there needs to be anything beyond custom buttons, you may just want to use the standard Mac OS controls. They provide a lot of functionality that can take a lot of time to reproduce.
Quote this message in a reply
Posts: 608
Joined: 2002.04
Post: #3
If you wanted to be really tricky, you could do mouse-overs (i.e. picture changes when the mouse goes over the button). I have some sample code that shows how to do that; if you want it, just ask.
Quote this message in a reply
Posts: 522
Joined: 2002.04
Post: #4
This sounds like a good idea for a project... an open sourced interface builder for mac games. It could use SpriteWorld to draw stuff, and therefore be able to do OpenGL stuff as well. Hmm this sounds like a project for next year! Unless there is something similar already in existence.

In my experience custom interface building that has lots of effects is a pain in the butt. Finally got a decent list-manager that performs decently.

Quote this message in a reply
Jeff Binder
Post: #5
I'm actually working on a open-source project that includes something like this now. It's almost completely platform-independant, and the few hundred lines of code that are platform-specific are available for Mac OS X and Linux. It's mostly written in C++ and uses OpenGL and SDL.

Right now the interface isn't that advanced (there are no hierarchical views, although I plan to add them), but it's coming along... I also am considering some kind of IB-like app for creating the interfaces (right now everything has to be hard coded).

It's in its early stages, but you can still check it out. You can get it through CVS here:
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Cocoa controls on top of NSOpenGLView wadesworld 5 8,383 Apr 6, 2009 01:38 AM
Last Post: arekkusu
  Apple Controls in OpenGL Talyn 6 7,725 Feb 8, 2009 01:25 PM
Last Post: Talyn