Package a7_Engine

Source Code of a7_Engine.A7_Engine

package a7_Engine;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;

import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JSeparator;

import a7_Event.A7_KeyboardListener;
import a7_Event.A7_MenuListener;
import a7_Event.A7_MousepadListener;
import a7_Event.A7_Thread;
import a7_Graphics.A7_Menubar;
import a7_Graphics.A7_ScreenFactory;

public class A7_Engine{
  private final JFrame window = new JFrame();
  private final A7_ScreenFactory screenFactory;
  private final A7_Thread gameThread;
  private final A7_KeyboardListener keyboardListener;
  private final A7_MousepadListener mousepadListener;
  private final A7_Menubar menubar;
//  private final A7_MenuListener menuListener;
 
  public A7_Engine(int windowX, int windowY, String title) {
    window.setSize(windowX,windowY);
    window.setResizable(false);
    window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    window.setFocusable(true);
    window.setLocationRelativeTo(null);
    window.setTitle(title);
      window.setVisible(true);
     
      screenFactory     = new A7_ScreenFactory(this);
      gameThread       = new A7_Thread(this);
      menubar       = new A7_Menubar(window, screenFactory);

     
//      menuListener    = new A7_MenuListener();
      keyboardListener   = new A7_KeyboardListener();
      mousepadListener   = new A7_MousepadListener();
     

      window.add(gameThread);
     
      window.addKeyListener(keyboardListener);
      window.addMouseListener(mousepadListener);
           
      new Thread(gameThread).start();
  }
 
  public A7_ScreenFactory getScreenFactory() {
    return screenFactory;
  }
 
  public A7_KeyboardListener getKeyboardListener() {
    return keyboardListener;
  }
 
  public A7_MousepadListener getMouseListener() {
    return mousepadListener;
  }
 
  public JFrame getWindow() {
    return window;
  }

}
TOP

Related Classes of a7_Engine.A7_Engine

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.