Advertisement
Guest User

main class

a guest
Mar 29th, 2015
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.83 KB | None | 0 0
  1. package mygame;
  2.  
  3. import com.jme3.app.SimpleApplication;
  4. import com.jme3.math.ColorRGBA;
  5. import com.jme3.math.Vector3f;
  6. import com.jme3.renderer.RenderManager;
  7. import com.jme3.scene.Node;
  8. import com.jme3.system.AppSettings;
  9.  
  10.  
  11. public class Main extends SimpleApplication
  12. {
  13.  
  14.     static boolean orbitSelection = false; //set if mouse is to be used to select on screen items
  15.    
  16.     public static OrbitCamera orbit = null;
  17.     public static Node sceneNode, modelNode, worldNode, camNode;
  18.     public static void main(String[] args)
  19.     {
  20.         AppSettings settings = new AppSettings(true);
  21.         settings.setResolution(720, 480);
  22.         settings.setFullscreen(false);
  23.  
  24.         Main app = new Main();
  25.  
  26.         app.setShowSettings(false);
  27.         app.setSettings(settings);
  28.         app.start();
  29.     }
  30.  
  31.    
  32.     @Override
  33.     public void simpleInitApp()
  34.     {
  35.         //setup scene nodes
  36.         /**
  37.          *                    rootNode
  38.          *                        |
  39.          *      -------------------------------------
  40.          *      |          |                        |
  41.          *   camNode       UINode               sceneNode
  42.          *      |            |                  |       |
  43.          *    camera     UI elements     worldNode     modelNode
  44.          *                                   |              |
  45.          *                                xyz axis    sketch planes
  46.          *                                   |              |        
  47.          *                                xyz planes     sketches
  48.          *
  49.          */
  50.         camNode = new Node();  //node used to control cam
  51.         rootNode.attachChild(camNode);
  52.         sceneNode = new Node(); //parent node to world and model nodes
  53.         worldNode = new Node(); //node containing xyz axis and planes
  54.         modelNode = new Node(); //parent node to all sketch planes
  55.        
  56.         sceneNode.attachChild(worldNode);
  57.         sceneNode.attachChild(modelNode);
  58.         rootNode.attachChild(sceneNode);
  59.         Canvas.setRootAndManager(assetManager, worldNode);
  60.         Canvas.createXYZAxis();
  61.         Canvas.createXYZPlanes();
  62.         Canvas.createDragArrows(guiNode);  //was gui node
  63.         viewPort.setBackgroundColor(ColorRGBA.White);
  64.  
  65.         //setup scene camera
  66.         flyCam.setEnabled(false);
  67.         orbit = new OrbitCamera(new Vector3f(0,0,0), cam,camNode, inputManager);
  68.         //set default location  of camera
  69.         orbit.moveCamera(0.39324224f, -5.1840777f);
  70.  
  71.         //start controls, mouse/keyboard
  72.         Controls con = new Controls(inputManager, rootNode, guiNode);
  73.         con.setupKeys();
  74.        
  75.  
  76.     }
  77.     @Override
  78.     public void simpleUpdate(float tpf)
  79.     {
  80.        
  81.     }
  82.  
  83.     @Override
  84.     public void simpleRender(RenderManager rm)
  85.     {
  86.         //TODO: add render code
  87.     }
  88.  
  89.  
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement