Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Live coding with ZeroBrane — Gideros Forum

Live coding with ZeroBrane

Cliff76Cliff76 Member
edited May 2013 in General questions
I'm continuing an earlier discussion in a thread with @bowerandy and following up on a comment from @paulclinger. I've managed to get Live coding working in ZeroBrane but I'm seeing some screen update issues. When I run my attached project and play with the slider to reposition the "click buttons to play sounds" label I get ghosting or trailed drawing of the label as it updates to the new position. image
Is this a known issue or am I doing something wrong?
zip
zip
Audio Example.zip
199K
tiff
tiff
screengrab.tiff
44K

Comments

  • Cliff76Cliff76 Member
    Oh and I'm confused with how to add/remove files to/from the project under ZeroBrane. I've been doing a mixture of manually editing the gproj file and using Gideros Studio to add/remove project files because I couldn't find an add/remove project files option in ZeroBrane. I'm also noticing a pattern where "calling" require "Livepad" at the bottom of my main.lua forces me to add require for all of its dependencies where originally (when all code from Livepad was inlined in main.lua) I could directly invoke code in other lua files without using a require. Is the subtle difference documented or explained somewhere? Could somebody explain the difference? When and why you should use require to use code in other project files? Thanks!
  • @Cliff76, since the live coding component doesn't have any information on what objects needs to be (re-)created, you need to control it yourself. For example, in the simple sample I referenced, I'm explicitly deleting all objects on the screen:

    function Application:clearStage()
    while stage:getNumChildren()>0 do
    stage:removeChildAt(1)
    end
    end

    > "calling" require "Livepad" at the bottom of my main.lua forces me to add require for all of its dependencies

    Forces how? Does it fail when you don't do this?

    > where originally (when all code from Livepad was inlined in main.lua) I could directly invoke code in other lua files without using a require. Is the subtle difference documented or explained somewhere? Could somebody explain the difference?

    Gideros allows you to not specify "require" as it will preload all Lua files you include in your project (unless you specify excludeFromExecution="1"). You can still use explicit "require" if you want.
  • Cliff76Cliff76 Member
    @paulclinger Thanks for replying! Let me be a little more specific. When I originally started I didn't use any require statements at all and everything ran as expected. I then "cut" all of my code out of main.lua and moved it into Livepad.lua then introduced the ZeroBrane live coding support logic into main.lua. I started getting errors like this:
    Livepad.lua:10: attempt to index global 'SoundButton' (a nil value)
    stack traceback:
    	Livepad.lua:10: in main chunk
    After adding a require for my soundbutton.lua file that error went away only to be replaced by another similar error prompting me to add require statements in soundbutton.lua as well. I was thinking adding the 1st require triggered something that made the remaining requires mandatory. (I'm still brand new to Gideros and ZeroBrane and even Lua so I may ask a silly question or two.)

    Regarding the manual removal, I'll have to look at your examples closer to see if I follow when/where you call this clearStage function. I missed it in all the excitement of watching the original video and wanting to dive right in.
Sign In or Register to comment.