|
@@ -63,6 +63,28 @@ func nonRandom() byte {
|
|
|
return rb
|
|
|
}
|
|
|
|
|
|
+// NoMoreSecrets Sleep
|
|
|
+//
|
|
|
+// This allows the user to abort the effect with a key or left mouse click.
|
|
|
+func NMSSleep(Door *Door, sleep time.Duration) bool {
|
|
|
+ _, ex, err := Door.WaitKey(sleep)
|
|
|
+ if err == nil {
|
|
|
+ if ex == MOUSE {
|
|
|
+ m, ok := Door.GetMouse()
|
|
|
+ if ok {
|
|
|
+ if m.Button == 1 {
|
|
|
+ log.Println("NoMore")
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ log.Println("NoMore")
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ return false
|
|
|
+}
|
|
|
+
|
|
|
/*
|
|
|
NoMoreSecrets - render output as random, then fade in the original text.
|
|
|
|
|
@@ -260,12 +282,7 @@ func NoMoreSecrets(output string, Door *Door, config *NoMoreSecretsConfig) {
|
|
|
return
|
|
|
}
|
|
|
// time.Sleep()
|
|
|
- _, _, err := Door.WaitKey(time.Millisecond * time.Duration(config.Jumble_Loop_Speed))
|
|
|
- if err == nil {
|
|
|
- log.Println("NoMore")
|
|
|
- keyAbort = true
|
|
|
- break
|
|
|
- }
|
|
|
+ keyAbort = NMSSleep(Door, time.Millisecond*time.Duration(config.Jumble_Loop_Speed))
|
|
|
}
|
|
|
|
|
|
for {
|
|
@@ -318,11 +335,7 @@ func NoMoreSecrets(output string, Door *Door, config *NoMoreSecretsConfig) {
|
|
|
return
|
|
|
}
|
|
|
// time.Sleep()
|
|
|
- _, _, err := Door.WaitKey(time.Millisecond * time.Duration(config.Reveal_Loop_Speed))
|
|
|
- if err == nil {
|
|
|
- log.Println("NoMore")
|
|
|
- keyAbort = true
|
|
|
- }
|
|
|
+ keyAbort = NMSSleep(Door, time.Millisecond*time.Duration(config.Reveal_Loop_Speed))
|
|
|
|
|
|
if revealed {
|
|
|
break
|
|
@@ -465,12 +478,7 @@ func NoMoreSecrets(output string, Door *Door, config *NoMoreSecretsConfig) {
|
|
|
return
|
|
|
}
|
|
|
// time.Sleep()
|
|
|
- _, _, err := Door.WaitKey(time.Millisecond * time.Duration(config.Jumble_Loop_Speed))
|
|
|
- if err == nil {
|
|
|
- log.Println("NoMore")
|
|
|
- keyAbort = true
|
|
|
- break
|
|
|
- }
|
|
|
+ keyAbort = NMSSleep(Door, time.Millisecond*time.Duration(config.Jumble_Loop_Speed))
|
|
|
}
|
|
|
|
|
|
for {
|
|
@@ -514,11 +522,7 @@ func NoMoreSecrets(output string, Door *Door, config *NoMoreSecretsConfig) {
|
|
|
return
|
|
|
}
|
|
|
// time.Sleep()
|
|
|
- _, _, err := Door.WaitKey(time.Millisecond * time.Duration(config.Reveal_Loop_Speed))
|
|
|
- if err == nil {
|
|
|
- log.Println("NoMore")
|
|
|
- keyAbort = true
|
|
|
- }
|
|
|
+ keyAbort = NMSSleep(Door, time.Millisecond*time.Duration(config.Reveal_Loop_Speed))
|
|
|
if revealed {
|
|
|
break
|
|
|
}
|