Grab a screenshot from the actual frame

Discussion about using Moai SDK - post questions, issues, and ideas here.

Moderators: naturally, seebs, ezraanderson

Grab a screenshot from the actual frame

Postby festival » Mon Jun 11, 2012 2:30 pm

Did anyone already made a screenshot from the actual frame with Moai and saved it on i.e. a iOS device ?
festival
 
Posts: 30
Joined: Mon Jun 11, 2012 11:16 am
Location: Germany

Re: Grab a screenshot from the actual frame

Postby dana » Mon Jun 11, 2012 4:03 pm

This is a feature that we'll probably be working on soon, I can't give any accurate ETA on it at this time though. Probably will be a new feature of 1.2, but don't hold me to that.
User avatar
dana
Site Admin
 
Posts: 200
Joined: Fri Mar 02, 2012 6:10 pm
Location: Zipline Games

Re: Grab a screenshot from the actual frame

Postby festival » Tue Jun 12, 2012 2:14 am

dana wrote:This is a feature that we'll probably be working on soon, I can't give any accurate ETA on it at this time though. Probably will be a new feature of 1.2, but don't hold me to that.


Ok, then it's time that I write a plugin. Does I have access of the iOS "rootViewController" without to modify MOAI or the iOS host?
festival
 
Posts: 30
Joined: Mon Jun 11, 2012 11:16 am
Location: Germany

Re: Grab a screenshot from the actual frame

Postby ibisum » Tue Jun 12, 2012 2:20 am

You sure do .. check MoiaAppDelegate.mm .. it should be easy enough to add a "captureFrame" method to MoaiView.mm without much fuss ..
;
--
Email: ibisum@gmail.com
IRC: torpor on FreeNode, see you in the #moai channel
Got a MOAI snippet? Please consider adding it to http://moaisnippets.info/
User avatar
ibisum
 
Posts: 1503
Joined: Mon Oct 17, 2011 1:11 am
Location: Vienna, Austria

Re: Grab a screenshot from the actual frame

Postby festival » Tue Jun 12, 2012 2:39 am

Yes. I can go thru MoaiAppDelegate.mm. Thanks
festival
 
Posts: 30
Joined: Mon Jun 11, 2012 11:16 am
Location: Germany

Re: Grab a screenshot from the actual frame

Postby ibisum » Tue Jun 12, 2012 3:01 am

Please let us know how it goes - it would be useful for us as well!
;
--
Email: ibisum@gmail.com
IRC: torpor on FreeNode, see you in the #moai channel
Got a MOAI snippet? Please consider adding it to http://moaisnippets.info/
User avatar
ibisum
 
Posts: 1503
Joined: Mon Oct 17, 2011 1:11 am
Location: Vienna, Austria

Re: Grab a screenshot from the actual frame

Postby festival » Tue Jun 12, 2012 3:18 am

ibisum wrote:Please let us know how it goes - it would be useful for us as well!

Sure.
festival
 
Posts: 30
Joined: Mon Jun 11, 2012 11:16 am
Location: Germany

Re: Grab a screenshot from the actual frame

Postby festival » Wed Jun 13, 2012 6:44 am

Ok. I have done a regular MOAI plugin for the iOS host.

After wrestling with the MOAI source code & Xcode I made a quick port of a LUA screenshot plugin from another iOS LUA framework.

https://dl.dropbox.com/u/84140599/MOAIScreenShotIOS.zip

Lua code example:

Code: Select all
  1. local frameBounds={

  2.                 left=0,

  3.                 top=0,

  4.                 width=320,

  5.                 height=480

  6.         }

  7. local tmpFilename=MOAIScreenShotIOS.snapshotToFile(MOAIScreenShotIOS.PORTRAIT, frameBounds)

  8.    

  9. print("Saved at location: ",tmpFilename);

  10. ---now load it again or  delete the file later

  11.  



I tested in on the iOS simulator and it worked fine. Enjoy.

If someone likes to improve it. Move on. Please post back if you do so. Thanks.
festival
 
Posts: 30
Joined: Mon Jun 11, 2012 11:16 am
Location: Germany

Re: Grab a screenshot from the actual frame

Postby ibisum » Wed Jun 13, 2012 10:50 am

Cool! I will check it out and get back to you .. would be nice to have for Android too, I guess.
;
--
Email: ibisum@gmail.com
IRC: torpor on FreeNode, see you in the #moai channel
Got a MOAI snippet? Please consider adding it to http://moaisnippets.info/
User avatar
ibisum
 
Posts: 1503
Joined: Mon Oct 17, 2011 1:11 am
Location: Vienna, Austria


Return to Moai SDK

Who is online

Users browsing this forum: No registered users and 2 guests

x