diff options
author | San Jacobs | 2023-01-12 02:41:36 +0100 |
---|---|---|
committer | San Jacobs | 2023-01-12 02:41:36 +0100 |
commit | 11489f9fd7228ebec8ab630f92d1cfdf8d1a20ba (patch) | |
tree | e4c7f8cc8efa5012569b154565217f50d1775f49 | |
download | odin-frogger-11489f9fd7228ebec8ab630f92d1cfdf8d1a20ba.tar.gz odin-frogger-11489f9fd7228ebec8ab630f92d1cfdf8d1a20ba.tar.bz2 odin-frogger-11489f9fd7228ebec8ab630f92d1cfdf8d1a20ba.zip |
Initial commit
-rw-r--r-- | .vscode/tasks.json | 19 | ||||
-rw-r--r-- | LICENCE.md | 3 | ||||
-rw-r--r-- | README.md | 5 | ||||
-rw-r--r-- | main.exe | bin | 0 -> 369152 bytes | |||
-rw-r--r-- | main.odin | 59 | ||||
-rw-r--r-- | main.pdb | bin | 0 -> 3821568 bytes | |||
-rw-r--r-- | odin-frogger-debug-session.rdbg | bin | 0 -> 543 bytes |
7 files changed, 86 insertions, 0 deletions
diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..16477da --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,19 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "type": "shell", + "command": "odin run .\\main.odin -file -strict-style -debug", + "group": "build", + "presentation": { + // Reveal the output only if unrecognized errors occur. + "reveal": "silent" + }, + // Use the standard MS compiler pattern to detect errors, warnings and infos + "problemMatcher": "$msCompile" + } + ] +}
\ No newline at end of file diff --git a/LICENCE.md b/LICENCE.md new file mode 100644 index 0000000..ac1f876 --- /dev/null +++ b/LICENCE.md @@ -0,0 +1,3 @@ +Luke Smith Licenceā¢ + +If you ask, you can't use it. diff --git a/README.md b/README.md new file mode 100644 index 0000000..346843d --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# odin-frogger + +Really shitty turn-based frogger I'm writing in [odin](https://odin-lang.org/) to see if I like it. + +Also, yes. `.vscode/`. Cringe. I know. I just can't be bothered to set up autocomplete for odin in vim.
\ No newline at end of file diff --git a/main.exe b/main.exe Binary files differnew file mode 100644 index 0000000..016fbd3 --- /dev/null +++ b/main.exe diff --git a/main.odin b/main.odin new file mode 100644 index 0000000..5357595 --- /dev/null +++ b/main.odin @@ -0,0 +1,59 @@ +package main + +import "core:fmt" +import "core:os" +import "core:bufio" +import "core:io" +import "core:strconv" +import "core:strings" + +instructions: string = "Use space to stay still, and HJKL to move." + +main :: proc() { + fmt.println("What's your name? ") + name: string = getln() + defer delete(name) + fmt.printf("Hello %v! Welcome to shitty frogger.\n\n", name) + + fmt.println(instructions) + + // Two options for this implementation: + // 1. Structs for rows that contain data about what direction they flow + // - Problem: No neat way to declare the lines with a custom length at runtime + // - Solution: Pointer shit maybe. Ugh. + // 2. Separate array that contains booleans for what direction they flow + // - Problem: Data feels separate, which feels wonky, but might be fine + // + // + // + // +} + +getln :: proc() -> string { + buf: [256]u8 + bytes_read, ok := os.read(os.stdin, buf[:]) + //assert(ok) + read_input := string(buf[:bytes_read-2]) + return strings.clone(read_input) +} + +getint :: proc() -> int { + buf: [256]u8 + for { + read_input := getln() + output, ok := strconv.parse_int(read_input) + if ok { + return output + } else { + fmt.println("That's not a normal whole number, mate.") + } + } +} + +getrune :: proc() -> rune { + buf: [256]u8 + bytes_read, ok := os.read(os.stdin, buf[:]) + //assert(ok) + read_input := rune(buf[0]) + return read_input +} diff --git a/main.pdb b/main.pdb Binary files differnew file mode 100644 index 0000000..6397bcf --- /dev/null +++ b/main.pdb diff --git a/odin-frogger-debug-session.rdbg b/odin-frogger-debug-session.rdbg Binary files differnew file mode 100644 index 0000000..b871545 --- /dev/null +++ b/odin-frogger-debug-session.rdbg |