[plt-scheme] using sgl in world.ss

From: Chris Burke (cburke at ccs.neu.edu)
Date: Tue Jan 30 00:49:29 EST 2007

I'm attempting to turn world.ss into a 3D world rather than a 2D  
world using sgl. I'm having a little trouble getting things started.  
I see that the main canvas is an editor-canvas with an instance of  
text% as its editor as follows:

   (define (add-editor-canvas frame visible-world w h)
     (define c
       (new (class editor-canvas%
              (super-new)
              (define/override (on-char e) (key-callback (send e get- 
key-code)))
              (define/override (on-event e) (mouse-callback e)))
            (parent frame)
            (editor visible-world)
            (style '(no-hscroll no-vscroll))
            (horizontal-inset INSET)
            (vertical-inset INSET)))
     (send c min-client-width (+ w INSET INSET))
     (send c min-client-height (+ h INSET INSET))
     (send c focus))

If using sgl to represent the world, would it make more sense for c  
to be an instance of canvas (or instance of a class inheriting from  
canvas) with overridden methods using the sgl library? I'm not  
exactly sure why an editor-canvas is used but I've been able to get a  
normal canvas instance to work with sgl in world. Also, when I do  
this, my canvas is shifted on the frame as seen here: http:// 
www.ccs.neu.edu/~cburke/sgl.png. It has to do with the frame creation  
and this specific line: (style '(no-resize-border metal)). How do I  
compensate for that border and get the canvas in the correct place?


--
Chris Burke
508-735-7940
cburke at ccs.neu.edu

:: eval s=%q(puts"eval s=%q(#{s})") ::





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20070130/cfc08ef2/attachment.html>

Posted on the users mailing list.