Example usage for com.badlogic.gdx.backends.jogl JoglApplication JoglApplication

List of usage examples for com.badlogic.gdx.backends.jogl JoglApplication JoglApplication

Introduction

In this page you can find the example usage for com.badlogic.gdx.backends.jogl JoglApplication JoglApplication.

Prototype

public JoglApplication(final ApplicationListener listener, final JoglApplicationConfiguration config) 

Source Link

Usage

From source file:com.badlogic.gdx.tests.jogl.JoglDebugStarter.java

License:Apache License

public static void main(String[] argv) {
    // this is only here for me to debug native code faster
    new SharedLibraryLoader("../../extensions/gdx-audio/libs/gdx-audio-natives.jar").load("gdx-audio");
    new SharedLibraryLoader("../../extensions/gdx-image/libs/gdx-image-natives.jar").load("gdx-image");
    new SharedLibraryLoader("../../extensions/gdx-freetype/libs/gdx-freetype-natives.jar").load("gdx-freetype");
    new SharedLibraryLoader("../../gdx/libs/gdx-natives.jar").load("gdx");

    GdxTest test = new Mpg123Test();
    JoglApplicationConfiguration config = new JoglApplicationConfiguration();
    config.useGL20 = test.needsGL20();/*from w w  w. j av  a  2 s .c  om*/
    new JoglApplication(test, config);
}

From source file:com.badlogic.gdx.tests.jogl.JoglTestStarter.java

License:Apache License

/**
 * Runs the {@link GdxTest} with the given name.
 * /*from   w ww .  j a  va 2 s. c o m*/
 * @param testName the name of a test class
 * @return {@code true} if the test was found and run, {@code false} otherwise
 */
public static boolean runTest(String testName) {
    GdxTest test = GdxTests.newTest(testName);
    if (test == null) {
        return false;
    }
    JoglApplicationConfiguration config = new JoglApplicationConfiguration();
    config.width = 640;
    config.height = 480;
    config.title = testName;
    config.useGL20 = test.needsGL20();
    new JoglApplication(test, config);
    return true;
}

From source file:com.ridiculousRPG.GameLauncher.java

License:Apache License

/**
 * Equivalent to {@link #onCreate(Bundle)} for the desktop.
 *///w ww. j  a va  2s.  c o m
public static void onCreateDesktop() {
    GameOptions options = new GameOptionsDefaultConfigReader(new File(OPTIONS_FILE)).options;
    switch (options.backend) {
    case LWJGL: {
        LwjglApplicationConfiguration conf = new LwjglApplicationConfiguration();
        conf.title = buildTitle(options.title, options.debug);
        conf.width = options.width;
        conf.height = options.height;
        conf.useGL20 = options.useGL20;
        conf.fullscreen = options.fullscreen;
        conf.vSyncEnabled = options.vSyncEnabled;
        new LwjglApplication(new GameBase(options) {
            @Override
            public void create() {
                Keyboard.enableRepeatEvents(true);
                super.create();
            }

            @Override
            public boolean shareGLContext() {
                try {
                    new SharedDrawable(Display.getDrawable()).makeCurrent();
                    return true;
                } catch (Exception e) {
                    System.out.println("Couldn't share context.");
                    return false;
                }
            }
        }, conf);
    }
        break;
    case JOGL: {
        JoglApplicationConfiguration conf = new JoglApplicationConfiguration();
        conf.title = buildTitle(options.title, options.debug);
        conf.width = options.width;
        conf.height = options.height;
        conf.useGL20 = options.useGL20;
        conf.fullscreen = options.fullscreen;
        conf.vSyncEnabled = options.vSyncEnabled;
        new JoglApplication(new GameBase(options) {
            @Override
            public boolean shareGLContext() {
                return false;
            }
        }, conf);
    }
        break;
    }
}