How do I use warble to package libgdx and ruby?

0
votes

Posted by: thecodethinker on 08/21/2015 | Add Revision

My ruby code is as follows

include Java


Dir[File.expand_path "#{File.dirname(__FILE__)}/../libs/\*.jar"].each { |x| require x; puts "go"}

module LibGDX
        include_package "com.badlogic.gdx"
        include_package "com.badlogic.gdx.backends.lwjgl"
        include_package "com.badlogic.gdx.graphics"
end

class Game
        include LibGDX::ApplicationListener

        @LOG = Game.java.simple_name

        def create
                LibGDX::Gdx.app.log(@LOG, "Is a thing")
        end

        def resize width, height
                LibGDX::Gdx.app.log(@LOG, "Resizing game to #{width} by #{height}")
        end

        def render
                LibGDX::Gdx.gl.glClearColor(0, 0, 0, 0)
                LibGDX::Gdx.gl.glClear(LibGDX::GL20.GL_COLOR_BUFFER_BIT)
        end

        def pause
                LibGDX::Gdx.app.log(@LOG, "Pausing")
        end

        def resume
                LibGDX::Gdx.app.log(@LOG, "resuming")
        end

    def dispose
            LibGDX::Gdx.app.log(@LOG, "disposing")
    end
end

listener = Game.new

width = 800
height = 600

useOpenglES2 = false;

game = LibGDX::LwjglApplication.new(listener, "Game", width, height, useOpenglES2)

If I run this through jruby it works just fine but if I package it up with warble it skips all of the Game class's initialization and tells "AL lib: alc_cleanup: 1 device not closed" and stops.

Does anyone know the proper way to build a libGDX project with jruby and warble?

P.S. I know this seems like a very localized problem but I'm asking how to use jruby and libgdx with warble using my program as an example so... I think it's more broad then it seems... still getting used to stackexchange.

Visit Website