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
| // Release - x64 | |
| void set_background_color(float r, float g, float b); | |
| void draw_line(float x0, float y0, float x1, float y1, float r, float g, float b, float a); | |
| float print_string(char* text, float x, float y, float size, float r, float g, float b, float a); | |
| float print_int(int number, float x, float y, float size, float r, float g, float b, float a); | |
| float print_float(float number, int decimals, float x, float y, float size, float r, float g, float b, float a); | |
| double math_cos(double x); | |
| double math_sin(double x); | |
| double math_atan2(double x, double y); |
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
| TypeUniformMapping :: struct { | |
| typetype: typeid, | |
| set_uniform: proc(loc: i32, value: rawptr), | |
| } | |
| type_to_uniform_map := map[gl.Uniform_Type]TypeUniformMapping{ | |
| // If we map typeid to Uniform_Type, we could support stuff like array of floats and vec3s | |
| gl.Uniform_Type.FLOAT = {typeid_of(f32), proc(loc: i32, value: rawptr) { | |
| gl.Uniform1f(loc, (cast(^f32)value)^); |
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() { |