> On Nov 6, 2017, at 7:23 PM, Luis Sanjuán <luisj.sanj...@gmail.com> wrote: > > Hi, Matthias. I'm not sure about it either, but one situation where learners > or users might miss it is when they want to share their work. If their code > follows the design principles HtDP teaches, the world rendering will rely on > a single point of control, say the width and/or height of the scene. But > those are ultimately bound to the particular size of the computer screen on > which they coded. On the other hand, if they were able to set the relative > display size as point of control, well written code will behave well on many > different screens, while not so good code would be penalized when shared. > Just a point to speak in favor of the inclusion, but there might be more > solid reasons to reject it.
It’s a convincing argument and I have pushed a new piece of functionality so that the display-mode clause can ‘pick up’ the size of the monitor in a functional manner. I still think this design is a bit clunky and I will consider it experimental until the next release. For an example, see below — Matthias #lang htdp/isl+ (require 2htdp/universe) (require 2htdp/image) (require 2htdp/abstraction) (define-struct world [size width height]) ;; World = (make-world Number [Maybe Number] [Maybe Number]) ;; World Number -> World (define (update-size w s) (make-world s (world-width w) (world-height w))) ;; {'fullscreen, 'normal} -> Number (define (main x) (big-bang (make-world 900 #false #false) (to-draw (lambda (x) (match x [(world size #false #false) (circle (+ 20 (world-size x)) 'solid 'red)] [(world size width height) (overlay (rectangle (* .20 width) (* .20 (world-height x)) 'solid 'blue) (circle (+ 20 (world-size x)) 'solid 'red))]))) (on-tick (lambda (x) (update-size x (- (world-size x) 20)))) (stop-when (lambda (w) (< (world-size w) 0))) (display-mode x ;; optional function to pick up the extent of the world (lambda (w width height) (make-world (world-size w) width height))) (close-on-stop #true))) (main 'fullscreen) (main 'normal) -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.