aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug-Richardson <doug116654@gmail.com>2017-04-19 16:15:58 -0400
committerGitHub <noreply@github.com>2017-04-19 16:15:58 -0400
commit240870e5d1bbeecf98601490ee90fdc96541e30d (patch)
tree24b9a61f039d3d99adb252709646832b98969f3d
parent7707b8ec456410823e78811b64e57c5ad669772a (diff)
Updated User-message function to take one argument
-rw-r--r--Hermes_Gui1.2.rkt18
1 files changed, 15 insertions, 3 deletions
diff --git a/Hermes_Gui1.2.rkt b/Hermes_Gui1.2.rkt
index 2fa1b4d..c1f4545 100644
--- a/Hermes_Gui1.2.rkt
+++ b/Hermes_Gui1.2.rkt
@@ -68,8 +68,20 @@
(send dc set-scale 1 1)
(send dc set-text-foreground "black")
;;messaging stuff
- (define (user-message username input color)
+
+ (define (user-message-parse string start)
+ (begin
+ (define (helper str index)
+ (if (eq? (string-ref str (+ start index)) #\~)
+ (substring str start (+ start index))
+ (helper str (+ index 1))))
+ (helper string start)))
+
+ (define (user-message onetrueinput)
(begin
+ (define username (user-message-parse onetrueinput 0))
+ (define input (user-message-parse onetrueinput (+ 1(string-length username))))
+ (define color (substring onetrueinput (+ 2 (string-length username) (string-length input))))
(send dc set-text-foreground color)
(send dc draw-text (string-append username ":" input) 0 height)
(set! listy (appendlist listy (list username input color height)))
@@ -82,9 +94,9 @@
))
;;Add a function that parces input from a string and extracts elements
-
+ ;;This probably won't change...
(define (send-message input color)
- (user-message name input color))
+ (user-message (string-append name "~" input "~" color)))
;;Although re-draw is kind of misleading, it is just print the whole
;;list of strings to the screen
(define (re-draw-message username input color in-height)