Package com.bombinggames.wurfelengine
Class WE
- java.lang.Object
-
- com.bombinggames.wurfelengine.WE
-
public class WE extends java.lang.ObjectThe main class of the engine. To create a new engine uselaunch(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 SoundEngineSOUNDThe sound engine managing the sfx.static java.lang.StringVERSIONThe version of the Engine
-
Constructor Summary
Constructors Constructor Description WE()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddIcon(java.lang.String internalPath)static voidaddPostLaunchCommands(LaunchCommand command)Add commands which will be executed after the engine launched.static <T> TgetAsset(java.lang.String filename)Get an asset from the asset managerstatic com.badlogic.gdx.assets.AssetManagergetAssetManager()To load assets you can use getAsset(String filename)static ConsolegetConsole()Returns the Console.static java.lang.StringgetCredits()Get the credits of the engine.static CVarSystemRootgetCVars()static EngineViewgetEngineView()static GameplayScreengetGameplay()should rarely used because allows global accessstatic com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfigurationgetLwjglApplicationConfiguration()returns the pointer to the LWJGL configuration of the game window.static java.io.FilegetWorkingDirectory()Returns the save file folder, wich is different on every OS.static voidinitAndStartGame(LoadingScreen customLoadingScreen, Controller controller, GameView view)Initialize the main game with you custom controller and view.static booleanisInEditor()static booleanisInGameplay()static voidlaunch(java.lang.String title, java.lang.String[] args)Start the engine.static com.badlogic.gdx.graphics.glutils.ShaderProgramloadShader(boolean internal, java.lang.String fragmentPath, java.lang.String vertexPath)may return null, if three is an error throws exceptionstatic voidsetFullscreen(boolean fullscreen)You can switch to fullscreen.static voidsetMainMenu(AbstractMainMenu mainMenu)Pass the mainMenu which gets displayed when you call launch().static voidsetScreen(WEScreen screen)Set a screen as active.static voidshowMainMenu()Starts the actual game using the gameplayScreen you initialized with initGame(Controller controller, GameView view).static voidstartEditor()Switch into the map editor.static voidstartGame()Starts the actual game using the custom gameplayScreen.static voidswitchSetup(Controller controller, GameView view)static voidswitchSetupWithInit(Controller controller, GameView view)Use different controller and views, which reinitializes them.static voidswitchView(GameView view, boolean editor)static voidupdateAndRender(float dt)updates and render the global things e.g. the console
-
-
-
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.
-
-
Method Detail
-
setMainMenu
public static void setMainMenu(AbstractMainMenu mainMenu)
Pass the mainMenu which gets displayed when you call launch().- Parameters:
mainMenu-- See Also:
launch(java.lang.String, java.lang.String[])
-
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-
-
launch
public static void launch(java.lang.String title, java.lang.String[] args)Start the engine. You should have passed a main menu first.
Until the engine is launched it can take a while. Code that can only be run after the engine has openend should be run in the screen class or as postlaunchCommand.- Parameters:
title- The title, which is displayed in the window.args- Wurfel Engine launch parameters. For a list look in the wiki.- See Also:
setMainMenu(com.bombinggames.wurfelengine.core.AbstractMainMenu),addPostLaunchCommands(com.bombinggames.wurfelengine.LaunchCommand)
-
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 viastartEditor()- Parameters:
controller- the new controllerview- 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.FileNotFoundExceptionGet 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.
-
getConsole
public static Console getConsole()
Returns the Console. UseConsole.add(java.lang.String)to add messages to the console.- Returns:
- The console.
-
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:
-
getCVars
public static CVarSystemRoot getCVars()
- Returns:
-
loadShader
public static com.badlogic.gdx.graphics.glutils.ShaderProgram loadShader(boolean internal, java.lang.String fragmentPath, java.lang.String vertexPath) throws java.lang.Exceptionmay return null, if three is an error throws exception- Parameters:
internal-fragmentPath-vertexPath-- Returns:
- Throws:
java.lang.Exception
-
-