Access the camera of a Smartphone using libGDX
- by PH-zero
I searched the web, browsed through the libGDX wiki, but without success.
My Question:
Is there a way, to access the camera of smartphones, let the user
take a photo, and then store the image in a Texture-instance?
I could imagin something like this:
@Override
public void onCamTrigger(){
ApplicationType appType = Gdx.app.getType();
switch (appType) {
case Android: case iOS:
Texture someTexture = new Texture(Gdx.input.getCamera().getImage());
//do something with the Texture instance...
someTexture.dispose();
break;
default:
break;
}
}
Of course this is pure fiction! I know that there's a lot more to this like opening the camera, displaying it, then take a photo etc. . But is there a convenience method like this? If so, how does it work? On Android, i think i could implement it without using any convenience methods offered by libGDX, but i have no idea on how this works on iOS =/