libgdx API

com.badlogic.gdx.backends.jogl
Class JoglApplication

java.lang.Object
  extended by com.badlogic.gdx.backends.jogl.JoglApplication
All Implemented Interfaces:
Application

public final class JoglApplication
extends java.lang.Object
implements Application

An implemenation of the Application interface based on Jogl for Windows, Linux and Mac. Instantiate this class with apropriate parameters and then register ApplicationListener or InputProcessor instances.

Author:
mzechner

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.badlogic.gdx.Application
Application.ApplicationType
 
Field Summary
 
Fields inherited from interface com.badlogic.gdx.Application
LOG_ERROR, LOG_INFO, LOG_NONE
 
Constructor Summary
JoglApplication(ApplicationListener listener, JoglApplicationConfiguration config)
           
JoglApplication(ApplicationListener listener, java.lang.String title, int width, int height, boolean useGL20IfAvailable)
          Creates a new JoglApplication with the given title and dimensions.
 
Method Summary
 void error(java.lang.String tag, java.lang.String message)
          Logs an error message to the console or logcat
 void error(java.lang.String tag, java.lang.String message, java.lang.Exception exception)
          Logs an error message to the console or logcat
 void exit()
          Exits the application.
 Audio getAudio()
          
 Files getFiles()
          
 GLCanvas getGLCanvas()
           
 Graphics getGraphics()
          
 Input getInput()
          
 long getJavaHeap()
           
 javax.swing.JFrame getJFrame()
           
 long getNativeHeap()
           
 Preferences getPreferences(java.lang.String name)
          Returns the Preferences instance of this Application.
 Application.ApplicationType getType()
          
 int getVersion()
           
 void log(java.lang.String tag, java.lang.String message)
          Logs a message to the console or logcat
 void log(java.lang.String tag, java.lang.String message, java.lang.Exception exception)
          Logs a message to the console or logcat
 void postRunnable(java.lang.Runnable runnable)
          Posts a Runnable on the main loop thread.
 void setLogLevel(int logLevel)
          Sets the log level.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JoglApplication

public JoglApplication(ApplicationListener listener,
                       java.lang.String title,
                       int width,
                       int height,
                       boolean useGL20IfAvailable)
Creates a new JoglApplication with the given title and dimensions. If useGL20IfAvailable is set the JoglApplication will try to create an OpenGL 2.0 context which can then be used via JoglApplication.getGraphics().getGL20(). To query whether enabling OpenGL 2.0 was successful use the JoglApplication.getGraphics().isGL20Available() method.

Parameters:
listener - the ApplicationListener implementing the program logic
title - the title of the application
width - the width of the surface in pixels
height - the height of the surface in pixels
useGL20IfAvailable - wheter to use OpenGL 2.0 if it is available or not

JoglApplication

public JoglApplication(ApplicationListener listener,
                       JoglApplicationConfiguration config)
Method Detail

getAudio

public Audio getAudio()

Specified by:
getAudio in interface Application
Returns:
the Audio instance

getFiles

public Files getFiles()

Specified by:
getFiles in interface Application
Returns:
the Files instance

getGraphics

public Graphics getGraphics()

Specified by:
getGraphics in interface Application
Returns:
the Graphics instance

getInput

public Input getInput()

Specified by:
getInput in interface Application
Returns:
the Input instance

getType

public Application.ApplicationType getType()

Specified by:
getType in interface Application
Returns:
what Application.ApplicationType this application has, e.g. Android or Desktop

getVersion

public int getVersion()
Specified by:
getVersion in interface Application
Returns:
the Android API level on Android or 0 on the desktop.

getJavaHeap

public long getJavaHeap()
Specified by:
getJavaHeap in interface Application
Returns:
the Java heap memory use in bytes

getNativeHeap

public long getNativeHeap()
Specified by:
getNativeHeap in interface Application
Returns:
the Native heap memory use in bytes

getJFrame

public javax.swing.JFrame getJFrame()
Returns:
the JFrame of the application.

getGLCanvas

public GLCanvas getGLCanvas()
Returns:
the GLCanvas of the application.

getPreferences

public Preferences getPreferences(java.lang.String name)
Description copied from interface: Application
Returns the Preferences instance of this Application. It can be used to store application settings across runs.

Specified by:
getPreferences in interface Application
Parameters:
name - the name of the preferences, must be useable as a file name.
Returns:
the preferences.

postRunnable

public void postRunnable(java.lang.Runnable runnable)
Description copied from interface: Application
Posts a Runnable on the main loop thread.

Specified by:
postRunnable in interface Application
Parameters:
runnable - the runnable.

log

public void log(java.lang.String tag,
                java.lang.String message)
Description copied from interface: Application
Logs a message to the console or logcat

Specified by:
log in interface Application

log

public void log(java.lang.String tag,
                java.lang.String message,
                java.lang.Exception exception)
Description copied from interface: Application
Logs a message to the console or logcat

Specified by:
log in interface Application

error

public void error(java.lang.String tag,
                  java.lang.String message)
Description copied from interface: Application
Logs an error message to the console or logcat

Specified by:
error in interface Application

error

public void error(java.lang.String tag,
                  java.lang.String message,
                  java.lang.Exception exception)
Description copied from interface: Application
Logs an error message to the console or logcat

Specified by:
error in interface Application

setLogLevel

public void setLogLevel(int logLevel)
Description copied from interface: Application
Sets the log level. Application.LOG_NONE will mute all log output. Application.LOG_ERROR will only let messages issued with Application.error(String, String) through. Application.LOG_INFO will let all messages though, either logged via Application.error(String, String) or Application.log(String, String).

Specified by:
setLogLevel in interface Application
Parameters:
logLevel - Application.LOG_NONE, Application.LOG_ERROR, Application.LOG_INFO.

exit

public void exit()
Description copied from interface: Application
Exits the application. This will cause a call to pause() and dispose() some time in the loadFuture, it will not immediately finish your application!

Specified by:
exit in interface Application

libgdx API

Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)