Public Member Functions | |
boolean | notifyQuit (boolean quit) |
Send the Signal to quit the app. | |
void | run () |
The method that is used to start a thread. | |
Static Public Member Functions | |
static void | main (String[] args) |
The main funktion. | |
static GLJPanel | getCanvas () |
static JPanel | getSidebarScore () |
Static Package Attributes | |
static Window | window = new Window() |
create a Window | |
static Thread | displayT = new Thread(window) |
Create the main Thread. | |
Private Member Functions | |
void | close () |
Intended for internal use only. | |
JPanel | createViewport (GLJPanel canvas, JPanel sidebar) |
Create the viewport of the game (the game view, preview score). | |
JPanel | createSidebar () |
Create the Sidebar. | |
void | createMenu (Frame frame) |
Create a menu for the frame given. | |
void | initWindow () |
Initialise the Window. | |
Static Private Attributes | |
static GLJPanel | canvas = new GLJPanel() |
The Gl field for the main game. | |
static JPanel | sidebar = new JPanel() |
the sidebar to display information in. | |
static JPanel | sidebarScore |
The scorefield of the sidebar. | |
static GLJPanel | sidebarPreview = new GLJPanel() |
The preview field of the sidebar. | |
Classes | |
class | ActionEventListener |
The listener to listen to actionevents of the menue. More... |
boolean engine.Window.notifyQuit | ( | boolean | quit | ) |
Send the Signal to quit the app.
This method is used to quit the apliction properly.
quit | A bolean if true the program will quit. |
Referenced by engine.Window.ActionEventListener.actionPerformed(), engine.Window.initWindow(), and engine.JavaRenderer.keyPressed().
static void engine.Window.main | ( | String[] | args | ) | [static] |
The main funktion.
It actually only starts itself in a new thread.
args | Is ignored |
References engine.Window.displayT, engine.Window.initWindow(), and engine.Window.window.
void engine.Window.run | ( | ) |
The method that is used to start a thread.
It sets up the basic Window so that the rendering Process could happen later.
References engine.Window.canvas, and engine.Window.sidebarPreview.
00094 { 00095 while (true) { 00096 canvas.display(); 00097 sidebarPreview.display(); 00098 } 00099 }
void engine.Window.close | ( | ) | [private] |
JPanel engine.Window.createViewport | ( | GLJPanel | canvas, | |
JPanel | sidebar | |||
) | [private] |
Create the viewport of the game (the game view, preview score).
canvas | The game | |
sidebar | The sidebar for preview and score and other informal stuff. |
Referenced by engine.Window.initWindow().
00120 { 00121 JPanel panel = new JPanel(); 00122 00123 // Ein BoxLayout hinzufuegen: Boxlayout ist ein waagerechtes/senkrechtes Layout 00124 // in der alles der reihe nach angefuegt wird. 00125 panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS)); 00126 panel.add(canvas); 00127 panel.add(sidebar); 00128 00129 panel.validate(); 00130 00131 return panel; 00132 }
JPanel engine.Window.createSidebar | ( | ) | [private] |
Create the Sidebar.
References engine.Window.sidebar, engine.Window.sidebarPreview, and engine.Window.sidebarScore.
Referenced by engine.Window.initWindow().
00138 { 00139 sidebar.add(sidebarScore); 00140 sidebar.add(sidebarPreview); 00141 00142 sidebar.setLayout(new BoxLayout(sidebar, BoxLayout.Y_AXIS)); 00143 00144 return sidebar; 00145 }
static GLJPanel engine.Window.getCanvas | ( | ) | [static] |
static JPanel engine.Window.getSidebarScore | ( | ) | [static] |
References engine.Window.sidebarScore.
00157 { 00158 return sidebarScore; 00159 }
void engine.Window.createMenu | ( | Frame | frame | ) | [private] |
Create a menu for the frame given.
frame |
Referenced by engine.Window.initWindow().
00165 { 00166 00167 MenuBar menu = new MenuBar(); 00168 00169 ActionEventListener l = new ActionEventListener(); 00170 Menu game = new Menu("Game"); 00171 game.addActionListener(l); 00172 00173 game.add("Start"); 00174 game.add("Quit"); 00175 00176 menu.add(game); 00177 00178 Menu help = new Menu("Help"); 00179 00180 help.addActionListener(l); 00181 00182 help.add("about"); 00183 00184 menu.add(help); 00185 00186 frame.setMenuBar(menu); 00187 00188 return; 00189 }
void engine.Window.initWindow | ( | ) | [private] |
Initialise the Window.
References engine.Window.canvas, engine.Window.createMenu(), engine.Window.createSidebar(), engine.Window.createViewport(), engine.Window.notifyQuit(), engine.Window.sidebar, and engine.Window.sidebarPreview.
Referenced by engine.Window.main().
00194 { 00195 //The Frame of the Window 00196 Frame frame = new Frame("Solid Java Tetris"); 00197 00198 //Create the menu and add it to the frame 00199 createMenu(frame); 00200 00201 //Create all the visible sections 00202 JPanel viewport = createViewport(canvas, sidebar); 00203 00204 createSidebar(); 00205 00206 //Set up the window 00207 frame.add(viewport); 00208 frame.setSize(600, 650); 00209 frame.setResizable(false); 00210 00211 00212 //React to the close button 00213 frame.addWindowListener(new WindowAdapter() { 00214 @Override 00215 public void windowClosing(WindowEvent e) { 00216 new GameOverEvent(this); 00217 notifyQuit(true); 00218 } 00219 }); 00220 00221 canvas.addGLEventListener(new JavaRenderer(this)); 00222 sidebarPreview.addGLEventListener(new RenderPreview()); 00223 00224 frame.setVisible(true); 00225 00226 canvas.requestFocus(); 00227 }
Window engine.Window.window = new Window() [static, package] |
Thread engine.Window.displayT = new Thread(window) [static, package] |
GLJPanel engine.Window.canvas = new GLJPanel() [static, private] |
The Gl field for the main game.
Referenced by engine.Window.ActionEventListener.actionPerformed(), engine.Window.getCanvas(), engine.Window.initWindow(), and engine.Window.run().
JPanel engine.Window.sidebar = new JPanel() [static, private] |
the sidebar to display information in.
Referenced by engine.Window.createSidebar(), and engine.Window.initWindow().
JPanel engine.Window.sidebarScore [static, private] |
Initial value:
new JPanel(){ private static final long serialVersionUID = 6385011376877032338L; @Override public void paint(Graphics g){ Score.updateScore(); } }
Referenced by engine.Window.createSidebar(), and engine.Window.getSidebarScore().
GLJPanel engine.Window.sidebarPreview = new GLJPanel() [static, private] |
The preview field of the sidebar.
Referenced by engine.Window.createSidebar(), engine.Window.initWindow(), and engine.Window.run().