adding hires-mode and frame style

This commit is contained in:
Jay McCarthy 2015-05-03 08:11:46 -04:00
parent e7b5d715a1
commit 179e1ac46f
2 changed files with 19 additions and 8 deletions

View File

@ -26,8 +26,10 @@
(send (gui-frame c) show #f))]) (send (gui-frame c) show #f))])
(define (make-gui #:mode [mode 'draw] (define (make-gui #:mode [mode 'draw]
#:opengl-hires? [opengl-hires? #f]
#:start-fullscreen? [start-fullscreen? #f] #:start-fullscreen? [start-fullscreen? #f]
#:icon [icon #f] #:icon [icon #f]
#:frame-style [frame-style '()]
#:width [the-init-w #f] #:width [the-init-w #f]
#:height [the-init-h #f]) #:height [the-init-h #f])
(define-values (start-x start-y init-w init-h) (define-values (start-x start-y init-w init-h)
@ -71,10 +73,7 @@
[y start-y] [y start-y]
[width init-w] [width init-w]
[height init-h] [height init-h]
[style [style frame-style]))
(if start-fullscreen?
'(hide-menu-bar no-resize-border)
'())]))
(define gl-config (define gl-config
(match mode (match mode
@ -88,6 +87,9 @@
[gl-config [gl-config
gl-config])) gl-config]))
(when (and gl-config opengl-hires?)
(send gl-config set-hires-mode #t))
(define c (define c
(new canvas% [parent f] (new canvas% [parent f]
[paint-callback paint-canvas] [paint-callback paint-canvas]
@ -129,8 +131,12 @@
(#:mode (#:mode
(or/c (one-of/c 'draw 'gl-compat 'gl-core) (or/c (one-of/c 'draw 'gl-compat 'gl-core)
(is-a?/c gl-config%)) (is-a?/c gl-config%))
#:opengl-hires?
boolean?
#:start-fullscreen? #:start-fullscreen?
boolean? boolean?
#:frame-style
(listof symbol?)
#:icon #:icon
(or/c #f path-string? (is-a?/c bitmap%)) (or/c #f path-string? (is-a?/c bitmap%))
#:width #:width

View File

@ -128,9 +128,11 @@ This module provides the standard @tech{chaos} that most users of
@defproc[(make-gui [#:mode mode (or/c (one-of/c 'draw 'gl-compat 'gl-core) @defproc[(make-gui [#:mode mode (or/c (one-of/c 'draw 'gl-compat 'gl-core)
(is-a?/c gl-config%)) (is-a?/c gl-config%))
'draw] 'draw]
[#:opengl-hires? opengl-hires? boolean? #f]
[#:start-fullscreen? start-fullscreen? boolean? [#:start-fullscreen? start-fullscreen? boolean?
#f] #f]
[#:frame-style frame-style (listof symbol?) '()]
[#:icon icon [#:icon icon
(or/c #f path-string? (is-a?/c bitmap%)) (or/c #f path-string? (is-a?/c bitmap%))
#f] #f]
@ -146,7 +148,8 @@ Returns a @tech{chaos} that opens a GUI frame with a canvas to draw
on. The default size of the frame is on. The default size of the frame is
@racket[width]x@racket[height]. The icon for the application is set to @racket[width]x@racket[height]. The icon for the application is set to
@racket[icon]. If @racket[start-fullscreen?] is true, then the frame @racket[icon]. If @racket[start-fullscreen?] is true, then the frame
is initially fullscreen. is initially fullscreen. The frame's style is set to
@racket[frame-style].
The canvas is set up for drawing based on @racket[mode]. If The canvas is set up for drawing based on @racket[mode]. If
@racket[mode] is @racket['draw], then the canvas assumes that @racket[mode] is @racket['draw], then the canvas assumes that
@ -155,7 +158,9 @@ the canvas is drawn with OpenGL. If @racket[mode] is
@racket['gl-compat], then a compatibility OpenGL profile is used. If @racket['gl-compat], then a compatibility OpenGL profile is used. If
@racket[mode] is @racket['gl-core], then a core OpenGL profile is @racket[mode] is @racket['gl-core], then a core OpenGL profile is
used. If @racket[mode] is a @racket[gl-config%] object, then it is used. If @racket[mode] is a @racket[gl-config%] object, then it is
used to initialize the canvas. used to initialize the canvas. If @racket[opengl-hires?] is
@racket[#t], then the resulting @racket[gl-config%] object will have
high resolution mode set.
The values that @racket[word-event] is called with are either The values that @racket[word-event] is called with are either
@racket['close] (for when the window's close button is pressed), a @racket['close] (for when the window's close button is pressed), a