2013-05-17 14:50:28 +02:00

82 lines
2.6 KiB
Java

/*
* Copyright (C) 2013 Darth Affe <http://wyrez.org> and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.wyrez.shootingstars;
import com.jme3.app.Application;
import com.jme3.app.DebugKeysAppState;
import com.jme3.app.SimpleApplication;
import com.jme3.app.StatsAppState;
import com.jme3.app.state.AppStateManager;
import com.jme3.math.Vector3f;
import com.jme3.renderer.Camera;
import com.jme3.scene.Node;
import org.wyrez.persij.PersiJContainer;
import org.wyrez.shootingstars.factories.Materials;
import org.wyrez.shootingstars.states.State;
import org.wyrez.shootingstars.states.StateManager;
import tonegod.gui.core.Screen;
/**
*
* @author Darth Affe
*/
public class ShootingStars extends SimpleApplication {
private PersiJContainer container;
private StateManager sManager;
private Screen screen;
public ShootingStars() {
super(new StatsAppState(), new DebugKeysAppState());
}
@Override
public void simpleInitApp() {
System.setProperty("jna.library.path", "lib/vlc");
registerTypes();
initGUI();
Materials.initialize(assetManager);
cam.setFrustumFar(2500f);
//TODO debug
cam.setLocation(new Vector3f(0f, 2500f, 0f));
sManager = container.resolve(StateManager.class);
sManager.setState(State.START);
}
private void initGUI() {
guiNode.addControl(container.resolve(Screen.class));
}
private void registerTypes() {
container = new PersiJContainer();
container.registerSingleton(ShootingStars.class, this);
container.registerSingleton(Application.class, this);
container.registerSingleton(Node.class, rootNode);
container.registerSingleton(Camera.class, cam);
container.registerSingleton(AppStateManager.class, stateManager);
container.registerType(StateManager.class, true);
container.registerType(Screen.class, true);
}
public static void main(String[] args) {
ShootingStars app = new ShootingStars();
app.start();
}
}