Package rosequartz.gfx
Class Graphics
java.lang.Object
rosequartz.gfx.Graphics
Class for general method calls and errors in the 'rosequartz.graphics'-package.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidInitializes static variables used in the graphics classes.static ObjectTells this class that the main class finished execution and usage of a GraphicsPipeline is now needed.static void_setInGraphicsPipeline(Object identification, boolean inGraphicsPipeline)Tells this class if the executed code is in a graphics pipeline.static voidSets the calling thread to be the graphics thread.static voidRequires the current thread to be the main thread.static floatGets the height of the device display.static Vec2Gets the size of the device display.static floatGets the width of the device display.static StringReturns a summary of the current state of the OpenGL-Pipeline.static floatGets the height of the game window.static booleanGets if the window is currently in focus.static Vec2Gets the size of the game window/static floatGets the width of the game window.
-
Method Details
-
_setMainThread
Sets the calling thread to be the graphics thread.- Throws:
CallerNotEngineRuntimeException
-
_requireGraphicsPipeline
Tells this class that the main class finished execution and usage of a GraphicsPipeline is now needed. May only be called once by the engine runtime.- Returns:
- object used to identify engine runtime
- Throws:
CallerNotEngineRuntimeException
-
_setInGraphicsPipeline
public static void _setInGraphicsPipeline(Object identification, boolean inGraphicsPipeline) throws CallerNotEngineRuntimeExceptionTells this class if the executed code is in a graphics pipeline.- Parameters:
identification- object used to identify engine runtimeinGraphicsPipeline- in graphics pipeline- Throws:
CallerNotEngineRuntimeException
-
requireMainThread
Requires the current thread to be the main thread.- Throws:
NotOnGraphicsThreadException- if not on graphics thread
-
_initializeStatics
Initializes static variables used in the graphics classes.- Throws:
CallerNotEngineRuntimeException
-
windowWidth
public static float windowWidth()Gets the width of the game window.- Returns:
- window width
-
windowHeight
public static float windowHeight()Gets the height of the game window.- Returns:
- window height
-
windowSize
Gets the size of the game window/- Returns:
- window size
-
windowInFocus
public static boolean windowInFocus()Gets if the window is currently in focus.- Returns:
- window in focus
-
screenWidth
public static float screenWidth()Gets the width of the device display.- Returns:
- device display width
-
screenHeight
public static float screenHeight()Gets the height of the device display.- Returns:
- device display height
-
screenSize
Gets the size of the device display.- Returns:
- device display size
-
stateToString
Returns a summary of the current state of the OpenGL-Pipeline. Should something render incorrectly (or not at all), it's useful to look at the output for debugging. Simple and easy mistakes like forgetting to upload or render a VertexArray, forgetting to disable / enable depth testing and so on are easily noticeable here.- Returns:
- current state of the OpenGL-Pipeline
-