Looking for good examples of morph programming
Ned Konz
ned at bike-nomad.com
Fri May 16 17:58:08 UTC 2003
On Friday 16 May 2003 10:22 am, Bovaird, Brian wrote:
> I looked at the basic morph programming tutorials but these all
> concentrate on scripting.
>
> I am writing a game and need to put a gui on it. I need to do
> "programatic" morph programming.
>
> Are there any good tutorials for doing this?
>
> I am currently looking at all the games (Tetris, Chess, etc.)
> examples but it is confusing without explainations.
Hi Brian,
Welcome to Morphic programming!
I agree, it can be a bit overwhelming at first.
However, the parts you typically need to use are pretty limited.
If you haven't already discovered this, two useful tools are the
Protocol Browser (choose "browse protocol") and the Tracing Messages
Browser package from Squeakmap.
Look at the list of tutorials on the Squeak Swiki "Morphic" page:
http://minnow.cc.gatech.edu/squeak/30
Some suggestions while reading these:
Be wary of overriding mouseDown: etc. unless you have very special
needs; instead, use the
self on: #mouseDown send: #someMessage to: self
or
self on: #mouseDown send: #someMessageMyArg:event:from: to: self
with: myArg
type methods. The second form sends myArg as the first argument, but
also sends the event itself (which includes hand position) and the
morph that the event happened to. This is useful since you could send
messages to some other object (like for instance you could send
events for board pieces to the board).
Other events include #click, #doubleClick, #startDrag,
#doubleClickTimeout, #mouseUp, etc.
If you have anything to do regularly (i.e. not tied to input events),
use stepping instead of background Processes.
If you lock a Morph it won't accept events. However, its parent will.
This might be helpful sometimes.
--
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE
More information about the Squeak-dev
mailing list
|