-
-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add universe-inset parameter #237
base: master
Are you sure you want to change the base?
Conversation
What uses do you have in mind? Actually what users? |
My partner and I are writing a visual novel and I'm using universe for the engine. The end goal for the engine is to be vaguely like Ren'Py which is widely used for indie VNs. We plan to self-publish our game commercially and document the engine for anyone to use. In general, the intended user is anyone who wants to use universe to make graphical applications that are more stylized than racket/gui. Having a white border limits the freedom of stylization. I know this direction was not the intent for 2htdp/universe, so I'm happy to maintain a non-student-focused fork instead. However, this is currently the only change I expect to make so it would be much simpler to add it here. |
5 | ||
(λ (v) | ||
(unless (and (integer? v) | ||
(<= 0 v 1000)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1000
really? Did you try to run a big-bang
program with such an inset?
(Very minor: this is a world-inset
not a universe-insert
.)
(unless (and (integer? v) | ||
(<= 0 v 1000)) | ||
(raise-argument-error 'universe-inset "an integer between 0 and 1000 (inclusive)" v)) | ||
v))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whatever you really choose for an inset
(1) name the max constant and (2) use the name instead of the constant.
@@ -53,8 +60,8 @@ | |||
;; MouseEvent% -> [List Nat Nat MouseEventType] | |||
;; turn a mouse event into its pieces | |||
(define (mouse-event->parts e) | |||
(define x (- (send e get-x) INSET)) | |||
(define y (- (send e get-y) INSET)) | |||
(define x (- (send e get-x) (universe-inset))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use (define INSET (universe-inset))
and then leave these lines alone. (It's not like INSET will change during the course of the big-bang
program. (Yes this is a "contract" that we don't enforce right now.))
(define x (- (send e get-x) INSET)) | ||
(define y (- (send e get-y) INSET)) | ||
(define x (- (send e get-x) (universe-inset))) | ||
(define y (- (send e get-y) (universe-inset))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
INSET
@@ -220,6 +220,7 @@ | |||
(define/pubment (create-frame/universe) | |||
(define play-back:cust (make-custodian)) | |||
|
|||
(define inset (universe-inset)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
INSET
This section documents features of the universe teachpack not available in | ||
the HtDP student languages. | ||
|
||
@defparam[universe-inset inset-width (integer-in 0 1000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the named constant instead of 1000
.
Thank you for the feedback, I'll make those changes. The limit of 1000 apparently comes from editor-canvas%. Without the guard, you get
But the limit is documented as 10000 so I'm not sure. 1000 does work; I can't imagine why anyone would want it but there's no reason to restrict it imo. It could also just be a true/false parameter for 5/0 inset. |
Hmph, can we use something smaller? I am skeptical of 1,000.
|
How about on (5, current)/off (0)? |
I am not sure what you mean. But (1) a numeric parameter is fine and (2) something like 10 or 20 or 100 for the inset feels right. |
Any reason to use a guard for |
Resolves #235.
I'm not sure about the phrasing or location of the documentation but I think it's clear enough for curious *SL users.