Package com.teamjmonkey.appstates

Source Code of com.teamjmonkey.appstates.NewFlyCamAppState

package com.teamjmonkey.appstates;

import com.jme3.app.Application;
import com.jme3.app.state.AbstractAppState;
import com.jme3.app.state.AppStateManager;
import com.teamjmonkey.GameNameGoesHere;
import com.teamjmonkey.util.NewFlyCamera;

public class NewFlyCamAppState extends AbstractAppState {

    private NewFlyCamera flyCam;
    private GameNameGoesHere myApp = GameNameGoesHere.getApp();

    public NewFlyCamAppState() {
        flyCam = new NewFlyCamera(myApp.getCamera());
        flyCam.setConstraint(true);
    }

    /**
     *  This is called by SimpleApplication during initialize().
     */
    void setCamera(NewFlyCamera cam) {
        this.flyCam = cam;
    }

    public NewFlyCamera getCamera() {
        return flyCam;
    }

    @Override
    public void stateAttached(AppStateManager stateManager) {
        super.stateAttached(stateManager);

        setEnabled(true);
        flyCam.registerWithInput(myApp.getInputManager());
    }

    @Override
    public void stateDetached(AppStateManager stateManager) {
        super.stateDetached(stateManager);

        setEnabled(false);
        flyCam.unregisterInput();
    }

    @Override
    public void setEnabled(boolean enabled) {
        super.setEnabled(enabled);

        flyCam.setEnabled(enabled);
    }

    @Override
    public void cleanup() {
        super.cleanup();
    }
}
TOP

Related Classes of com.teamjmonkey.appstates.NewFlyCamAppState

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.