Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Storyboard API Questions
Started by jonathanbeebe Nov 16 2011 06:37 AM

- - - - -
207 replies to this topic
[TOPIC CONTROLS]
Page 2 of 9 1 2 3 4 »
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#26

@RSCdev

[GLOBAL: userInfoPane.html]
@RSCdev
  • Corona Geek

  • 1,489 posts
  • Corona SDK

Jon,

Many thanks for that such a nice explanation.

I think you understood well what I`ve said above. I think I got it too but will see the next daily build so to confirm. :)

Cheers,
Rodrigo.
uid: 89165 topic_id: 17828 reply_id: 68269


[TOPIC: post.html]
#27

lKinx

[GLOBAL: userInfoPane.html]
lKinx
  • Contributor

  • 193 posts
  • Corona SDK

So, I'm still not sure what method gets called after you gotoScene(). For Director, you had a new() method that returned a group. I'm assuming for this we have a method that calls other methods that returns scene at the end like in scene1.lua.

Could someone clarify this?

scene1.lua is found in the "Common Storyboard API Questions" blog.
uid: 103624 topic_id: 17828 reply_id: 68294


[TOPIC: post.html]
#28

risingfrom

[GLOBAL: userInfoPane.html]
risingfrom
  • Observer

  • 8 posts
  • Guests

@ jonathanbeebe

Thanks for the response. I understand that the scene will be completely removed and then reloaded as a fresh file. I might not have been specific enough. I'm asking how the required modules will be handled when removeScene is called. Will they be unloaded from memory? Or are the supposed to be unload from memory? In essence when a scene is removed, is that kicked down the chain of required modules loaded?

for example if you had a set up like so:

moduleA
/
scene - moduleB - moduleD
\
moduleC

would removing the scene in turn remove the modules or just the reference to them? From my testing it seems like they are not removed just the reference to them is. The reference to them is restored when you reload the scene again, but does not call it as a fresh load. This is causing me to have errors with drawing images again upon reloading the scene.

I may be setting up my modules incorrectly… this has me stumped.
Any insight would be helpful.
uid: 10192 topic_id: 17828 reply_id: 68306


[TOPIC: post.html]
#29

ncass

[GLOBAL: userInfoPane.html]
ncass
  • Observer

  • 2 posts
  • Corona SDK

Yeah I was wondering about setting up external modules too. Can I still use the blog post A Better Approach to External Modules with Storyboard ? I want level files with just level specific like enemy positions etc but calling external modules with all the functions thats for all the levels etc what's the best approach to this using storyboard? Thanks in advance
uid: 94536 topic_id: 17828 reply_id: 68312


[TOPIC: post.html]
#30

jonathanbeebe

[GLOBAL: userInfoPane.html]
jonathanbeebe
  • Contributor

  • 654 posts
  • Alumni

@risingfrom: Looks like you found a bug! When you call storyboard.removeScene() on a specific scene, it's supposed to completely unload the module — which wasn't happening. Thankfully, it was an easy fix and should be in the *next* update (not 2011.688, but the one after that).

In the meantime, to get around this issue, all you have to do is set the 'sceneName' key in package.loaded to nil after calling storyboard.removeScene(). Here's an example:


storyboard.removeScene( "myScene" )
package.loaded["myScene"] = nil
[/code]

Once the Daily build (after 2011.688) comes out, the second line above won't be needed (but it won't break anything if you leave that in there, as long as it's always after a call to storyboard.removeScene).

@ncass: For regular external modules (not scenes), the method described in 'A Better Approach to External Modules' is still valid. Also remember, with those modules, if you want to completely unload the module, you'll also set its entry in the global package.loaded table to nil as well.

@lKinx: In the same blog post you mentioned, there's a question in the FAQ list that states: "What is the Director-equivalent to the new() function?"

That should answer your question :-)
uid: 52430 topic_id: 17828 reply_id: 68340


[TOPIC: post.html]
#31

glennbjr

[GLOBAL: userInfoPane.html]
glennbjr
  • Contributor

  • 169 posts
  • Corona SDK

I thought I was going crazy for a minute. I couldn't get a scene to be removed and reloaded until I read this thread about a bug in build 688 and a quick fix for it. Got everything working now.

I'm using storyboard for scene management for my game and it's awesome. I look forward to the bug fixes in future daily builds and thank you for the quick fix ;-)

uid: 38820 topic_id: 17828 reply_id: 68354


[TOPIC: post.html]
#32

jonathanbeebe

[GLOBAL: userInfoPane.html]
jonathanbeebe
  • Contributor

  • 654 posts
  • Alumni

The bug fix will be in the next daily build, as well as another important bug fixes (regarding some scene transition effects looking distorted), so be sure to get the *next* daily build! (after 2011.688).

UPDATE: Daily build 2011.689 is now available, and includes the storyboard.removeScene() bug fix, as well as a fix for the strange zooming issue during scene change. Highly recommended download:

http://developer.anscamobile.com/release/2011/689
uid: 52430 topic_id: 17828 reply_id: 68448


[TOPIC: post.html]
#33

Yogamatta

[GLOBAL: userInfoPane.html]
Yogamatta
  • Enthusiast

  • 45 posts
  • Corona SDK

I have found that some effects doesn't have same behaviour, namely the new ones. slideLeft doesn't behave as slideRight and same with slideUp and slideDown. slideLeft and slideUp have same effect and slideRight and slideDown are the same. slideRight and slideDown are not correct. Original scene is not pushed away, it's just goes black.
uid: 40334 topic_id: 17828 reply_id: 68635


[TOPIC: post.html]
#34

jonathanbeebe

[GLOBAL: userInfoPane.html]
jonathanbeebe
  • Contributor

  • 654 posts
  • Alumni

@eugen5: As soon as the new build went live, we realized our previous changes (that fixed the scene-zooming) affected the behavior of the new slide-based effects. Thankfully, it was a very easy fix and just waiting to push the update into the daily builds.

In the meantime, just recognize that if you use the slide-based effects they will look a little strange until you get one of the upcoming daily builds (possibly not the next one, but it'll be in the release notes when it does get pushed in).

The next update also fixes an issue where the first scene cannot have an effect, so until you get the build with the next update, try not to specify an effect for your very first scene change (usually in main.lua).

Thanks!
uid: 52430 topic_id: 17828 reply_id: 68652


[TOPIC: post.html]
#35

Yogamatta

[GLOBAL: userInfoPane.html]
Yogamatta
  • Enthusiast

  • 45 posts
  • Corona SDK

@jonathanbeebe: Thanks. No worries for me thou. I am not going live just yet. A note: you wrote that "the slide-based effects will look a little strange". I must say I really like how "slideLeft" behaves right now. It might not been intentional but it's a cool effect. It is somehow in between slideLeft (how intended) and fromLeft.
uid: 40334 topic_id: 17828 reply_id: 68702


[TOPIC: post.html]
#36

NuclearResearch.net

[GLOBAL: userInfoPane.html]
NuclearResearch.net
  • Enthusiast

  • 67 posts
  • Corona SDK

Many thanks to Ansca for this advancement and to Ricardo for his director class. Great effort!
I have a game made of levels (scene 1,2,..i..,n-1,n) and when "game over" happens in scene i, I need to go back to scene 1 instead of going forward to scene i+1.

How do I clear memory in a net way from scene 1? It seems that adding storyboard.removeScene ("scenei") for all the i to scene1 makes the trick but am not sure it is going to backfire some way.

Thanks again.
--> edit: got it, it is storyboard.purgeAll() implemented in daily build 689 already
uid: 67641 topic_id: 17828 reply_id: 69167


[TOPIC: post.html]
#37

jonathanbeebe

[GLOBAL: userInfoPane.html]
jonathanbeebe
  • Contributor

  • 654 posts
  • Alumni

UPDATE: Daily Build 2011.691 is now up, and in this build, there are currently no known Storyboard API issues :-)

Thanks for all your help in tracking down and exposing the initial bugs everyone!

Quick link to the daily builds page:
http://developer.anscamobile.com/downloads/daily-builds
uid: 52430 topic_id: 17828 reply_id: 69322


[TOPIC: post.html]
#38

iciler

[GLOBAL: userInfoPane.html]
iciler
  • Observer

  • 6 posts
  • Corona SDK

Hi Jonathan,
I've found bug in storyboard when we create an object and place him outside of the "contentWith", and use "slideLeft" or "slideRight" transition effect. All scene is placed wrong, shifted left.
I've added this code to "scene1.lua" in Ansca sample app.
"scene1.lua"
----------------------------------------------------------------
image1 = display.newImage( "bell.png" )
image1.x = display.contentWidth
screenGroup:insert( image1 )
----------------------------------------------------------------
I've also changed transition effect to "slideLeft".

"bell.png" is some image. I sent bug report today with sample files (case #9848)

Maybe I'm doing some wrong, but with other effects with same code storyboard works fine
uid: 13367 topic_id: 17828 reply_id: 69348


[TOPIC: post.html]
#39

jonathanbeebe

[GLOBAL: userInfoPane.html]
jonathanbeebe
  • Contributor

  • 654 posts
  • Alumni

@iciler: Which build are you using? With Daily Build 2011.691, I'm not able to reproduce your issue (added an image outside of contentWidth and used "slideLeft" effect).

There were some bugs having to do with the slide transitions in the previous builds just before 2011.691 ... If you're not using at least 691, please try it and let me know if you're still having issues.

Thanks.
uid: 52430 topic_id: 17828 reply_id: 69380


[TOPIC: post.html]
#40

iciler

[GLOBAL: userInfoPane.html]
iciler
  • Observer

  • 6 posts
  • Corona SDK

Hi Jonathan! I've used 694, the last one. Now, I'm reinstalling Corona SDK, so we will see very soon what will happend.
uid: 13367 topic_id: 17828 reply_id: 69383


[TOPIC: post.html]
#41

iciler

[GLOBAL: userInfoPane.html]
iciler
  • Observer

  • 6 posts
  • Corona SDK

So,
I've Installed last one "CoronaSDK-2011.694.dmg" on my MAC, and when I use "slideLeft" the same problem. Where I can send the sample code and capture of my screen?

Thanks in advance, IVan
uid: 13367 topic_id: 17828 reply_id: 69385


[TOPIC: post.html]
#42

jonathanbeebe

[GLOBAL: userInfoPane.html]
jonathanbeebe
  • Contributor

  • 654 posts
  • Alumni

@iciler: That's very strange. I created an object outside of the contentBounds (in the same way you did), and the "slideLeft" function within scene1 worked fine.

Please send your samplecode to jonathan [at] anscamobile.com

Thanks!
uid: 52430 topic_id: 17828 reply_id: 69393


[TOPIC: post.html]
#43

mschmidt

[GLOBAL: userInfoPane.html]
mschmidt
  • Observer

  • 19 posts
  • Corona SDK

hi there,

thanks for the awesome storyboard api!

i encounter a problem though:

i am not able to delete a widget.tableView completely while changing scenes with object:removeSelf in the exitScene() event.

my tableView:
local listOptions = widget.newTableView	{ 
								top = 70,
			 					
height = 360,
								maskFile = ("images/mask-320x360.png"),
			 					bgColor = { 0, 0, 0, 255 },
};

videoList = widget.newTableView (listOptions)

my code:
-- Called when scene is about to move offscreen:
function scene:exitScene( event )
	local screenGroup = self.view
	
	display.remove(videoList)
	videoList = nil
end

when i am changing scenes, the background of the tableView is still visible and overlays everything else.

when i turn the background alpha of my tableview to 0, i am able to see the elements on the other page, but they dont responde to any (touch)events, because the background of the tableview is still overlaying.

i am not adding the tableView.view to the screengroup "local group = self.view", cause that seem to cause some problems.

am i missing something?!

cheers,

max

(sorry for the weird spacing in the sourcecode...)
uid: 42936 topic_id: 17828 reply_id: 69440


[TOPIC: post.html]
#44

jonathanbeebe

[GLOBAL: userInfoPane.html]
jonathanbeebe
  • Contributor

  • 654 posts
  • Alumni

@mschmidt: This is most-likely due to the fact that 'listOptions' is also a tableView you're creating. listOptions should just be a regular table.


local listOptions = {
top = 70,
height = 360,
maskFile = ("images/mask-320x360.png"),
bgColor = { 0, 0, 0, 255 },
}

videoList = widget.newTableView (listOptions)
[/code]

You were creating videoList tableView, which actually had nothing ... and the actual tableView you were seeing was listOptions.

The above code should work for you...

Also, don't forget to set a forward declaration to videoList somewhere to keep it local within your scene :-)
uid: 52430 topic_id: 17828 reply_id: 69446


[TOPIC: post.html]
#45

mschmidt

[GLOBAL: userInfoPane.html]
mschmidt
  • Observer

  • 19 posts
  • Corona SDK

ouch, so obvious when you see it. :)

thanks a lot!

hah that solved 2 other problems i had. thanks again twice!
uid: 42936 topic_id: 17828 reply_id: 69447


[TOPIC: post.html]
#46

NuclearResearch.net

[GLOBAL: userInfoPane.html]
NuclearResearch.net
  • Enthusiast

  • 67 posts
  • Corona SDK

In my game I use storyboard.testvar to update one relevant parameter, level after level.

All goes smoothly until the end of game, where I have a final scene from which you can go back to scene1 and play again. It happens that if I play again, storyboard.testvar behaves randomly level after level. It simply reports and adds the wrong number.

I suppose I need to clear that storyboard.testvar at the first end of the game, but I've not found a working manner yet... storyboard.testvar is assigned to the same global parameter at each level and I probably need to delete/clear/reset that global parameter once the game is completed.

Any suggestion from more expert users? Thanks in advance.

uid: 67641 topic_id: 17828 reply_id: 69449


[TOPIC: post.html]
#47

jonathanbeebe

[GLOBAL: userInfoPane.html]
jonathanbeebe
  • Contributor

  • 654 posts
  • Alumni

@RAoM_games: Ensure that one of your events aren't changing the value of testvar ... Perhaps do a print statement that shows you the value of testvar after each event (in the problematic scene) and identify exactly *where* things are being changed/reset improperly.
uid: 52430 topic_id: 17828 reply_id: 69457


[TOPIC: post.html]
#48

Blue Spruce Games

[GLOBAL: userInfoPane.html]
Blue Spruce Games
  • Contributor

  • 159 posts
  • Corona SDK

What is the storyboard equivalent of director's "popup" scenes? I want to create a pause menu in the middle of my game, but I don't see an easy way to show a new scene without removing the last from beneath it. Does anyone know a way to do this?
uid: 38000 topic_id: 17828 reply_id: 69460


[TOPIC: post.html]
#49

jonathanbeebe

[GLOBAL: userInfoPane.html]
jonathanbeebe
  • Contributor

  • 654 posts
  • Alumni

@peter9221: That is definitely possible with Storyboard, since scenes don't automatically get purged or remove on scene change.

Here's how I would do it...

Change to your new scene (popup) but do so with no effect (or do a crossFade or something that won't move the prior scene out of place).

Then, during your "createScene" or "enterScene" event, you can just get the previous scene and set it's view group's isVisible property to true (so the previous scene is no longer hidden).

Example:


local previousName = storyboard.getPrevious()
local previousScene = storyboard.getScene( previousName )

previousScene.view.isVisible = true
previousScene.view.alpha = 1.0
[/code]

The above would go in your "createScene" or "enterScene" for the popup scene.

Of course, if you already know the scene name of where you're coming from then the first line isn't necessary.
uid: 52430 topic_id: 17828 reply_id: 69465


[TOPIC: post.html]
#50

mobilefun4me

[GLOBAL: userInfoPane.html]
mobilefun4me
  • Enthusiast

  • 48 posts
  • Corona SDK

*** error: can't allocate region



With StoryBoard (Version 2011.695 (2011.8.2), I put together a quick game prototype but have received the following error message after I display a "Win.lua" scene after playing a game.lua screen. So it goes from the game.lua screen with a win to the win.lua screen, back to the game.lua screen and win.lua screen again but on this return to the game.lua the following is displayed?

Corona Simulator(549,0xa0a02540) malloc: *** mmap(size=4294819840) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
Fri Nov 25 17:46:23 dwss-macbook-pro.local Corona Simulator[549] : CGImageCreate: invalid image provider: NULL.
Fri Nov 25 17:46:23 dwss-macbook-pro.local Corona Simulator[549] : CGBitmapContextCreate: unsupported parameter combination: 8 integer bits/component; 8 bits/pixel; 0-component color space; kCGImageAlphaNoneSkipFirst; 4294966984 bytes/row.
Fri Nov 25 17:46:23 dwss-macbook-pro.local Corona Simulator[549] : CGContextDrawImage: invalid context 0x0
Fri Nov 25 17:46:23 dwss-macbook-pro.local Corona Simulator[549] : CGBitmapContextCreateImage: invalid context 0x0
Fri Nov 25 17:46:23 dwss-macbook-pro.local Corona Simulator[549] : CGImageDestinationAddImage image parameter is nil
Fri Nov 25 17:46:23 dwss-macbook-pro.local Corona Simulator[549] : CGImageDestinationFinalize image destination does not have enough images
Scene 5 Game 01: Exit Scene Event
2011-11-25 17:46:23.418 Corona Simulator[549:60f] glError at end unbindRenderFBO

It's interesting that I still can keep on playing the game, but something has gone wrong.

Any ideas on where to look as this is a new message to me.

Regards!
uid: 6288 topic_id: 17828 reply_id: 69823



[topic_controls]
Page 2 of 9 1 2 3 4 »
 
[/topic_controls]