Created
February 8, 2019 17:09
-
-
Save iani/6a2de34e2639eb552d3a2a13e595b0de to your computer and use it in GitHub Desktop.
compmus class session 7 sc code - clock
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| \clock.class; | |
| 'clock'.class; | |
| Date.localtime - Date.localtime; | |
| //: | |
| \clock.window({ | w | | |
| var routine, beats = 0, textdisplay, minutes, seconds; | |
| w.view.layout = VLayout( | |
| textdisplay = StaticText().string_("CLOCK IS HERE"), | |
| seconds = NumberBox(), | |
| minutes = NumberBox() | |
| ); | |
| routine = { | |
| loop { | |
| 1.wait; | |
| beats = beats + 1; | |
| seconds.value = beats % 60; | |
| minutes.value = beats - (beats % 60) / 60; | |
| textdisplay.string = Date.localtime.stamp[9..]; | |
| } | |
| }.fork(AppClock); | |
| }); | |
| //: | |
| Date |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment