Buttons and buttons and more buttons...

It’s official! Hooking up buttons to actions is tedious in any language. Can’t wait until I get to the fun stuff…

Jw, whats the point of this post?

On a side note, my current project is a menu class (which can be a button). Each button is a mesh that can be lots of things. I could rant on more about my geeky project but I’ll stop here.

@CodeaNoob Just a random observation. As much as I am loving Lua, I still have to install callbacks and methods for buttons. It’s far easier than Java, but still tedious. :frowning:

@Goatboy76 I tried meshes but my animation engine just does seem to want to play nice with them. My buttons have tweens. As soon as I understand more about meshes and what sort of attention they need, I’m sure I can hack them in.

I would love to see your menu class, though. I am avoiding menus in my project–thus, buttons galore.

My buttons have tweens too!

I’ve working on it for a LONG time though, so I did it first :wink:

Callbacks are EASY in Lua… You can pass a function as a parameter, store it as a variable, and call it, too.

I LOVE Lua in this respect. I hooked all my generic buttons up with a generic callback in like 3 lines each. So easy! Codea makes GUIs so trivial… Bye-bye Swing! :wink:

I’m still wrapping my brain around meshes. I’d like some of my buttons to ripple when you touch them, but I can’t seem to fit them into my animation engine. I may have to hook them in at the main draw() loop instead…

@Syntonica a callback is as easy as
Variable = Function

Pardon me if you know that already!

@syntonica - rippling your buttons will have to be done via the draw loop, that is the only time the screen changes. However, you can easily set a tween in the touched function that animates the normal boundaries of a button, so you don’t need to make any changes to draw.

@syntonica - something else that you could use to animate buttons, is Simeon’s Juice library


@Luatee Thanks, but I needed a couple of lines to set some parameters to go with the callback.

@Ignatz I’m still trying to figure out how shaders work and why! I’m hoping to include them in the main animation engine rather than starting up a second or third. Of course, I may end up redoing the code some so animation is handled in layers rather than one big method. I’m still dropping my jaw at how fast animation even is on this little iPad Mini… And that’s just with sprites, none of the advanced graphics. Yet.

I’ve done an ebook on shaders which may help


@Ignatz I’ve read you ebook and shaders still baffle me ~X(

@JakAttak - keep trying, I felt that way about most of the things I’ve been writing about!

@JakAttak. Basically, you get hooks into the C-like language used to program OpenGL for shaders. After reading Ignatz’ PDF, I read the actual language description. It basically is C with extensions for vectors and matrices. Codea also gives you a Lua bridge to feed values directly into the shader code.

The shader applies whatever you tell it to onto each and every pixel. Ignatz kindly gives very simple examples so you can see what’s going on. My head didn’t explode while reading them. :). Take a break from it for a while and then work through his examples again. There’s a lot of gibberish in Shader Lab…

Not sure if that helps…