Change of proc and type declaration syntax to "prefix" style

`proc name()` from `name :: proc()`
This commit is contained in:
Ginger Bill
2016-12-18 20:34:55 +00:00
parent 062a2c63e1
commit 5217eb55b4
14 changed files with 437 additions and 421 deletions
+27 -27
View File
@@ -2,37 +2,37 @@
#import win32 "sys/windows.odin" when ODIN_OS == "windows";
#include "opengl_constants.odin";
Clear :: proc(mask: u32) #foreign "glClear"
ClearColor :: proc(r, g, b, a: f32) #foreign "glClearColor"
Begin :: proc(mode: i32) #foreign "glBegin"
End :: proc() #foreign "glEnd"
Finish :: proc() #foreign "glFinish"
BlendFunc :: proc(sfactor, dfactor: i32) #foreign "glBlendFunc"
Enable :: proc(cap: i32) #foreign "glEnable"
Disable :: proc(cap: i32) #foreign "glDisable"
GenTextures :: proc(count: i32, result: ^u32) #foreign "glGenTextures"
DeleteTextures :: proc(count: i32, result: ^u32) #foreign "glDeleteTextures"
TexParameteri :: proc(target, pname, param: i32) #foreign "glTexParameteri"
TexParameterf :: proc(target: i32, pname: i32, param: f32) #foreign "glTexParameterf"
BindTexture :: proc(target: i32, texture: u32) #foreign "glBindTexture"
LoadIdentity :: proc() #foreign "glLoadIdentity"
Viewport :: proc(x, y, width, height: i32) #foreign "glViewport"
Ortho :: proc(left, right, bottom, top, near, far: f64) #foreign "glOrtho"
Color3f :: proc(r, g, b: f32) #foreign "glColor3f"
Vertex3f :: proc(x, y, z: f32) #foreign "glVertex3f"
TexImage2D :: proc(target, level, internal_format,
width, height, border,
format, _type: i32, pixels: rawptr) #foreign "glTexImage2D"
proc Clear (mask: u32) #foreign "glClear"
proc ClearColor (r, g, b, a: f32) #foreign "glClearColor"
proc Begin (mode: i32) #foreign "glBegin"
proc End () #foreign "glEnd"
proc Finish () #foreign "glFinish"
proc BlendFunc (sfactor, dfactor: i32) #foreign "glBlendFunc"
proc Enable (cap: i32) #foreign "glEnable"
proc Disable (cap: i32) #foreign "glDisable"
proc GenTextures (count: i32, result: ^u32) #foreign "glGenTextures"
proc DeleteTextures(count: i32, result: ^u32) #foreign "glDeleteTextures"
proc TexParameteri (target, pname, param: i32) #foreign "glTexParameteri"
proc TexParameterf (target: i32, pname: i32, param: f32) #foreign "glTexParameterf"
proc BindTexture (target: i32, texture: u32) #foreign "glBindTexture"
proc LoadIdentity () #foreign "glLoadIdentity"
proc Viewport (x, y, width, height: i32) #foreign "glViewport"
proc Ortho (left, right, bottom, top, near, far: f64) #foreign "glOrtho"
proc Color3f (r, g, b: f32) #foreign "glColor3f"
proc Vertex3f (x, y, z: f32) #foreign "glVertex3f"
proc TexImage2D (target, level, internal_format,
width, height, border,
format, _type: i32, pixels: rawptr) #foreign "glTexImage2D"
GetError :: proc() -> i32 #foreign "glGetError"
GetString :: proc(name: i32) -> ^byte #foreign "glGetString"
GetIntegerv :: proc(name: i32, v: ^i32) #foreign "glGetIntegerv"
proc GetError () -> i32 #foreign "glGetError"
proc GetString (name: i32) -> ^byte #foreign "glGetString"
proc GetIntegerv(name: i32, v: ^i32) #foreign "glGetIntegerv"
_libgl := win32.LoadLibraryA(("opengl32.dll\x00" as string).data);
GetProcAddress :: proc(name: string) -> proc() {
proc GetProcAddress(name: string) -> proc() {
assert(name[name.count-1] == 0);
res := win32.wglGetProcAddress(name.data);
if res == nil {
@@ -100,8 +100,8 @@ UniformMatrix4fv: proc(loc: i32, count: u32, transpose: i32, value: ^f32);
GetUniformLocation: proc(program: u32, name: ^byte) -> i32;
init :: proc() {
set_proc_address :: proc(p: rawptr, name: string) #inline { (p as ^proc())^ = GetProcAddress(name); }
proc init() {
proc set_proc_address(p: rawptr, name: string) #inline { (p as ^proc())^ = GetProcAddress(name); }
set_proc_address(^GenBuffers, "glGenBuffers\x00");
set_proc_address(^GenVertexArrays, "glGenVertexArrays\x00");