[etoys-dev] programming etoys itself

Ricardo Moran richi.moran at gmail.com
Thu Apr 22 11:59:04 EDT 2010


Someone more experienced may give you a better help, but I'll give it a try.

AFAIK there is no good documentation of how to make tiles and stuff (at
least I couldn't find anything really useful). I learned most of this stuff
by watching examples... the image is full of them ;).
Making an object scriptable is not as easy as it should be because Etoys has
a lot of quirks that need some special attention.

The tiles are created as slots/commands in the #additionsToViewerCategories
method in the class side of the Morph (IMO you can see some simple examples
by watching the source code of BookMorph or JoystickMorph). To implement
that method correctly you have to be very careful and obey the rules. Below
is a simple example:

additionsToViewerCategories
^
#(
    (#category
        (
            (#slot #slotName 'comment' #SlotType #readWrite #Player
#getterMethod #Player #setterMethod:)
            (#command #commandName 'comment')
            (#command #commandWithOneParameter: 'comment' #ParameterType)
        )
    )
)

The #category must be lowercase (this is one of Etoys quirks I tell you
before), otherwise it will not appear... don't ask me why...
The #SlotType and #ParameterType are usually Number but they can be Boolean,
Color, Point, String, among others...
The #readWrite part can also be #readOnly or #writeOnly (I don't know the
purpose of the latter, though).
The #getterMethod and #setterMethods: are the names of the methods you'll
have to implement in order to access the value of the slot. This methods
must be implemented in a Player subclass (or Player itself but I don't like
to touch the Player class, it's already bloated and messy). If you make a
subclass of Player you must implement a method called #newPlayerInstance in
your Morph. This method should look like this:

newPlayerInstance
^ MySubclassOfPlayer newUserInstance.

Well, if you have any question don't be afraid to ask. Also it could be a
good example to watch the stuff I'm doing as part of the GSoC program. More
info here: http://www.pcs.cnu.edu/~rcaton/ESUG/ESUG.html

Best regards
Richo

On Tue, Apr 20, 2010 at 6:17 PM, Lawson English <lenglish5 at cox.net> wrote:

> What do I need to do to get started with extending etoys?
>
> Specifically, I'm working on porting the NeHE OpenGL tutorials to squeak,
> and it seems a very kool thing to allow an OGLMorph to be scripted via
> etoys. Any links to reading material, simple examples, etc?
>
>
> Thanks
>
>
> Lawson
>
> _______________________________________________
> etoys-dev mailing list
> etoys-dev at squeakland.org
> http://lists.squeakland.org/mailman/listinfo/etoys-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakland.org/pipermail/etoys-dev/attachments/20100422/29e19d9d/attachment-0001.html


More information about the etoys-dev mailing list