[cells-devel] initial stab at using Cells

Ken Tilton kentilton at gmail.com
Mon Apr 10 12:48:32 UTC 2006


Jack Unrue wrote:

>On 4/9/06, Ken Tilton <kentilton at gmail.com> wrote:
>  
>
>>it is pretty clear to me as an old Cells hand. I am toast right now, but
>>I'll send some comments tomorrow. One Q: where does game-shape-data get
>>called, in some imperative logic responding to events,  that detects that a
>>shape has been placed?
>>    
>>
>
>In tiles-panel.lisp, look for gfw:event-mouse-up. Basically if the location
>of the mouse up occurs within the same tile shape as the mouse down that
>started the selection, then the list of points comprising that shape become
>the input data that tickles the game model.
>
Ok. One thing that might pay off in more elaborate (as in reall-world) 
models is to move as much semantics as possible into the Cells realm. In 
this case you might just have the event handler do:

   (setf (clicked shape) t)

...where clicked is ephemeral. Then elsewhere some other ephemeral 
"new-points-earned" ephemeral converts that to points, while other cells 
might worry about a sound to be generated or graphic transformations to 
apply. In my GUIs I go further and get mouse-downs and mouse-ups into 
the game. Since I am usually rolling my own GUI, I need this to do the 
higlighting changes as mouse-down, mouse-over, and mouse-up events go 
by. IIRC, in Cello I even created a class called mouse-click, which came 
into existence on mouse-down (remembering on which GUI element if any 
the mousedown happened) and then expired on mouseup. anyway, what you 
did is fine, just offering food for thought if you kepe going with cells.

> The internal representation
>of the board gets modified accordingly (the selected shape is removed
>and points are awarded), then the scoreboard and tile panels are told
>to redraw themselves via observers on the score and tiles slots.
>  
>
Yep. Again, if one wants to go a little further one can have ruled cells 
for appearance that watched other cells for score and and other game 
state. The nice thing here is that there are only so many (tho quite a 
few) cells that affect screen draws. Once all those have observers that 
call the "update me" function, yer done. From now on one just rights 
rules connecting appearance to program state and it all Just Works. 
(btw, in this case the "update me" function is merely flagging things 
for update, otherwise it gets done repeatedly as dozens of appearance 
cells decide they have changed.

kt

-------------- next part --------------
A non-text attachment was scrubbed...
Name: kentilton.vcf
Type: text/x-vcard
Size: 171 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/cells-devel/attachments/20060410/d80ea716/attachment.vcf>


More information about the cells-devel mailing list