intro/GraphicUserInterface

From ggc

Jump to: navigation, search

01 package intro;
02 
03 import fang.*;
04 import java.awt.*;
05 import java.awt.geom.*;
06 
07 /**
08  * All about my game.
09  @author My Name Here
10  */
11 public class GraphicUserInterface extends Game
12 {
13   /**an oval*/
14   private Sprite oval;
15   private Model model;
16 
17   /**sets up the game*/
18   public void setup()
19   {
20     model=new Model();
21     makeSprites();
22     addSprites();
23   }
24 
25   /**makes the sprites*/
26   private void makeSprites()
27   {
28     oval=new OvalSprite(21);
29     String colorName=model.getColor();
30     oval.setColor(getColor(colorName));
31     oval.setSize(0.75);
32     oval.setLocation(0.50.5);
33   }
34 
35   /**adds the sprites to the screen*/
36   private void addSprites()
37   {
38     addSprite(oval);
39   }
40 
41   /**handle input and game events*/
42   public void advance()
43   {
44     if(getClick2D()!=null)
45     {
46       model.toggle();
47     }
48     String colorName=model.getColor();
49     oval.setColor(getColor(colorName));
50   }
51 }


Download/View intro/GraphicUserInterface.java





Views
Personal tools
Add to 
del.icio.usAdd to 
diggAdd to 
FacebookAdd to 
favoritesAdd to 
GoogleAdd to 
MySpaceAdd to 
PrintAdd to 
SlashdotAdd to 
StumbleUponAdd to 
Twitter