doug livesey wrote:
Hi -- first post, & a very newbie-ish question, sorry.
Is it possible to create complex aggregate components as classes, &
then create instances of them in your shoes app?
So I guess if you had a bunch of callbacks for subcomponents in your
aggregate component, you could pass them in as lambdas to the constructor?
Sorry if that's not entirely clear, I guess I've only half thought
through what I'm asking.
Maybe I should have asked "how do people recommend organising &
reusing components?"
Ah, well, too late, now.
Cheers,
�� Doug.
Take a look at [1] to see what I'm doing to create stacks of cards. One
thing I found out, is that if I try to instantiate my class directly I
get a segfault. Instead, should turns your class into a method. So
Card becomes card and CardStack becomes card_stack. There is some
client code for a simple game of war here [2].
[1]
http://github.com/dokipen/shoes-war/blob/9c51a87b1fcf18b9a9c10bca41de72fb5d319697/lib/shoes/cards.rb
[2]
http://github.com/dokipen/shoes-war/blob/9c51a87b1fcf18b9a9c10bca41de72fb5d319697/lib/shoes/war.rb
PS. If the maintainer wants to put my code in the shoes samples, I
would be happy to change the license.