APIdia Launch Partner
Top Description Fields Constructors Methods
com.badlogic.gdx.backends.headless.mock.graphics

public Class MockGraphics

extends AbstractGraphics
Class Inheritance
Imports
com.badlogic.gdx.AbstractGraphics, .Application, com.badlogic.gdx.graphics.Cursor, .GL20, .GL30, .GL31, .GL32, .Pixmap, .Cursor.SystemCursor, com.badlogic.gdx.graphics.glutils.GLVersion

The headless backend does its best to mock elements. This is intended to make code-sharing between server and client as simple as possible.

Field Summary

Modifier and TypeField and Description
pack-priv float
pack-priv int
pack-priv long
pack-priv int
pack-priv long
pack-priv GLVersion
pack-priv long
pack-priv long

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public int
public int
public Graphics.BufferFormat
public float
public Graphics.DisplayMode
public Graphics.DisplayMode
public Graphics.DisplayMode[]
public Graphics.DisplayMode[]
public long
getFrameId()

Implements com.badlogic.gdx.Graphics.getFrameId.

Returns the id of the current frame.

public int
public GL20
public GL30
public GL31
public GL32
public GLVersion
public int
public Graphics.Monitor
public Graphics.Monitor[]
public float
public float
public float
public float
public Graphics.Monitor
public int
public int
public int
public int
public long
public Graphics.GraphicsType
public int
public void
public boolean
public boolean
isFullscreen()

Implements com.badlogic.gdx.Graphics.isFullscreen.

Whether the app is fullscreen or not

public boolean
isGL30Available()

Implements com.badlogic.gdx.Graphics.isGL30Available.

Returns whether OpenGL ES 3.0 is available.

public boolean
isGL31Available()

Implements com.badlogic.gdx.Graphics.isGL31Available.

Returns whether OpenGL ES 3.1 is available.

public boolean
isGL32Available()

Implements com.badlogic.gdx.Graphics.isGL32Available.

Returns whether OpenGL ES 3.2 is available.

public Cursor
newCursor(Pixmap pixmap, int xHotspot, int yHotspot)

Implements com.badlogic.gdx.Graphics.newCursor.

Create a new cursor represented by the com.badlogic.gdx.graphics.Pixmap.

public void
requestRendering()

Implements com.badlogic.gdx.Graphics.requestRendering.

Requests a new frame to be rendered if the rendering mode is non-continuous.

public void
setContinuousRendering(boolean isContinuous)

Implements com.badlogic.gdx.Graphics.setContinuousRendering.

Sets whether to render continuously.

public void
setCursor(Cursor cursor)

Implements com.badlogic.gdx.Graphics.setCursor.

Only viable on the lwjgl-backend and on the gwt-backend.

public void
setForegroundFPS(int
fps
fps
)

Implements com.badlogic.gdx.Graphics.setForegroundFPS.

Sets the target framerate for the application.

public boolean
setFullscreenMode(Graphics.DisplayMode displayMode)

Implements com.badlogic.gdx.Graphics.setFullscreenMode.

Sets the window to full-screen mode.

public void
setGL20(GL20 gl20)

Implements com.badlogic.gdx.Graphics.setGL20.

Set the GL20 instance

public void
setGL30(GL30 gl30)

Implements com.badlogic.gdx.Graphics.setGL30.

Set the GL30 instance

public void
setGL31(GL31 gl31)

Implements com.badlogic.gdx.Graphics.setGL31.

Set the GL31 instance

public void
setGL32(GL32 gl32)

Implements com.badlogic.gdx.Graphics.setGL32.

Set the GL32 instance

public void
setResizable(boolean resizable)

Implements com.badlogic.gdx.Graphics.setResizable.

Sets whether or not the window should be resizable.

public void
setSystemCursor(Cursor.SystemCursor systemCursor)

Implements com.badlogic.gdx.Graphics.setSystemCursor.

Sets one of the predefined SystemCursors

public void
setTitle(String title)

Implements com.badlogic.gdx.Graphics.setTitle.

Sets the title of the window.

public void
setUndecorated(boolean undecorated)

Implements com.badlogic.gdx.Graphics.setUndecorated.

Sets the window decoration as enabled or disabled.

public void
setVSync(boolean vsync)

Implements com.badlogic.gdx.Graphics.setVSync.

Enable/Disable vsynching.

public boolean
setWindowedMode(int width, int height)

Implements com.badlogic.gdx.Graphics.setWindowedMode.

Sets the window to windowed mode.

public boolean
supportsDisplayModeChange()

Implements com.badlogic.gdx.Graphics.supportsDisplayModeChange.

Whether the given backend supports a display mode change via calling Graphics#setFullscreenMode(DisplayMode)

public boolean
public void
Inherited from com.badlogic.gdx.AbstractGraphics:
getBackBufferScalegetDensitygetRawDeltaTime

Field Detail

deltaTimeback to summary
pack-priv float deltaTime
fpsback to summary
pack-priv int fps
frameIdback to summary
pack-priv long frameId
framesback to summary
pack-priv int frames
frameStartback to summary
pack-priv long frameStart
glVersionback to summary
pack-priv GLVersion glVersion
lastTimeback to summary
pack-priv long lastTime
targetRenderIntervalback to summary
pack-priv long targetRenderInterval

Constructor Detail

MockGraphicsback to summary
public MockGraphics()

Method Detail

getBackBufferHeightback to summary
public int getBackBufferHeight()

Implements com.badlogic.gdx.Graphics.getBackBufferHeight.

Annotations
@Override
getBackBufferWidthback to summary
public int getBackBufferWidth()

Implements com.badlogic.gdx.Graphics.getBackBufferWidth.

Annotations
@Override
getBufferFormatback to summary
public Graphics.BufferFormat getBufferFormat()

Implements com.badlogic.gdx.Graphics.getBufferFormat.

Annotations
@Override
getDeltaTimeback to summary
public float getDeltaTime()

Implements com.badlogic.gdx.Graphics.getDeltaTime.

Annotations
@Override
getDisplayModeback to summary
public Graphics.DisplayMode getDisplayMode()

Implements com.badlogic.gdx.Graphics.getDisplayMode.

Annotations
@Override
getDisplayModeback to summary
public Graphics.DisplayMode getDisplayMode(Graphics.Monitor monitor)

Implements com.badlogic.gdx.Graphics.getDisplayMode.

Annotations
@Override
getDisplayModesback to summary
public Graphics.DisplayMode[] getDisplayModes()

Implements com.badlogic.gdx.Graphics.getDisplayModes.

Annotations
@Override
getDisplayModesback to summary
public Graphics.DisplayMode[] getDisplayModes(Graphics.Monitor monitor)

Implements com.badlogic.gdx.Graphics.getDisplayModes.

Annotations
@Override
getFrameIdback to summary
public long getFrameId()

Implements com.badlogic.gdx.Graphics.getFrameId.

Doc from com.badlogic.gdx.Graphics.getFrameId.

Returns the id of the current frame. The general contract of this method is that the id is incremented only when the application is in the running state right before calling the ApplicationListener#render() method. Also, the id of the first frame is 0; the id of subsequent frames is guaranteed to take increasing values for 263-1 rendering cycles.

Annotations
@Override
getFramesPerSecondback to summary
public int getFramesPerSecond()

Implements com.badlogic.gdx.Graphics.getFramesPerSecond.

Annotations
@Override
getGL20back to summary
public GL20 getGL20()

Implements com.badlogic.gdx.Graphics.getGL20.

Annotations
@Override
getGL30back to summary
public GL30 getGL30()

Implements com.badlogic.gdx.Graphics.getGL30.

Annotations
@Override
getGL31back to summary
public GL31 getGL31()

Implements com.badlogic.gdx.Graphics.getGL31.

Annotations
@Override
getGL32back to summary
public GL32 getGL32()

Implements com.badlogic.gdx.Graphics.getGL32.

Annotations
@Override
getGLVersionback to summary
public GLVersion getGLVersion()

Implements com.badlogic.gdx.Graphics.getGLVersion.

Annotations
@Override
getHeightback to summary
public int getHeight()

Implements com.badlogic.gdx.Graphics.getHeight.

Annotations
@Override
getMonitorback to summary
public Graphics.Monitor getMonitor()

Implements com.badlogic.gdx.Graphics.getMonitor.

Annotations
@Override
getMonitorsback to summary
public Graphics.Monitor[] getMonitors()

Implements com.badlogic.gdx.Graphics.getMonitors.

Annotations
@Override
getPpcXback to summary
public float getPpcX()

Implements com.badlogic.gdx.Graphics.getPpcX.

Annotations
@Override
getPpcYback to summary
public float getPpcY()

Implements com.badlogic.gdx.Graphics.getPpcY.

Annotations
@Override
getPpiXback to summary
public float getPpiX()

Implements com.badlogic.gdx.Graphics.getPpiX.

Annotations
@Override
getPpiYback to summary
public float getPpiY()

Implements com.badlogic.gdx.Graphics.getPpiY.

Annotations
@Override
getPrimaryMonitorback to summary
public Graphics.Monitor getPrimaryMonitor()

Implements com.badlogic.gdx.Graphics.getPrimaryMonitor.

Annotations
@Override
getSafeInsetBottomback to summary
public int getSafeInsetBottom()

Implements com.badlogic.gdx.Graphics.getSafeInsetBottom.

Annotations
@Override
getSafeInsetLeftback to summary
public int getSafeInsetLeft()

Implements com.badlogic.gdx.Graphics.getSafeInsetLeft.

Annotations
@Override
getSafeInsetRightback to summary
public int getSafeInsetRight()

Implements com.badlogic.gdx.Graphics.getSafeInsetRight.

Annotations
@Override
getSafeInsetTopback to summary
public int getSafeInsetTop()

Implements com.badlogic.gdx.Graphics.getSafeInsetTop.

Annotations
@Override
getTargetRenderIntervalback to summary
public long getTargetRenderInterval()
getTypeback to summary
public Graphics.GraphicsType getType()

Implements com.badlogic.gdx.Graphics.getType.

Annotations
@Override
getWidthback to summary
public int getWidth()

Implements com.badlogic.gdx.Graphics.getWidth.

Annotations
@Override
incrementFrameIdback to summary
public void incrementFrameId()
isContinuousRenderingback to summary
public boolean isContinuousRendering()

Implements com.badlogic.gdx.Graphics.isContinuousRendering.

Annotations
@Override
isFullscreenback to summary
public boolean isFullscreen()

Implements com.badlogic.gdx.Graphics.isFullscreen.

Doc from com.badlogic.gdx.Graphics.isFullscreen.

Whether the app is fullscreen or not

Annotations
@Override
isGL30Availableback to summary
public boolean isGL30Available()

Implements com.badlogic.gdx.Graphics.isGL30Available.

Doc from com.badlogic.gdx.Graphics.isGL30Available.

Returns whether OpenGL ES 3.0 is available. If it is you can get an instance of GL30 via getGL30() to access OpenGL ES 3.0 functionality. Note that this functionality will only be available if you instructed the Application instance to use OpenGL ES 3.0!

Annotations
@Override
isGL31Availableback to summary
public boolean isGL31Available()

Implements com.badlogic.gdx.Graphics.isGL31Available.

Doc from com.badlogic.gdx.Graphics.isGL31Available.

Returns whether OpenGL ES 3.1 is available. If it is you can get an instance of GL31 via getGL31() to access OpenGL ES 3.1 functionality. Note that this functionality will only be available if you instructed the Application instance to use OpenGL ES 3.1!

Annotations
@Override
isGL32Availableback to summary
public boolean isGL32Available()

Implements com.badlogic.gdx.Graphics.isGL32Available.

Doc from com.badlogic.gdx.Graphics.isGL32Available.

Returns whether OpenGL ES 3.2 is available. If it is you can get an instance of GL32 via getGL32() to access OpenGL ES 3.2 functionality. Note that this functionality will only be available if you instructed the Application instance to use OpenGL ES 3.2!

Annotations
@Override
newCursorback to summary
public Cursor newCursor(Pixmap pixmap, int xHotspot, int yHotspot)

Implements com.badlogic.gdx.Graphics.newCursor.

Doc from com.badlogic.gdx.Graphics.newCursor.

Create a new cursor represented by the com.badlogic.gdx.graphics.Pixmap. The Pixmap must be in RGBA8888 format, width & height must be powers-of-two greater than zero (not necessarily equal) and of a certain minimum size (32x32 is a safe bet), and alpha transparency must be single-bit (i.e., 0x00 or 0xFF only). This function returns a Cursor object that can be set as the system cursor by calling setCursor(Cursor) .

Annotations
@Override
requestRenderingback to summary
public void requestRendering()

Implements com.badlogic.gdx.Graphics.requestRendering.

Doc from com.badlogic.gdx.Graphics.requestRendering.

Requests a new frame to be rendered if the rendering mode is non-continuous. This method can be called from any thread.

Annotations
@Override
setContinuousRenderingback to summary
public void setContinuousRendering(boolean isContinuous)

Implements com.badlogic.gdx.Graphics.setContinuousRendering.

Doc from com.badlogic.gdx.Graphics.setContinuousRendering.

Sets whether to render continuously. In case rendering is performed non-continuously, the following events will trigger a redraw:

  • A call to requestRendering()
  • Input events from the touch screen/mouse or keyboard
  • A Runnable is posted to the rendering thread via Application#postRunnable(Runnable). In the case of a multi-window app, all windows will request rendering if a runnable is posted to the application. To avoid this, post a runnable to the window instead.
Life-cycle events will also be reported as usual, see ApplicationListener. This method can be called from any thread.
Annotations
@Override
setCursorback to summary
public void setCursor(Cursor cursor)

Implements com.badlogic.gdx.Graphics.setCursor.

Doc from com.badlogic.gdx.Graphics.setCursor.

Only viable on the lwjgl-backend and on the gwt-backend. Browsers that support cursor:url() and support the png format (the pixmap is converted to a data-url of type image/png) should also support custom cursors. Will set the mouse cursor image to the image represented by the com.badlogic.gdx.graphics.Cursor. It is recommended to call this function in the main render thread, and maximum one time per frame.

Annotations
@Override
setForegroundFPSback to summary
public void setForegroundFPS(int fps)

Implements com.badlogic.gdx.Graphics.setForegroundFPS.

Sets the target framerate for the application. Use 0 to never sleep; negative to not call the render method at all. Default is 60.

Parameters
fps:int

fps

Annotations
@Override
setFullscreenModeback to summary
public boolean setFullscreenMode(Graphics.DisplayMode displayMode)

Implements com.badlogic.gdx.Graphics.setFullscreenMode.

Doc from com.badlogic.gdx.Graphics.setFullscreenMode.

Sets the window to full-screen mode.

Annotations
@Override
setGL20back to summary
public void setGL20(GL20 gl20)

Implements com.badlogic.gdx.Graphics.setGL20.

Doc from com.badlogic.gdx.Graphics.setGL20.

Set the GL20 instance

Annotations
@Override
setGL30back to summary
public void setGL30(GL30 gl30)

Implements com.badlogic.gdx.Graphics.setGL30.

Doc from com.badlogic.gdx.Graphics.setGL30.

Set the GL30 instance

Annotations
@Override
setGL31back to summary
public void setGL31(GL31 gl31)

Implements com.badlogic.gdx.Graphics.setGL31.

Doc from com.badlogic.gdx.Graphics.setGL31.

Set the GL31 instance

Annotations
@Override
setGL32back to summary
public void setGL32(GL32 gl32)

Implements com.badlogic.gdx.Graphics.setGL32.

Doc from com.badlogic.gdx.Graphics.setGL32.

Set the GL32 instance

Annotations
@Override
setResizableback to summary
public void setResizable(boolean resizable)

Implements com.badlogic.gdx.Graphics.setResizable.

Doc from com.badlogic.gdx.Graphics.setResizable.

Sets whether or not the window should be resizable. Ignored on Android. Note that immediate behavior of this method may vary depending on the implementation. It may be necessary for the window to be recreated in order for the changes to take effect. Consult the documentation for the backend in use for more information. Supported on all GDX desktop backends.

Annotations
@Override
setSystemCursorback to summary
public void setSystemCursor(Cursor.SystemCursor systemCursor)

Implements com.badlogic.gdx.Graphics.setSystemCursor.

Doc from com.badlogic.gdx.Graphics.setSystemCursor.

Sets one of the predefined SystemCursors

Annotations
@Override
setTitleback to summary
public void setTitle(String title)

Implements com.badlogic.gdx.Graphics.setTitle.

Doc from com.badlogic.gdx.Graphics.setTitle.

Sets the title of the window. Ignored on Android.

Annotations
@Override
setUndecoratedback to summary
public void setUndecorated(boolean undecorated)

Implements com.badlogic.gdx.Graphics.setUndecorated.

Doc from com.badlogic.gdx.Graphics.setUndecorated.

Sets the window decoration as enabled or disabled. On Android, this will enable/disable the menu bar. Note that immediate behavior of this method may vary depending on the implementation. It may be necessary for the window to be recreated in order for the changes to take effect. Consult the documentation for the backend in use for more information. Supported on all GDX desktop backends and on Android (to disable the menu bar).

Annotations
@Override
setVSyncback to summary
public void setVSync(boolean vsync)

Implements com.badlogic.gdx.Graphics.setVSync.

Doc from com.badlogic.gdx.Graphics.setVSync.

Enable/Disable vsynching. This is a best-effort attempt which might not work on all platforms.

Annotations
@Override
setWindowedModeback to summary
public boolean setWindowedMode(int width, int height)

Implements com.badlogic.gdx.Graphics.setWindowedMode.

Doc from com.badlogic.gdx.Graphics.setWindowedMode.

Sets the window to windowed mode.

Annotations
@Override
supportsDisplayModeChangeback to summary
public boolean supportsDisplayModeChange()

Implements com.badlogic.gdx.Graphics.supportsDisplayModeChange.

Doc from com.badlogic.gdx.Graphics.supportsDisplayModeChange.

Whether the given backend supports a display mode change via calling Graphics#setFullscreenMode(DisplayMode)

Annotations
@Override
supportsExtensionback to summary
public boolean supportsExtension(String extension)

Implements com.badlogic.gdx.Graphics.supportsExtension.

Annotations
@Override
updateTimeback to summary
public void updateTime()