libgdx problems with enum using jython 2.7.2

Viewed 87

I am trying to use Input.Keys.A for example but I can't import that enum. Have the sam problem with ShapeRenderer and ShapeType.

using this

from com.badlogic.gdx import InputProcessor, Input, Input$Keys

doesn't work

trying this:

from com.badlogic.gdx import InputProcessor, Input, Keys

I get unresolved import. Why is there this strange $ sign. Input.Keys and ShapeRenderer.ShapeType doesn't work. can't even render a simple rectangle because of this.

1 Answers

I found a workaround.

to get enums from libgdx use Class.forName() insert the whole path to the enum. here is an example for the ShapeRenderer$ShapeType

p = Class.forName("com.badlogic.gdx.graphics.glutils.ShapeRenderer$ShapeType").getEnumConstants()

if you do

print(p)

you get an array with the enums

use it like this

sr = ShapeRenderer()
sr.begin(p[2])

to use ShapeType.Filled for example

this approach should work with every enum used it with com.badlogic.gdx.Net$Protocol to and it worked.

Related