Search in sources :

Example 1 with PlatformDependent

use of net.catacombsnatch.game.PlatformDependent in project Catacomb-Snatch by Catacomb-Snatch.

the class DesktopLauncher method main.

public static void main(String[] arg) {
    System.out.println("Starting game in DESKTOP mode!");
    LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
    // TODO Re-enable if it got fixed on all systems (currently throws a shader error)
    // config.useGL30 = true;
    config.title = "Catacomb Snatch";
    config.width = GAME_WIDTH;
    config.height = GAME_HEIGHT;
    new LwjglApplication(new CatacombSnatch(new PlatformDependent() {

        @Override
        public void create() {
            // Set game cursor
            try {
                int size = 16, center = (size / 2);
                IntBuffer buffer = BufferUtils.newIntBuffer(size * size);
                int x = 0, y = 0;
                for (int n = 0; n < buffer.limit(); n++) {
                    if ((x == center || y == center) && (x < center - 1 || y < center - 1 || x > center + 1 || y > center + 1)) {
                        buffer = buffer.put(n, 0xFFFFFFFF);
                    }
                    x++;
                    if (x == size) {
                        x = 0;
                        y++;
                    }
                }
                Mouse.setNativeCursor(new Cursor(size, size, center, center, 1, buffer, null));
            } catch (LWJGLException e) {
                System.err.print("Error setting native cursor!\n" + e);
            }
        }

        @Override
        public Object[] createPlatformObjects() {
            throw new UnsupportedOperationException("Unimplemented");
        }

        @Override
        public void dispose() {
        }
    }), config);
}
Also used : PlatformDependent(net.catacombsnatch.game.PlatformDependent) LwjglApplication(com.badlogic.gdx.backends.lwjgl.LwjglApplication) CatacombSnatch(net.catacombsnatch.game.CatacombSnatch) IntBuffer(java.nio.IntBuffer) LwjglApplicationConfiguration(com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration) Cursor(org.lwjgl.input.Cursor) LWJGLException(org.lwjgl.LWJGLException)

Aggregations

LwjglApplication (com.badlogic.gdx.backends.lwjgl.LwjglApplication)1 LwjglApplicationConfiguration (com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration)1 IntBuffer (java.nio.IntBuffer)1 CatacombSnatch (net.catacombsnatch.game.CatacombSnatch)1 PlatformDependent (net.catacombsnatch.game.PlatformDependent)1 LWJGLException (org.lwjgl.LWJGLException)1 Cursor (org.lwjgl.input.Cursor)1