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
// This example has some faults, the most important one is how are you gonna know what data | |
// the annotation actually annotates. The best way would probably be to tag it with | |
// {entity_id: typeid, entity_ptr: rawptr}, this would allow you to switch on the type | |
// and cast the ptr. That way you can ensure the annotation was added to the correct type | |
// and not some random entity | |
package main | |
// Proposed change for existing compiler attributes |
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
Go src: https://benchmarksgame-team.pages.debian.net/benchmarksgame/program/nbody-go-3.html | |
Odin src: https://gist.github.com/thebirk/e02df1b94ef07fb62b50d64ba2f5328e | |
$ go build | |
$ timemem gotest.exe 50000000 | |
-0.169075164 | |
-0.169059907 | |
Exit code : 0 | |
Elapsed time : 3.76 | |
Kernel time : 0.00 (0.0%) |
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
package main | |
import "core:fmt"; | |
import "core:math"; | |
FloatType :: f64; | |
Vec3 :: distinct [3]FloatType; | |
Body :: struct { | |
pos: Vec3, |
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
package huffman | |
import "core:fmt" | |
import "core:strings" | |
import "core:mem" | |
import "core:math" | |
using import "arraylist" | |
HuffmanNode :: struct { | |
freq: int, |
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
package arraylist | |
import "core:mem" | |
ArrayList :: struct(T: typeid) { | |
data: []T, | |
size: int, | |
allocator: mem.Allocator, | |
} |
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
package bed | |
using import "core:c" | |
import "core:os" | |
//foreign import ftlib "freetype271.lib"; | |
when os.OS == "windows" do foreign import ftlib "freetype.lib"; | |
else when os.OS == "linux" do foreign import ftlib "system:freetype"; | |
else { | |
#assert(false); |
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
package bed | |
using import "core:c" | |
import "core:os" | |
//foreign import ftlib "freetype271.lib"; | |
when os.OS == "windows" do foreign import ftlib "freetype271.lib"; | |
else { | |
#assert(false); | |
} |
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
#include <SDL2/SDL_image.h> | |
SDL_Texture *fontTexture = 0; | |
const char *layout = | |
"ABCDEFGHIJKLMNOP" | |
"QRSTUVWXYZ!?. " | |
"1234567890" | |
; | |
void initText() { |
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
/* | |
Most of the code here will be taken from HandmadeMath, | |
which is covered under the CC0 1.0 Universal license, | |
see LICENSE for more information | |
*/ | |
package math | |
import omath "core:math" | |
PI :: omath.PI; |
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
/* | |
Copyright (C) - Aleksander B. Birkeland 2018 | |
Very basic HTML generator | |
TODO(Some way to generate xml instead of html) | |
Closes all tags including empty ones | |
*/ |