Reputation: 323
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 =/
Upvotes: 1
Views: 2555
Reputation: 25177
Libgdx does not wrap the platform Camera APIs. You will need to use platform-dependent code (on both Android and iOS and GWT) to access the camera.
As Metaphore notes in the comments, the Libgdx Wiki has an entry with lots of details for the Android case: https://github.com/libgdx/libgdx/wiki/Integrating-libgdx-and-the-device-camera
Upvotes: 3