Java-Gaming.org Java4K winners: [ by our judges | by the community ]         
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members



News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  Print  
  Interfaces  (Read 1012 times)
0 Members and 2 Guests are viewing this topic.
Offline Mads

JGO Ninja
***

Posts: 674
Medals: 16


Directly directional


« on: 2011-03-28 09:04:15 »

How do you usually go about interfaces and menu-screens? I tend to create an array of these objects, and forward clicks out to each of them being shown, but I think thats a weird way of doing it.

Offline Mickelukas

JGO Ninja
***

Posts: 731
Medals: 25


Java guru wanabee


« Reply #1 on: 2011-03-28 09:53:44 »

I do the same but only send the clicks after having done a contain() to the rect of the element

Mike

Offline ra4king

JGO Kernel
*****

Posts: 3155
Medals: 196


I'm the King!


« Reply #2 on: 2011-03-29 23:19:40 »

I have a framework for a menu system.
I have a Menus class that has an ArrayList of MenuPage's. MenuPage has an ArrayList of MenuItem's.
Menus register the mouse and motion listeners and it delegates the events to the current MenuPage shown, which loops through all the MenuItem's, using item.getBounds().contains(int x,int y), which then delegates it to its handler.

Hope that helped Grin

Pages: [1]
  Print  
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.076 seconds with 19 queries.