[Openmcl-devel] Core Animation demo
Raffael Cavallaro
raffaelcavallaro at mac.com
Tue Jul 7 22:13:09 PDT 2009
On Jul 8, 2009, at 12:39 AM, Gary Byers wrote:
> OBJC:MAKE-OBJC-INSTANCE (or that there newfangled CL:MAKE-INSTANCE
> thing,
> which is entirely equivalent) is basically
>
> (#/init (#/alloc class)) ; allocate an instance of class, call #/
> init to initialize
> ; that instance.
>
> Calling #/init on the value returned by either MAKE-INSTANCE or
> OBJC:MAKE-OBJC-INSTANCE
> is therefore equivalent to
>
> (#/init (#/init (#/alloc class)))
>
> If an #/init method has side effects (like ... oh, attaching a layer
> to a context,
> whatever that means), and can tell when those side effects have
> already taken
> place, it'd certainly be justified in warning about that.
Right, but it only warns on the second redundant #/init calland
subsequently. The first time #/init is called on the result of
objc:make-objc-instance there's no error logged to console.
In reply to Neil, If I remove the (redundant) #/init call, I see what
you see - If I leave the first window open it becomes unresponsive to
mouse clicks. I'm pretty sure this is because your "sprite" is a
dynamic variable. You probably want to do something like the attached
which gives each new window its own sprite rather than using a single
sprite defined with defparameter. I had forgotten I refactored your
code this way earlier today when I mentioned this issue just now.
warmest regards,
Ralph
-------------- next part --------------
A non-text attachment was scrubbed...
Name: raf-ca-demo.lisp
Type: application/octet-stream
Size: 4118 bytes
Desc: not available
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20090708/938cfec4/attachment.obj>
-------------- next part --------------
Raffael Cavallaro
raffaelcavallaro at me.com
More information about the Openmcl-devel
mailing list