libGDX Overview (1:46:20) |
Mario Zechner created a detailed post about running libGDX
on Cortex
- http://www.badlogicgames.com/wordpress/?p=2733
libGDX - http://libgdx.badlogicgames.com/
libGDX
uses Java
and shares most of the java documentation for accessing the Cortex
SDK.
The Button controller text and images vary on each console. The ButtonData
object gives access to the String
and Drawable
controller data.
The ButtonData
image can also be converted to a Texture
which can be used by libGDX
.
public static Texture getButtonDataTexture(int button) {
OuyaController.ButtonData buttonData = OuyaController.getButtonData(button);
if (null == buttonData)
{
return null;
}
BitmapDrawable drawable = (BitmapDrawable)buttonData.buttonDrawable;
if (null == drawable)
{
return null;
}
Bitmap bitmap = drawable.getBitmap();
Texture tex = new Texture(bitmap.getWidth(), bitmap.getHeight(), Format.RGBA8888);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, tex.getTextureObjectHandle());
GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bitmap, 0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
bitmap.recycle();
return tex;
}