aboutsummaryrefslogtreecommitdiff
path: root/code
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2016-11-28 20:39:43 +0000
committerGinger Bill <bill@gingerbill.org>2016-11-28 20:39:43 +0000
commit598dab5bc4fb2836c8f2a6cad757dcb3760a895f (patch)
tree957f92585cae2e41bee93ce0b9d493b5178a0f54 /code
parentcbb70c78731b9d928508a52180a186b178d30a5e (diff)
#rune "" to ''; Remove infix and postfix call notation
Diffstat (limited to 'code')
-rw-r--r--code/demo.odin31
-rw-r--r--code/game.odin2
2 files changed, 31 insertions, 2 deletions
diff --git a/code/demo.odin b/code/demo.odin
index a1916e589..e516d3529 100644
--- a/code/demo.odin
+++ b/code/demo.odin
@@ -1,5 +1,34 @@
#import "fmt.odin"
+#import "utf8.odin"
main :: proc() {
- fmt.println("Hellope, World!")
+ MAX :: 64
+ buf: [MAX]rune
+ backing: [MAX]byte
+ offset: int
+
+ msg := "Hello"
+ count := utf8.rune_count(msg)
+ assert(count <= MAX)
+ runes := buf[:count]
+
+ offset = 0
+ for i := 0; i < count; i++ {
+ s := msg[offset:]
+ r, len := utf8.decode_rune(s)
+ runes[count-i-1] = r
+ offset += len
+ }
+
+ offset = 0
+ for i := 0; i < count; i++ {
+ data, len := utf8.encode_rune(runes[i])
+ for j := 0; j < len; j++ {
+ backing[offset+j] = data[j]
+ }
+ offset += len
+ }
+
+ reverse := backing[:count] as string
+ fmt.println(reverse)
}
diff --git a/code/game.odin b/code/game.odin
index c5d0c52f2..4760f0244 100644
--- a/code/game.odin
+++ b/code/game.odin
@@ -4,7 +4,7 @@
#import "os.odin"
#import "opengl.odin" as gl
-TWO_HEARTS :: #rune "💕"
+TWO_HEARTS :: '💕'
win32_perf_count_freq := win32.GetQueryPerformanceFrequency()
time_now :: proc() -> f64 {