[etoys-dev] programming etoys itself
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:
(#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:
^ 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
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?
> etoys-dev mailing list
> etoys-dev at squeakland.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the etoys-dev