Class WE



  • public class WE
    extends java.lang.Object
    The main class of the engine. To create a new engine use launch(String, String[]) The Wurfel Engine needs Java >= v1.8 and the API libGDX v1.8.0 (may work with older versions).
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static SoundEngine SOUND
      The sound engine managing the sfx.
      static java.lang.String VERSION
      The version of the Engine
    • Constructor Summary

      Constructors 
      Constructor Description
      WE​()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void addIcon​(java.lang.String internalPath)  
      static void addPostLaunchCommands​(LaunchCommand command)
      Add commands which will be executed after the engine launched.
      static <T> T getAsset​(java.lang.String filename)
      Get an asset from the asset manager
      static com.badlogic.gdx.assets.AssetManager getAssetManager​()
      To load assets you can use getAsset(String filename)
      static Console getConsole​()
      Returns the Console.
      static java.lang.String getCredits​()
      Get the credits of the engine.
      static CVarSystemRoot getCVars​()  
      static EngineView getEngineView​()  
      static GameplayScreen getGameplay​()
      should rarely used because allows global access
      static com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration getLwjglApplicationConfiguration​()
      returns the pointer to the LWJGL configuration of the game window.
      static java.io.File getWorkingDirectory​()
      Returns the save file folder, wich is different on every OS.
      static void initAndStartGame​(LoadingScreen customLoadingScreen, Controller controller, GameView view)
      Initialize the main game with you custom controller and view.
      static boolean isInEditor​()  
      static boolean isInGameplay​()  
      static void launch​(java.lang.String title, java.lang.String[] args)
      Start the engine.
      static com.badlogic.gdx.graphics.glutils.ShaderProgram loadShader​(boolean internal, java.lang.String fragmentPath, java.lang.String vertexPath)
      may return null, if three is an error throws exception
      static void setFullscreen​(boolean fullscreen)
      You can switch to fullscreen.
      static void setMainMenu​(AbstractMainMenu mainMenu)
      Pass the mainMenu which gets displayed when you call launch().
      static void setScreen​(WEScreen screen)
      Set a screen as active.
      static void showMainMenu​()
      Starts the actual game using the gameplayScreen you initialized with initGame(Controller controller, GameView view).
      static void startEditor​()
      Switch into the map editor.
      static void startGame​()
      Starts the actual game using the custom gameplayScreen.
      static void switchSetup​(Controller controller, GameView view)  
      static void switchSetupWithInit​(Controller controller, GameView view)
      Use different controller and views, which reinitializes them.
      static void switchView​(GameView view, boolean editor)  
      static void updateAndRender​(float dt)
      updates and render the global things e.g. the console
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • VERSION

        public static final java.lang.String VERSION
        The version of the Engine
        See Also:
        Constant Field Values
      • SOUND

        public static final SoundEngine SOUND
        The sound engine managing the sfx.
    • Constructor Detail

      • WE

        public WE​()
    • Method Detail

      • setScreen

        public static void setScreen​(WEScreen screen)
        Set a screen as active.
        Parameters:
        screen -
      • addPostLaunchCommands

        public static void addPostLaunchCommands​(LaunchCommand command)
        Add commands which will be executed after the engine launched.
        Parameters:
        command -
      • addIcon

        public static void addIcon​(java.lang.String internalPath)
        Parameters:
        internalPath -
      • getLwjglApplicationConfiguration

        public static com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration getLwjglApplicationConfiguration​()
        returns the pointer to the LWJGL configuration of the game window.
        Returns:
      • initAndStartGame

        public static void initAndStartGame​(LoadingScreen customLoadingScreen,
                                            Controller controller,
                                            GameView view)
        Initialize the main game with you custom controller and view. This call shows the loadingScreen and disposes the menu.
        Parameters:
        customLoadingScreen -
        controller -
        view -
        See Also:
        startGame()
      • switchSetupWithInit

        public static void switchSetupWithInit​(Controller controller,
                                               GameView view)
        Use different controller and views, which reinitializes them. Enter the editor via startEditor()
        Parameters:
        controller - the new controller
        view - the new view
      • switchSetup

        public static void switchSetup​(Controller controller,
                                       GameView view)
        Parameters:
        controller -
        view -
      • switchView

        public static void switchView​(GameView view,
                                      boolean editor)
        Parameters:
        view -
        editor - true if this is the editor setup
      • startEditor

        public static void startEditor​()
        Switch into the map editor. If the editor is already running it will restart it.
      • isInEditor

        public static boolean isInEditor​()
        Returns:
      • startGame

        public static void startGame​()
        Starts the actual game using the custom gameplayScreen. This is called after the loading screen finishes.
      • isInGameplay

        public static boolean isInGameplay​()
        Returns:
        true when in gameplay (editor counts as gameplay)
      • showMainMenu

        public static void showMainMenu​()
        Starts the actual game using the gameplayScreen you initialized with initGame(Controller controller, GameView view). This is called after the loading screen.
      • getCredits

        public static final java.lang.String getCredits​()
        Get the credits of the engine.
        Returns:
        a long string with breaks
      • getWorkingDirectory

        public static java.io.File getWorkingDirectory​()
        Returns the save file folder, wich is different on every OS.
        Returns:
        a folder
      • setFullscreen

        public static void setFullscreen​(boolean fullscreen)
        You can switch to fullscreen. It only works if the current window resolution is supported by your hardware.
        Parameters:
        fullscreen -
      • getAsset

        public static <T> T getAsset​(java.lang.String filename)
                              throws java.io.FileNotFoundException
        Get an asset from the asset manager
        Type Parameters:
        T -
        Parameters:
        filename - the name of the file
        Returns:
        returns the asset
        Throws:
        java.io.FileNotFoundException
      • getAssetManager

        public static com.badlogic.gdx.assets.AssetManager getAssetManager​()
        To load assets you can use getAsset(String filename)
        Returns:
        the asset manager.
      • getEngineView

        public static EngineView getEngineView​()
        Returns:
        Get the view independent view.
      • updateAndRender

        public static void updateAndRender​(float dt)
        updates and render the global things e.g. the console
        Parameters:
        dt - time in ms
      • getGameplay

        public static GameplayScreen getGameplay​()
        should rarely used because allows global access
        Returns:
      • loadShader

        public static com.badlogic.gdx.graphics.glutils.ShaderProgram loadShader​(boolean internal,
                                                                                 java.lang.String fragmentPath,
                                                                                 java.lang.String vertexPath)
                                                                          throws java.lang.Exception
        may return null, if three is an error throws exception
        Parameters:
        internal -
        fragmentPath -
        vertexPath -
        Returns:
        Throws:
        java.lang.Exception