mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-28 18:30:06 +00:00
#foreign_library; vector fields (x, y, z, w) for count <= 4
This commit is contained in:
@@ -47,3 +47,7 @@ TexParameterf :: proc(target: i32, pname: i32, param: f32) #foreign "glTex
|
||||
BindTexture :: proc(target: i32, texture: u32) #foreign "glBindTexture"
|
||||
TexImage2D :: proc(target, level, internal_format, width, height, border, format, _type: i32, pixels: rawptr) #foreign "glTexImage2D"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+6
-6
@@ -56,25 +56,25 @@ stderr := ^__std_files[File_Standard.ERROR]
|
||||
|
||||
|
||||
|
||||
read_entire_file :: proc(name: string) -> (string, bool) {
|
||||
read_entire_file :: proc(name: string) -> ([]byte, bool) {
|
||||
buf: [300]byte
|
||||
copy(buf[:], name as []byte)
|
||||
|
||||
f, file_ok := open(name)
|
||||
if !file_ok {
|
||||
return "", false
|
||||
return nil, false
|
||||
}
|
||||
defer close(^f)
|
||||
|
||||
length: i64
|
||||
file_size_ok := win32.GetFileSizeEx(f.handle as win32.HANDLE, ^length) != 0
|
||||
if !file_size_ok {
|
||||
return "", false
|
||||
return nil, false
|
||||
}
|
||||
|
||||
data := new_slice(u8, length)
|
||||
if data.data == nil {
|
||||
return "", false
|
||||
return nil, false
|
||||
}
|
||||
|
||||
single_read_length: i32
|
||||
@@ -93,13 +93,13 @@ read_entire_file :: proc(name: string) -> (string, bool) {
|
||||
win32.ReadFile(f.handle as win32.HANDLE, ^data[total_read], to_read, ^single_read_length, nil)
|
||||
if single_read_length <= 0 {
|
||||
free(data.data)
|
||||
return "", false
|
||||
return nil, false
|
||||
}
|
||||
|
||||
total_read += single_read_length as i64
|
||||
}
|
||||
|
||||
return data as string, true
|
||||
return data, true
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ HCURSOR :: type HANDLE
|
||||
HMENU :: type HANDLE
|
||||
HBRUSH :: type HANDLE
|
||||
HGDIOBJ :: type HANDLE
|
||||
HMODULE :: type HANDLE
|
||||
WPARAM :: type uint
|
||||
LPARAM :: type int
|
||||
LRESULT :: type int
|
||||
@@ -208,6 +209,9 @@ StretchDIBits :: proc(hdc: HDC,
|
||||
|
||||
|
||||
|
||||
LoadLibraryA :: proc(c_str: ^u8) -> HMODULE #foreign
|
||||
FreeLibrary :: proc(h: HMODULE) #foreign
|
||||
GetProcAddress :: proc(h: HMODULE, c_str: ^u8) -> proc() #foreign
|
||||
|
||||
|
||||
|
||||
@@ -280,6 +284,7 @@ ReleaseDC :: proc(wnd: HWND, hdc: HDC) -> i32 #foreign #dll_import
|
||||
WGL_CONTEXT_MAJOR_VERSION_ARB :: 0x2091
|
||||
WGL_CONTEXT_MINOR_VERSION_ARB :: 0x2092
|
||||
WGL_CONTEXT_PROFILE_MASK_ARB :: 0x9126
|
||||
WGL_CONTEXT_CORE_PROFILE_BIT_ARB :: 0x0001
|
||||
WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB :: 0x0002
|
||||
|
||||
wglCreateContext :: proc(hdc: HDC) -> HGLRC #foreign #dll_import
|
||||
|
||||
Reference in New Issue
Block a user