Package ast.level

Source Code of ast.level.MainMenu

package ast.level;

import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.util.vector.Vector2f;
import org.lwjgl.util.vector.Vector3f;

import ast.Game;
import ast.StateManager;
import ast.StateManager.State;
import ast.effect.ParticleEffect;
import ast.ui.UI;

public  class MainMenu {
 
  private static ParticleEffect effect;
 
  public static void init(){
    effect = new ParticleEffect(new Vector3f(0, 0,-10), 70, 10.1f);   
  }
 
  public static void update(int delta){
    effect.update(delta);
    if(Mouse.isButtonDown(0)){
      StateManager.setState(State.Game);
      cleanUp();
    }
   
    if(Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)){
      Game.exit();
    }
  }
 
  public static void render(){
    float fontSize = 0.05f;
    effect.render();
    UI.enable2D();
      UI.drawText("ASTEROIDS", new Vector2f(0.5f - (4.5f*fontSize), 0.7f), fontSize);
      UI.drawText("Click to begin", new Vector2f(0.5f - (7 * fontSize/1.5f), 0.4f), fontSize/1.5f);   
    UI.disable2D();
  }
 
 
  public static void cleanUp(){
    effect = null;
  }

}
TOP

Related Classes of ast.level.MainMenu

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.