Game Development Community

Camera add-on test v0.1

by Alistair Lowe3 · in iTorque 2D · 04/19/2011 (8:31 pm) · 7 replies

OK Guys,

This time it's iPhone camera functionality test number 1!

EDIT updated: Link Here: Camera add-on v0.2.rar

You have the following commands in Torque Script:
  • storeImageFromLibrary( %fileName ); // Stores in the app's local storage an image from the user's library
  • storeImageFromCamera( %fileName ); // Stores an image taken on the camera (which it loads up) into the app's local storage
  • onImageSelected( %fileName ); // Callback for when the user has completed an operation (not ideal but bare with me) fileName is empty string on failure.
  • createImageMapFromFile( %fileName, %imageMapName ); // Creates an image map from the locally stored file ready to use, deletable with .delete() as usual.

Have fun with this guys a few small issues to be aware of:

A bit laggy after selecting an image, either Torque is eating up a lot of CPU or it's me converting the images to .PNGs, I'll have a look tomorrow, maybe find quicker ways of saving or options to lower the resolution (you don't exactly need 3mp for a screen of 0.15mp! Sorry about the callback, the way the camera is handled is mighty annoying!

#1
04/20/2011 (8:27 am)
Wow,
good stuff Alistair. I was not aware of these commands. SWEET.
#2
04/25/2011 (8:23 pm)
Minor update, removed camera transition animations. Helps boost performance in low-memory situations and resolves the issue of lost torque input after use.
#3
03/22/2012 (4:58 am)
The camera function works fine but I have issues after dismissing the camera. I loose torque input after using the camera.
#4
03/22/2012 (5:16 am)
Wow, haven't been on here for a while, erm, this as a bug in 0.1 but should have been fixed in 0.2, the issue is to do with dismissal of the camera and a shortcoming in iOS which was fixed by not animating the dismissal.

Something may have changed in iTorque 1.5 or newer releases of iOS though, however I'm no long maintaining the add-on.

See if you can't get it placed into mainstream iTorque!
#5
03/22/2012 (5:57 am)
Thanks, I will see what I can find
#6
04/21/2012 (8:26 am)
Great add-on!!!

But it doesn't quite work for me..

@Hitesh: What was the problem you had? And did you solve it? The problem i'm having is that when i take a picture and press on "use" the application hangs.. I have no idea how to solve this, maybe it's a compatibility issue with ios 5.0. I just wanted to ask to see if you had the same problem so maybe you solved it:-)
#7
04/23/2012 (11:11 am)
I got it working now, at least i got it to hide now using:

[iPhoneCameraController dismissViewControllerAnimated: NO completion: NO];
[self dismissViewControllerAnimated: NO completion: NO];

[self.view removeFromSuperView];

Then i get back to my game and i've put the photo on the background as a test, this works, but now when i try to take another picture it doesn't work anymore and i do get touch callbacks in the game so i know that it's got the focus. Anyone had this problem and knows how to fix it?