Package dev.prozilla.pine.core
Class Application
java.lang.Object
dev.prozilla.pine.core.Application
- All Implemented Interfaces:
Lifecycle
2D application using the LWJGL library.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Config
static final int
static final String
boolean
True if the application has been initializedstatic boolean
True if OpenGL has been initializedprotected Input
boolean
protected boolean
boolean
protected final AppLogger
protected final ModManager
protected final Renderer
protected boolean
protected final Timer
protected final Tracker
protected final Window
-
Constructor Summary
ConstructorsConstructorDescriptionApplication
(int width, int height) Creates an application titled "Application".Application
(String title, int width, int height) Creates an application.Application
(String title, int width, int height, Scene scene) Creates an application.Application
(String title, int width, int height, Scene scene, int targetFps) Creates an application. -
Method Summary
Modifier and TypeMethodDescriptionint
Adds a scene and returns its ID.void
destroy()
Stops the application and cleans up resources.getInput()
getTimer()
void
init()
Initializes the application.void
initPreview
(Input input, int width, int height) void
input
(float deltaTime) Handles input for the application.boolean
boolean
void
Loads the window icons.void
loadScene
(int id) Loads a scene by ID.void
Loads a scene by reference.void
Loads the next scene.void
pause()
Pauses the application.void
Loads the previous scene.static void
Logs versions of libraries to the consolevoid
Reloads the current scene.void
Renders the application.void
void
resize()
Resizes the application window.void
resume()
Resumes the application panel.void
run()
Initializes and starts the application and handles exceptions.void
setDefaultFont
(String fontPath) void
void
start()
Starts the application loop.void
stop()
Tells the application to stop after the current frame.void
Pauses or resumes the application panel based on the current state.void
Unloads the current scene.void
update
(float deltaTime) Updates the application.void
updatePreview
(float deltaTime)
-
Field Details
-
initialized
public boolean initializedTrue if the application has been initialized -
initializedOpenGL
public static boolean initializedOpenGLTrue if OpenGL has been initialized -
isRunning
public boolean isRunning -
shouldStop
protected boolean shouldStop -
isPaused
public boolean isPaused -
isPreview
protected boolean isPreview -
currentScene
-
config
-
logger
-
timer
-
renderer
-
window
-
input
-
tracker
-
modManager
-
DEFAULT_TITLE
- See Also:
-
DEFAULT_TARGET_FPS
public static final int DEFAULT_TARGET_FPS- See Also:
-
-
Constructor Details
-
Application
public Application(int width, int height) Creates an application titled "Application".- Parameters:
width
- Width of the windowheight
- height of the window
-
Application
Creates an application.- Parameters:
title
- Title of the applicationwidth
- Width of the windowheight
- height of the window
-
Application
Creates an application.- Parameters:
title
- Title of the applicationwidth
- Width of the windowheight
- height of the windowscene
- Starting scene
-
Application
Creates an application.- Parameters:
title
- Title of the applicationwidth
- Width of the windowheight
- height of the windowscene
- Starting scenetargetFps
- Amount of frames per second to target
-
-
Method Details
-
run
public void run()Initializes and starts the application and handles exceptions. -
init
Initializes the application.- Specified by:
init
in interfaceLifecycle
- Throws:
RuntimeException
-
initPreview
-
start
public void start()Starts the application loop. Destroys the application after the application loop has been stopped. -
input
public void input(float deltaTime) Handles input for the application. -
update
public void update(float deltaTime) Updates the application. -
updatePreview
public void updatePreview(float deltaTime) -
render
Renders the application. -
renderPreview
public void renderPreview() -
pause
public void pause()Pauses the application. -
resume
public void resume()Resumes the application panel. -
togglePause
public void togglePause()Pauses or resumes the application panel based on the current state. -
stop
public void stop()Tells the application to stop after the current frame. -
destroy
public void destroy()Stops the application and cleans up resources. This should not be called before the application loop ends. -
printVersions
public static void printVersions()Logs versions of libraries to the console -
addScene
Adds a scene and returns its ID.- Parameters:
scene
- Scene- Returns:
- Scene ID
-
reloadScene
public void reloadScene()Reloads the current scene. -
loadScene
Loads a scene by reference.- Parameters:
scene
- Reference to the scene
-
nextScene
public void nextScene()Loads the next scene. -
previousScene
public void previousScene()Loads the previous scene. -
loadScene
public void loadScene(int id) Loads a scene by ID.- Parameters:
id
- Scene ID
-
unloadScene
public void unloadScene()Unloads the current scene. -
setIcons
-
loadIcons
public void loadIcons()Loads the window icons. -
setDefaultFont
-
getDefaultFont
-
resize
public void resize()Resizes the application window. -
isPreview
public boolean isPreview() -
isStandalone
public boolean isStandalone() -
getInput
-
getWindow
-
getRenderer
-
getTimer
-
getTracker
-
getConfig
-
getModManager
-
getLogger
-