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
| // Build this example with | |
| // v -live bounce.v | |
| module main | |
| import gx | |
| import gg | |
| import time | |
| struct Game { | |
| mut: |
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
| // Build this example with | |
| // v -live bounce.v | |
| module main | |
| import gx | |
| import gg | |
| import time | |
| import sokol.gfx | |
| struct Game { |
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
| // Build this example with | |
| // v -live bounce.v | |
| module main | |
| import gx | |
| import gg | |
| import time | |
| import sokol.gfx | |
| struct Game { |
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
| // Build this example with | |
| // v -live bounce.v | |
| module main | |
| import os | |
| import gx | |
| import gg | |
| import time | |
| struct Game { |
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
| // Build this example with | |
| // v -live bounce.v | |
| module main | |
| import os | |
| import gx | |
| import gg | |
| import time | |
| struct Game { |
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
| import time | |
| import rand | |
| fn quicksort<T>(mut tab []T, left, right int) { | |
| pt := &T(tab.data) | |
| mut i := left | |
| mut j := right | |
| middle := (left + right) >> 1 | |
| mut pivot := unsafe {*(pt + middle)} | |
| for { |
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
| fn new_counter_generator() fn () int { | |
| mut count := -1 | |
| return fn () int { | |
| count = count + 1 | |
| return count | |
| } | |
| } | |
| fn main() { | |
| a := new_counter_generator() |
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
| import sync | |
| enum FSMState { | |
| init = 0 | |
| state_a | |
| state_b | |
| state_c | |
| exit | |
| } |
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
| import os | |
| #include <sys/mman.h> | |
| fn C.mmap(addr voidptr, len size_t, prot, flags, fd int, offset i64) voidptr | |
| fn C.munmap(addr voidptr, len size_t) int | |
| fn main() { | |
| big_file_path := '/ssd2/VirtualBox VMs/ISOs/ClearOS-DVD-x86_64-7.7.2.280072.iso' | |
| fsize := os.file_size(big_file_path) |
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
| import time | |
| import sokol.audio | |
| const ( | |
| sw = time.new_stopwatch({}) | |
| sw_start_ms = sw.elapsed().milliseconds() | |
| frame_0 = int(0) | |
| ) | |
| fn my_audio_stream_callback(buffer &f32, num_frames, num_channels int) { |