Package org.pollux3d.state

Source Code of org.pollux3d.state.MenuState

package org.pollux3d.state;

import java.util.logging.Level;
import java.util.logging.Logger;

import org.pollux3d.menu.InfoBox;

import com.jme3.app.Application;
import com.jme3.app.state.AbstractAppState;
import com.jme3.app.state.AppStateManager;
import com.jme3.asset.AssetManager;
import com.jme3.font.BitmapFont;
import com.jme3.font.BitmapText;
import com.jme3.font.Rectangle;
import com.jme3.material.Material;
import com.jme3.material.RenderState.BlendMode;
import com.jme3.material.RenderState.FaceCullMode;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector2f;
import com.jme3.math.Vector3f;
import com.jme3.renderer.queue.RenderQueue.Bucket;
import com.jme3.scene.Geometry;
import com.jme3.scene.Mesh;
import com.jme3.scene.Node;
import com.jme3.scene.VertexBuffer.Type;
import com.jme3.scene.shape.Quad;
import com.jme3.system.AppSettings;
import com.jme3.ui.Picture;
import com.jme3.util.BufferUtils;

public class MenuState extends AbstractAppState {

  private Node menuNode = new Node("Menu Node");
  private AssetManager assetManager;
  private static final Logger logger = Logger.getLogger(MenuState.class.getName());
  private AppSettings settings;
  //private String txtB = "ABCDEFGHIKLMNOPQRSTUVWXYZ1234567890`~!@#$%^&*()-=_+[]\\;',./{}|:<>?";

  private InfoBox infoBox;
 
  public Node getMenuNode() {
    return menuNode;
  }
 
  public void initialize(AppStateManager stateManager, Application app){
    super.initialize(stateManager, app);
    assetManager = app.getAssetManager();
    settings = app.getContext().getSettings();
   
    Picture pic = new Picture("HUD Picture");
    pic.setImage(assetManager, "Hud/InfoBox2.png", true);
    pic.setHeight(settings.getHeight());
    pic.setWidth(settings.getHeight()/2);
    pic.setPosition(settings.getWidth()-settings.getHeight()/2, 0);
    menuNode.attachChild(pic);
   
   
    /*Quad q = new Quad(6, 3);
        Geometry g = new Geometry("quad", q);
        g.setLocalTranslation(0, -3, -0.0001f);
        Material mat_tt = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        mat_tt.setTexture("ColorMap",assetManager.loadTexture("Textures/ColoredTex/Monkey.png"));
        mat_tt.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
        mat_tt.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off);
        mat_tt.getAdditionalRenderState().setAlphaTest(true);
        g.setMaterial(mat_tt);*/
        /** Objects with transparency need to be in the render bucket for transparent objects: */
        /*g.setQueueBucket(Bucket.Transparent);
        menuNode.attachChild(g);*/
    /*
        BitmapFont fnt = assetManager.loadFont("Interface/Fonts/Arial.fnt");
        BitmapText txt = new BitmapText(fnt, false);
        txt.setBox(new Rectangle(0, 0, 6, 3));
        txt.setQueueBucket(Bucket.Transparent);
        txt.setSize( 0.5f );
        txt.setText(txtB);
        menuNode.attachChild(txt);
        */
   
    /*Quad myQuad = new Quad(200,200);
    Geometry quad = new Geometry("Quad", myQuad);
    Material mat = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");
    mat.setColor("Color", new ColorRGBA(1,0,0,0.25f));
    mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
    quad.setMaterial(mat);
    menuNode.attachChild(quad);

   
    BitmapFont myFont = assetManager.loadFont("Interface/Fonts/Arial.fnt");
    logger.log(Level.ALL, myFont.toString());
    BitmapText hudText = new BitmapText(myFont, false);
    hudText.setSize(myFont.getCharSet().getRenderedSize());
    hudText.setColor(ColorRGBA.LightGray);
    hudText.setText("Fire at Enemy!");
    hudText.setLocalTranslation(300, 300,0 );
    menuNode.attachChild(hudText);*/
   
   
   
   
   
   
   
   
  }
 
}
 
TOP

Related Classes of org.pollux3d.state.MenuState

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.