This commit is contained in:
gingerBill
2022-03-03 13:54:31 +00:00
59 changed files with 386 additions and 253 deletions
+1
View File
@@ -1,3 +1,4 @@
# These are supported funding model platforms # These are supported funding model platforms
github: odin-lang
patreon: gingerbill patreon: gingerbill
+1 -1
View File
@@ -1,6 +1,6 @@
package crypto package crypto
when ODIN_OS != .Linux && ODIN_OS != .OpenBSD { when ODIN_OS != .Linux && ODIN_OS != .OpenBSD && ODIN_OS != .Windows {
_rand_bytes :: proc (dst: []byte) { _rand_bytes :: proc (dst: []byte) {
unimplemented("crypto: rand_bytes not supported on this OS") unimplemented("crypto: rand_bytes not supported on this OS")
} }
+23
View File
@@ -0,0 +1,23 @@
package crypto
import win32 "core:sys/windows"
import "core:os"
import "core:fmt"
_rand_bytes :: proc(dst: []byte) {
ret := (os.Errno)(win32.BCryptGenRandom(nil, raw_data(dst), u32(len(dst)), win32.BCRYPT_USE_SYSTEM_PREFERRED_RNG))
if ret != os.ERROR_NONE {
switch ret {
case os.ERROR_INVALID_HANDLE:
// The handle to the first parameter is invalid.
// This should not happen here, since we explicitly pass nil to it
panic("crypto: BCryptGenRandom Invalid handle for hAlgorithm")
case os.ERROR_INVALID_PARAMETER:
// One of the parameters was invalid
panic("crypto: BCryptGenRandom Invalid parameter")
case:
// Unknown error
panic(fmt.tprintf("crypto: BCryptGenRandom failed: %d\n", ret))
}
}
}
+22 -6
View File
@@ -605,7 +605,7 @@ fmt_bad_verb :: proc(using fi: ^Info, verb: rune) {
fmt_bool :: proc(using fi: ^Info, b: bool, verb: rune) { fmt_bool :: proc(using fi: ^Info, b: bool, verb: rune) {
switch verb { switch verb {
case 't', 'v': case 't', 'v':
io.write_string(writer, b ? "true" : "false", &fi.n) fmt_string(fi, b ? "true" : "false", 's')
case: case:
fmt_bad_verb(fi, verb) fmt_bad_verb(fi, verb)
} }
@@ -943,11 +943,27 @@ fmt_float :: proc(fi: ^Info, v: f64, bit_size: int, verb: rune) {
fmt_string :: proc(fi: ^Info, s: string, verb: rune) { fmt_string :: proc(fi: ^Info, s: string, verb: rune) {
switch verb { switch verb {
case 's', 'v': case 's', 'v':
io.write_string(fi.writer, s, &fi.n) if fi.width_set {
if fi.width_set && len(s) < fi.width { if fi.width > len(s) {
for _ in 0..<fi.width - len(s) { if fi.minus {
io.write_byte(fi.writer, ' ', &fi.n) io.write_string(fi.writer, s, &fi.n)
}
for _ in 0..<fi.width - len(s) {
io.write_byte(fi.writer, ' ', &fi.n)
}
if !fi.minus {
io.write_string(fi.writer, s, &fi.n)
}
} }
else {
io.write_string(fi.writer, s[:fi.width], &fi.n)
}
}
else
{
io.write_string(fi.writer, s, &fi.n)
} }
case 'q': // quoted string case 'q': // quoted string
@@ -1058,7 +1074,7 @@ fmt_enum :: proc(fi: ^Info, v: any, verb: rune) {
fmt_arg(fi, any{v.data, runtime.type_info_base(e.base).id}, verb) fmt_arg(fi, any{v.data, runtime.type_info_base(e.base).id}, verb)
case 's', 'v': case 's', 'v':
if str, ok := enum_value_to_string(v); ok { if str, ok := enum_value_to_string(v); ok {
io.write_string(fi.writer, str, &fi.n) fmt_string(fi, str, 's')
} else { } else {
io.write_string(fi.writer, "%!(BAD ENUM VALUE=", &fi.n) io.write_string(fi.writer, "%!(BAD ENUM VALUE=", &fi.n)
fmt_arg(fi, any{v.data, runtime.type_info_base(e.base).id}, 'i') fmt_arg(fi, any{v.data, runtime.type_info_base(e.base).id}, 'i')
-21
View File
@@ -1,4 +1,3 @@
//+build windows
package all package all
import botan "vendor:botan" import botan "vendor:botan"
@@ -16,24 +15,12 @@ import IMG "vendor:sdl2/image"
import MIX "vendor:sdl2/mixer" import MIX "vendor:sdl2/mixer"
import TTF "vendor:sdl2/ttf" import TTF "vendor:sdl2/ttf"
import stb_easy_font "vendor:stb/easy_font"
import stbi "vendor:stb/image"
import stbrp "vendor:stb/rect_pack"
import stbtt "vendor:stb/truetype"
import stb_vorbis "vendor:stb/vorbis"
import vk "vendor:vulkan" import vk "vendor:vulkan"
import D3D11 "vendor:directx/d3d11"
import D3D12 "vendor:directx/d3d12"
import DXGI "vendor:directx/dxgi"
// note these are technicaly darwin only but they are added to aid with documentation generation
import NS "vendor:darwin/Foundation" import NS "vendor:darwin/Foundation"
import MTL "vendor:darwin/Metal" import MTL "vendor:darwin/Metal"
import CA "vendor:darwin/QuartzCore" import CA "vendor:darwin/QuartzCore"
_ :: botan _ :: botan
_ :: ENet _ :: ENet
_ :: gl _ :: gl
@@ -47,15 +34,7 @@ _ :: SDLNet
_ :: IMG _ :: IMG
_ :: MIX _ :: MIX
_ :: TTF _ :: TTF
_ :: stb_easy_font
_ :: stbi
_ :: stbrp
_ :: stbtt
_ :: stb_vorbis
_ :: vk _ :: vk
_ :: D3D11
_ :: D3D12
_ :: DXGI
_ :: NS _ :: NS
_ :: MTL _ :: MTL
_ :: CA _ :: CA
+10
View File
@@ -0,0 +1,10 @@
//+build windows
package all
import D3D11 "vendor:directx/d3d11"
import D3D12 "vendor:directx/d3d12"
import DXGI "vendor:directx/dxgi"
_ :: D3D11
_ :: D3D12
_ :: DXGI
+15
View File
@@ -0,0 +1,15 @@
//+build windows, linux
package all
import stb_easy_font "vendor:stb/easy_font"
import stbi "vendor:stb/image"
import stbrp "vendor:stb/rect_pack"
import stbtt "vendor:stb/truetype"
import stb_vorbis "vendor:stb/vorbis"
_ :: stb_easy_font
_ :: stbi
_ :: stbrp
_ :: stbtt
_ :: stb_vorbis
+2 -2
View File
@@ -1,4 +1,4 @@
//+build linux, darwin, freebsd //+build linux, darwin, freebsd, openbsd
package ENet package ENet
// When we implement the appropriate bindings for Unix, the section separated // When we implement the appropriate bindings for Unix, the section separated
@@ -14,7 +14,7 @@ import "core:c"
@(private="file") FD_ZERO :: #force_inline proc(s: ^fd_set) { @(private="file") FD_ZERO :: #force_inline proc(s: ^fd_set) {
for i := size_of(fd_set) / size_of(c.long); i != 0; i -= 1 { for i := size_of(fd_set) / size_of(c.long); i != 0; i -= 1 {
s.fds_bits[i] = 0; s.fds_bits[i] = 0
} }
} }
+1 -5
View File
@@ -142,11 +142,7 @@ fpe_t :: ^fpe_struct
when ODIN_OS == .Windows { when ODIN_OS == .Windows {
foreign import botan_lib "botan.lib" foreign import botan_lib "botan.lib"
} else when ODIN_OS == .Linux { } else {
foreign import botan_lib "system:botan-2"
} else when ODIN_OS == .Darwin {
foreign import botan_lib "system:botan-2"
} else when ODIN_OS == .OpenBSD {
foreign import botan_lib "system:botan-2" foreign import botan_lib "system:botan-2"
} }
+5 -2
View File
@@ -3,8 +3,6 @@ package glfw_bindings
import "core:c" import "core:c"
import vk "vendor:vulkan" import vk "vendor:vulkan"
when ODIN_OS == .Linux { foreign import glfw "system:glfw" } // TODO: Add the billion-or-so static libs to link to in linux
when ODIN_OS == .Darwin { foreign import glfw "system:glfw" }
when ODIN_OS == .Windows { when ODIN_OS == .Windows {
foreign import glfw { foreign import glfw {
"../lib/glfw3_mt.lib", "../lib/glfw3_mt.lib",
@@ -12,6 +10,11 @@ when ODIN_OS == .Windows {
"system:gdi32.lib", "system:gdi32.lib",
"system:shell32.lib", "system:shell32.lib",
} }
} else when ODIN_OS == .Linux {
// TODO: Add the billion-or-so static libs to link to in linux
foreign import glfw "system:glfw"
} else {
foreign import glfw "system:glfw"
} }
#assert(size_of(c.int) == size_of(b32)) #assert(size_of(c.int) == size_of(b32))
+7 -2
View File
@@ -2,8 +2,13 @@ package miniaudio
import "core:c" import "core:c"
when ODIN_OS == .Windows { foreign import lib "lib/miniaudio.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "lib/miniaudio.a" } foreign import lib "lib/miniaudio.lib"
} else when ODIN_OS == .Linux {
foreign import lib "lib/miniaudio.a"
} else {
foreign import lib "system:miniaudio"
}
handle :: distinct rawptr handle :: distinct rawptr
+7 -3
View File
@@ -2,9 +2,13 @@ package miniaudio
import "core:c" import "core:c"
when ODIN_OS == .Windows { foreign import lib "lib/miniaudio.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "lib/miniaudio.a" } foreign import lib "lib/miniaudio.lib"
} else when ODIN_OS == .Linux {
foreign import lib "lib/miniaudio.a"
} else {
foreign import lib "system:miniaudio"
}
/************************************************************************************************************************************************************ /************************************************************************************************************************************************************
************************************************************************************************************************************************************* *************************************************************************************************************************************************************
+7 -4
View File
@@ -2,10 +2,13 @@ package miniaudio
import "core:c" import "core:c"
when ODIN_OS == .Windows { foreign import lib "lib/miniaudio.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "lib/miniaudio.a" } foreign import lib "lib/miniaudio.lib"
} else when ODIN_OS == .Linux {
foreign import lib "lib/miniaudio.a"
} else {
foreign import lib "system:miniaudio"
}
/************************************************************************************************************************************************************ /************************************************************************************************************************************************************
+7 -2
View File
@@ -1,7 +1,12 @@
package miniaudio package miniaudio
when ODIN_OS == .Windows { foreign import lib "lib/miniaudio.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "lib/miniaudio.a" } foreign import lib "lib/miniaudio.lib"
} else when ODIN_OS == .Linux {
foreign import lib "lib/miniaudio.a"
} else {
foreign import lib "system:miniaudio"
}
import "core:c" import "core:c"
+4 -4
View File
@@ -6,7 +6,7 @@ SUPPORT_WASAPI :: ODIN_OS == .Windows
SUPPORT_DSOUND :: ODIN_OS == .Windows SUPPORT_DSOUND :: ODIN_OS == .Windows
SUPPORT_WINMM :: ODIN_OS == .Windows SUPPORT_WINMM :: ODIN_OS == .Windows
SUPPORT_COREAUDIO :: ODIN_OS == .Darwin SUPPORT_COREAUDIO :: ODIN_OS == .Darwin
SUPPORT_SNDIO :: false // ODIN_OS == .OpenBSD SUPPORT_SNDIO :: ODIN_OS == .OpenBSD
SUPPORT_AUDIO4 :: false // ODIN_OS == .OpenBSD || ODIN_OS == .NetBSD SUPPORT_AUDIO4 :: false // ODIN_OS == .OpenBSD || ODIN_OS == .NetBSD
SUPPORT_OSS :: ODIN_OS == .FreeBSD SUPPORT_OSS :: ODIN_OS == .FreeBSD
SUPPORT_PULSEAUDIO :: ODIN_OS == .Linux SUPPORT_PULSEAUDIO :: ODIN_OS == .Linux
@@ -739,8 +739,8 @@ context_type :: struct {
pa_stream_writable_size: proc "system" (), pa_stream_writable_size: proc "system" (),
pa_stream_readable_size: proc "system" (), pa_stream_readable_size: proc "system" (),
/*pa_mainloop**/ pMainLoop: ptr, /*pa_mainloop**/ pMainLoop: rawptr,
/*pa_context**/ pPulseContext: ptr, /*pa_context**/ pPulseContext: rawptr,
} when SUPPORT_PULSEAUDIO else struct {}), } when SUPPORT_PULSEAUDIO else struct {}),
jack: (struct { jack: (struct {
@@ -791,7 +791,7 @@ context_type :: struct {
AudioUnitInitialize: proc "system" (), AudioUnitInitialize: proc "system" (),
AudioUnitRender: proc "system" (), AudioUnitRender: proc "system" (),
/*AudioComponent*/ component: ptr, /*AudioComponent*/ component: rawptr,
noAudioSessionDeactivate: b32, /* For tracking whether or not the iOS audio session should be explicitly deactivated. Set from the config in ma_context_init__coreaudio(). */ noAudioSessionDeactivate: b32, /* For tracking whether or not the iOS audio session should be explicitly deactivated. Set from the config in ma_context_init__coreaudio(). */
} when SUPPORT_COREAUDIO else struct {}), } when SUPPORT_COREAUDIO else struct {}),
+7 -2
View File
@@ -2,8 +2,13 @@ package miniaudio
import "core:c" import "core:c"
when ODIN_OS == .Windows { foreign import lib "lib/miniaudio.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "lib/miniaudio.a" } foreign import lib "lib/miniaudio.lib"
} else when ODIN_OS == .Linux {
foreign import lib "lib/miniaudio.a"
} else {
foreign import lib "system:miniaudio"
}
/************************************************************************************************************************************************************ /************************************************************************************************************************************************************
+7 -2
View File
@@ -1,7 +1,12 @@
package miniaudio package miniaudio
when ODIN_OS == .Windows { foreign import lib "lib/miniaudio.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "lib/miniaudio.a" } foreign import lib "lib/miniaudio.lib"
} else when ODIN_OS == .Linux {
foreign import lib "lib/miniaudio.a"
} else {
foreign import lib "system:miniaudio"
}
/************************************************************************************************************************************************************** /**************************************************************************************************************************************************************
+7 -2
View File
@@ -2,8 +2,13 @@ package miniaudio
import "core:c" import "core:c"
when ODIN_OS == .Windows { foreign import lib "lib/miniaudio.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "lib/miniaudio.a" } foreign import lib "lib/miniaudio.lib"
} else when ODIN_OS == .Linux {
foreign import lib "lib/miniaudio.a"
} else {
foreign import lib "system:miniaudio"
}
waveform_type :: enum c.int { waveform_type :: enum c.int {
sine, sine,
+7 -2
View File
@@ -2,8 +2,13 @@ package miniaudio
import c "core:c/libc" import c "core:c/libc"
when ODIN_OS == .Windows { foreign import lib "lib/miniaudio.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "lib/miniaudio.a" } foreign import lib "lib/miniaudio.lib"
} else when ODIN_OS == .Linux {
foreign import lib "lib/miniaudio.a"
} else {
foreign import lib "system:miniaudio"
}
MAX_LOG_CALLBACKS :: 4 MAX_LOG_CALLBACKS :: 4
+3 -3
View File
@@ -1,6 +1,6 @@
all: all:
mkdir -p ../lib mkdir -p ../lib
gcc -c -O2 -Os -fPIC miniaudio.c $(CC) -c -O2 -Os -fPIC miniaudio.c
ar rcs ../lib/miniaudio.a miniaudio.o $(AR) rcs ../lib/miniaudio.a miniaudio.o
#gcc -fPIC -shared -Wl,-soname=miniaudio.so -o ../lib/miniaudio.so miniaudio.o #$(CC) -fPIC -shared -Wl,-soname=miniaudio.so -o ../lib/miniaudio.so miniaudio.o
rm *.o rm *.o
+7 -2
View File
@@ -1,7 +1,12 @@
package miniaudio package miniaudio
when ODIN_OS == .Windows { foreign import lib "lib/miniaudio.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "lib/miniaudio.a" } foreign import lib "lib/miniaudio.lib"
} else when ODIN_OS == .Linux {
foreign import lib "lib/miniaudio.a"
} else {
foreign import lib "system:miniaudio"
}
@(default_calling_convention="c", link_prefix="ma_") @(default_calling_convention="c", link_prefix="ma_")
foreign lib { foreign lib {
+7 -2
View File
@@ -2,8 +2,13 @@ package miniaudio
import "core:c" import "core:c"
when ODIN_OS == .Windows { foreign import lib "lib/miniaudio.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "lib/miniaudio.a" } foreign import lib "lib/miniaudio.lib"
} else when ODIN_OS == .Linux {
foreign import lib "lib/miniaudio.a"
} else {
foreign import lib "system:miniaudio"
}
/************************************************************************************************************************************************************ /************************************************************************************************************************************************************
+2
View File
@@ -9,6 +9,8 @@ when ODIN_OS == .Windows {
"system:Winmm.lib", "system:Winmm.lib",
"system:Advapi32.lib", "system:Advapi32.lib",
} }
} else {
foreign import lib "system:portmidi"
} }
#assert(size_of(b32) == size_of(c.int)) #assert(size_of(b32) == size_of(c.int))
+5 -1
View File
@@ -7,7 +7,11 @@ package portmidi
import "core:c" import "core:c"
when ODIN_OS == .Windows { foreign import lib "portmidi_s.lib" } when ODIN_OS == .Windows {
foreign import lib "portmidi_s.lib"
} else {
foreign import lib "system:portmidi"
}
Queue :: distinct rawptr Queue :: distinct rawptr
+7 -5
View File
@@ -99,15 +99,17 @@ when ODIN_OS == .Windows {
"system:User32.lib", "system:User32.lib",
"system:Shell32.lib", "system:Shell32.lib",
} }
} } else when ODIN_OS == .Linux {
when ODIN_OS == .Linux {
foreign import lib { foreign import lib {
"linux/libraylib.a", "linux/libraylib.a",
"system:dl", "system:dl",
"system:pthread", "system:pthread",
} }
} else when ODIN_OS == .Darwin {
foreign import lib "macos/libraylib.a"
} else {
foreign import lib "system:raylib"
} }
when ODIN_OS == .Darwin { foreign import lib "macos/libraylib.a" }
VERSION :: "4.0" VERSION :: "4.0"
@@ -1150,9 +1152,9 @@ foreign lib {
DrawRectangleGradientH :: proc(posX, posY, width, height: c.int, color1: Color, color2: Color) --- // Draw a horizontal-gradient-filled rectangle DrawRectangleGradientH :: proc(posX, posY, width, height: c.int, color1: Color, color2: Color) --- // Draw a horizontal-gradient-filled rectangle
DrawRectangleGradientEx :: proc(rec: Rectangle, col1, col2, col3, col4: Color) --- // Draw a gradient-filled rectangle with custom vertex colors DrawRectangleGradientEx :: proc(rec: Rectangle, col1, col2, col3, col4: Color) --- // Draw a gradient-filled rectangle with custom vertex colors
DrawRectangleLines :: proc(posX, posY, width, height: c.int, color: Color) --- // Draw rectangle outline DrawRectangleLines :: proc(posX, posY, width, height: c.int, color: Color) --- // Draw rectangle outline
DrawRectangleLinesEx :: proc(rec: Rectangle, lineThick: c.int, color: Color) --- // Draw rectangle outline with extended parameters DrawRectangleLinesEx :: proc(rec: Rectangle, lineThick: f32, color: Color) --- // Draw rectangle outline with extended parameters
DrawRectangleRounded :: proc(rec: Rectangle, roundness: f32, segments: c.int, color: Color) --- // Draw rectangle with rounded edges DrawRectangleRounded :: proc(rec: Rectangle, roundness: f32, segments: c.int, color: Color) --- // Draw rectangle with rounded edges
DrawRectangleRoundedLines :: proc(rec: Rectangle, roundness: f32, segments: c.int, lineThick: c.int, color: Color) --- // Draw rectangle with rounded edges outline DrawRectangleRoundedLines :: proc(rec: Rectangle, roundness: f32, segments: c.int, lineThick: f32, color: Color) --- // Draw rectangle with rounded edges outline
DrawTriangle :: proc(v1, v2, v3: Vector2, color: Color) --- // Draw a color-filled triangle (vertex in counter-clockwise order!) DrawTriangle :: proc(v1, v2, v3: Vector2, color: Color) --- // Draw a color-filled triangle (vertex in counter-clockwise order!)
DrawTriangleLines :: proc(v1, v2, v3: Vector2, color: Color) --- // Draw triangle outline (vertex in counter-clockwise order!) DrawTriangleLines :: proc(v1, v2, v3: Vector2, color: Color) --- // Draw triangle outline (vertex in counter-clockwise order!)
DrawTriangleFan :: proc(points: [^]Vector2, pointsCount: c.int, color: Color) --- // Draw a triangle fan defined by points (first vertex is the center) DrawTriangleFan :: proc(points: [^]Vector2, pointsCount: c.int, color: Color) --- // Draw a triangle fan defined by points (first vertex is the center)
+6 -2
View File
@@ -10,9 +10,13 @@ when ODIN_OS == .Windows {
"system:User32.lib", "system:User32.lib",
"system:Shell32.lib", "system:Shell32.lib",
} }
} else when ODIN_OS == .Linux {
foreign import lib "linux/libraylib.a"
} else when ODIN_OS == .Darwin {
foreign import lib "macos/libraylib.a"
} else {
foreign import lib "system:raylib"
} }
when ODIN_OS == .Linux { foreign import lib "linux/libraylib.a" }
when ODIN_OS == .Darwin { foreign import lib "macos/libraylib.a" }
GRAPHICS_API_OPENGL_11 :: false GRAPHICS_API_OPENGL_11 :: false
GRAPHICS_API_OPENGL_21 :: true GRAPHICS_API_OPENGL_21 :: true
+5 -4
View File
@@ -3,10 +3,11 @@ package sdl2_image
import "core:c" import "core:c"
import SDL ".." import SDL ".."
when ODIN_OS == .Windows { foreign import lib "SDL2_image.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "system:SDL2_image" } foreign import lib "SDL2_image.lib"
when ODIN_OS == .Darwin { foreign import lib "system:SDL2_image" } } else {
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2_image" } foreign import lib "system:SDL2_image"
}
bool :: SDL.bool bool :: SDL.bool
+5 -5
View File
@@ -3,11 +3,11 @@ package sdl2_mixer
import "core:c" import "core:c"
import SDL ".." import SDL ".."
when ODIN_OS == .Windows { foreign import lib "SDL2_mixer.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "system:SDL2_mixer" } foreign import lib "SDL2_mixer.lib"
when ODIN_OS == .Darwin { foreign import lib "system:SDL2_mixer" } } else {
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2_mixer" } foreign import lib "system:SDL2_mixer"
}
MAJOR_VERSION :: 2 MAJOR_VERSION :: 2
MINOR_VERSION :: 0 MINOR_VERSION :: 0
+5 -4
View File
@@ -3,10 +3,11 @@ package sdl2_net
import "core:c" import "core:c"
import SDL ".." import SDL ".."
when ODIN_OS == .Windows { foreign import lib "SDL2_net.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "system:SDL2_net" } foreign import lib "SDL2_net.lib"
when ODIN_OS == .Darwin { foreign import lib "system:SDL2_net" } } else {
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2_net" } foreign import lib "system:SDL2_net"
}
bool :: SDL.bool bool :: SDL.bool
+5 -4
View File
@@ -25,10 +25,11 @@ package sdl2
import "core:c" import "core:c"
import "core:intrinsics" import "core:intrinsics"
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "system:SDL2" } foreign import lib "SDL2.lib"
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" } } else {
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" } foreign import lib "system:SDL2"
}
version :: struct { version :: struct {
major: u8, /**< major version */ major: u8, /**< major version */
+5 -4
View File
@@ -2,10 +2,11 @@ package sdl2
import "core:c" import "core:c"
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "system:SDL2" } foreign import lib "SDL2.lib"
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" } } else {
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" } foreign import lib "system:SDL2"
}
/** /**
* \brief Audio format flags. * \brief Audio format flags.
+5 -4
View File
@@ -2,10 +2,11 @@ package sdl2
import "core:c" import "core:c"
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "system:SDL2" } foreign import lib "SDL2.lib"
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" } } else {
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" } foreign import lib "system:SDL2"
}
/** /**
* \brief The blend mode used in SDL_RenderCopy() and drawing operations. * \brief The blend mode used in SDL_RenderCopy() and drawing operations.
+5 -4
View File
@@ -2,10 +2,11 @@ package sdl2
import "core:c" import "core:c"
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "system:SDL2" } foreign import lib "SDL2.lib"
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" } } else {
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" } foreign import lib "system:SDL2"
}
/* This is a guess for the cacheline size used for padding. /* This is a guess for the cacheline size used for padding.
* Most x86 processors have a 64 byte cache line. * Most x86 processors have a 64 byte cache line.
+5 -4
View File
@@ -2,10 +2,11 @@ package sdl2
import "core:c" import "core:c"
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "system:SDL2" } foreign import lib "SDL2.lib"
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" } } else {
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" } foreign import lib "system:SDL2"
}
RELEASED :: 0 RELEASED :: 0
PRESSED :: 1 PRESSED :: 1
+5 -4
View File
@@ -2,10 +2,11 @@ package sdl2
import "core:c" import "core:c"
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "system:SDL2" } foreign import lib "SDL2.lib"
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" } } else {
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" } foreign import lib "system:SDL2"
}
GameController :: struct {} GameController :: struct {}
+5 -4
View File
@@ -2,10 +2,11 @@ package sdl2
import "core:c" import "core:c"
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "system:SDL2" } foreign import lib "SDL2.lib"
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" } } else {
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" } foreign import lib "system:SDL2"
}
// Gesture // Gesture
+5 -4
View File
@@ -2,10 +2,11 @@ package sdl2
import "core:c" import "core:c"
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "system:SDL2" } foreign import lib "SDL2.lib"
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" } } else {
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" } foreign import lib "system:SDL2"
}
HINT_ACCELEROMETER_AS_JOYSTICK :: "SDL_ACCELEROMETER_AS_JOYSTICK" HINT_ACCELEROMETER_AS_JOYSTICK :: "SDL_ACCELEROMETER_AS_JOYSTICK"
HINT_ALLOW_ALT_TAB_WHILE_GRABBED :: "SDL_ALLOW_ALT_TAB_WHILE_GRABBED" HINT_ALLOW_ALT_TAB_WHILE_GRABBED :: "SDL_ALLOW_ALT_TAB_WHILE_GRABBED"
+5 -4
View File
@@ -2,10 +2,11 @@ package sdl2
import "core:c" import "core:c"
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "system:SDL2" } foreign import lib "SDL2.lib"
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" } } else {
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" } foreign import lib "system:SDL2"
}
Joystick :: struct {} Joystick :: struct {}
+5 -4
View File
@@ -2,10 +2,11 @@ package sdl2
import "core:c" import "core:c"
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "system:SDL2" } foreign import lib "SDL2.lib"
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" } } else {
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" } foreign import lib "system:SDL2"
}
Keysym :: struct { Keysym :: struct {
scancode: Scancode, /**< SDL physical key code - see ::SDL_Scancode for details */ scancode: Scancode, /**< SDL physical key code - see ::SDL_Scancode for details */
+5 -4
View File
@@ -2,10 +2,11 @@ package sdl2
import "core:c" import "core:c"
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "system:SDL2" } foreign import lib "SDL2.lib"
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" } } else {
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" } foreign import lib "system:SDL2"
}
MAX_LOG_MESSAGE :: 4096 MAX_LOG_MESSAGE :: 4096
+5 -4
View File
@@ -2,10 +2,11 @@ package sdl2
import "core:c" import "core:c"
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "system:SDL2" } foreign import lib "SDL2.lib"
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" } } else {
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" } foreign import lib "system:SDL2"
}
MessageBoxFlag :: enum u32 { MessageBoxFlag :: enum u32 {
_ = 0, _ = 0,
+5 -4
View File
@@ -2,10 +2,11 @@ package sdl2
import "core:c" import "core:c"
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "system:SDL2" } foreign import lib "SDL2.lib"
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" } } else {
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" } foreign import lib "system:SDL2"
}
MetalView :: distinct rawptr MetalView :: distinct rawptr
+5 -4
View File
@@ -2,10 +2,11 @@ package sdl2
import "core:c" import "core:c"
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "system:SDL2" } foreign import lib "SDL2.lib"
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" } } else {
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" } foreign import lib "system:SDL2"
}
Cursor :: struct {} Cursor :: struct {}
+5 -4
View File
@@ -2,10 +2,11 @@ package sdl2
import "core:c" import "core:c"
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "system:SDL2" } foreign import lib "SDL2.lib"
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" } } else {
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" } foreign import lib "system:SDL2"
}
MUTEX_TIMEDOUT :: 1 MUTEX_TIMEDOUT :: 1
MUTEX_MAXWAIT :: ~u32(0) MUTEX_MAXWAIT :: ~u32(0)
+5 -4
View File
@@ -2,10 +2,11 @@ package sdl2
import "core:c" import "core:c"
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "system:SDL2" } foreign import lib "SDL2.lib"
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" } } else {
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" } foreign import lib "system:SDL2"
}
ALPHA_OPAQUE :: 255 ALPHA_OPAQUE :: 255
ALPHA_TRANSPARENT :: 0 ALPHA_TRANSPARENT :: 0
+5 -4
View File
@@ -2,10 +2,11 @@ package sdl2
import "core:c" import "core:c"
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "system:SDL2" } foreign import lib "SDL2.lib"
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" } } else {
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" } foreign import lib "system:SDL2"
}
Point :: struct { Point :: struct {
x: c.int, x: c.int,
+5 -4
View File
@@ -2,10 +2,11 @@ package sdl2
import "core:c" import "core:c"
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "system:SDL2" } foreign import lib "SDL2.lib"
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" } } else {
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" } foreign import lib "system:SDL2"
}
RendererFlag :: enum u32 { RendererFlag :: enum u32 {
SOFTWARE = 0, /**< The renderer is a software fallback */ SOFTWARE = 0, /**< The renderer is a software fallback */
+5 -4
View File
@@ -2,10 +2,11 @@ package sdl2
import "core:c" import "core:c"
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "system:SDL2" } foreign import lib "SDL2.lib"
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" } } else {
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" } foreign import lib "system:SDL2"
}
/* RWops Types */ /* RWops Types */
RWOPS_UNKNOWN :: 0 /**< Unknown stream type */ RWOPS_UNKNOWN :: 0 /**< Unknown stream type */
+5 -4
View File
@@ -5,10 +5,11 @@ import "core:intrinsics"
import "core:runtime" import "core:runtime"
_, _ :: intrinsics, runtime _, _ :: intrinsics, runtime
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "system:SDL2" } foreign import lib "SDL2.lib"
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" } } else {
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" } foreign import lib "system:SDL2"
}
bool :: distinct b32 bool :: distinct b32
#assert(size_of(bool) == size_of(c.int)) #assert(size_of(bool) == size_of(c.int))
+5 -4
View File
@@ -2,10 +2,11 @@ package sdl2
import "core:c" import "core:c"
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "system:SDL2" } foreign import lib "SDL2.lib"
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" } } else {
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" } foreign import lib "system:SDL2"
}
SWSURFACE :: 0 /**< Just here for compatibility */ SWSURFACE :: 0 /**< Just here for compatibility */
PREALLOC :: 0x00000001 /**< Surface uses preallocated memory */ PREALLOC :: 0x00000001 /**< Surface uses preallocated memory */
+5 -4
View File
@@ -2,10 +2,11 @@ package sdl2
import "core:c" import "core:c"
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "system:SDL2" } foreign import lib "SDL2.lib"
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" } } else {
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" } foreign import lib "system:SDL2"
}
// General // General
@(default_calling_convention="c", link_prefix="SDL_") @(default_calling_convention="c", link_prefix="SDL_")
+5 -4
View File
@@ -2,10 +2,11 @@ package sdl2
import "core:c" import "core:c"
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "system:SDL2" } foreign import lib "SDL2.lib"
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" } } else {
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" } foreign import lib "system:SDL2"
}
SYSWM_TYPE :: enum c.int { SYSWM_TYPE :: enum c.int {
UNKNOWN, UNKNOWN,
+5 -4
View File
@@ -2,10 +2,11 @@ package sdl2
import "core:c" import "core:c"
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "system:SDL2" } foreign import lib "SDL2.lib"
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" } } else {
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" } foreign import lib "system:SDL2"
}
Thread :: struct {} Thread :: struct {}
+5 -4
View File
@@ -2,10 +2,11 @@ package sdl2
import "core:c" import "core:c"
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "system:SDL2" } foreign import lib "SDL2.lib"
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" } } else {
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" } foreign import lib "system:SDL2"
}
TimerCallback :: proc "c" (interval: u32, param: rawptr) -> u32 TimerCallback :: proc "c" (interval: u32, param: rawptr) -> u32
TimerID :: distinct c.int TimerID :: distinct c.int
+5 -4
View File
@@ -2,10 +2,11 @@ package sdl2
import "core:c" import "core:c"
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "system:SDL2" } foreign import lib "SDL2.lib"
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" } } else {
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" } foreign import lib "system:SDL2"
}
TouchID :: distinct i64 TouchID :: distinct i64
FingerID :: distinct i64 FingerID :: distinct i64
+5 -4
View File
@@ -2,10 +2,11 @@ package sdl2
import "core:c" import "core:c"
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "system:SDL2" } foreign import lib "SDL2.lib"
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" } } else {
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" } foreign import lib "system:SDL2"
}
DisplayMode :: struct { DisplayMode :: struct {
format: u32, /**< pixel format */ format: u32, /**< pixel format */
+5 -4
View File
@@ -3,10 +3,11 @@ package sdl2
import "core:c" import "core:c"
import vk "vendor:vulkan" import vk "vendor:vulkan"
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "system:SDL2" } foreign import lib "SDL2.lib"
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" } } else {
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" } foreign import lib "system:SDL2"
}
VkInstance :: vk.Instance VkInstance :: vk.Instance
VkSurfaceKHR :: vk.SurfaceKHR VkSurfaceKHR :: vk.SurfaceKHR
+5 -4
View File
@@ -3,10 +3,11 @@ package sdl2_ttf
import "core:c" import "core:c"
import SDL ".." import SDL ".."
when ODIN_OS == .Windows { foreign import lib "SDL2_ttf.lib" } when ODIN_OS == .Windows {
when ODIN_OS == .Linux { foreign import lib "system:SDL2_ttf" } foreign import lib "SDL2_ttf.lib"
when ODIN_OS == .Darwin { foreign import lib "system:SDL2_ttf" } } else {
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2_ttf" } foreign import lib "system:SDL2_ttf"
}
bool :: SDL.bool bool :: SDL.bool
+13 -13
View File
@@ -1,16 +1,16 @@
all: all:
mkdir -p ../lib mkdir -p ../lib
gcc -c -O2 -Os -fPIC stb_image.c stb_image_write.c stb_image_resize.c stb_truetype.c stb_rect_pack.c stb_vorbis.c $(CC) -c -O2 -Os -fPIC stb_image.c stb_image_write.c stb_image_resize.c stb_truetype.c stb_rect_pack.c stb_vorbis.c
ar rcs ../lib/stb_image.a stb_image.o $(AR) rcs ../lib/stb_image.a stb_image.o
ar rcs ../lib/stb_image_write.a stb_image_write.o $(AR) rcs ../lib/stb_image_write.a stb_image_write.o
ar rcs ../lib/stb_image_resize.a stb_image_resize.o $(AR) rcs ../lib/stb_image_resize.a stb_image_resize.o
ar rcs ../lib/stb_truetype.a stb_truetype.o $(AR) rcs ../lib/stb_truetype.a stb_truetype.o
ar rcs ../lib/stb_rect_pack.a stb_rect_pack.o $(AR) rcs ../lib/stb_rect_pack.a stb_rect_pack.o
#ar rcs ../lib/stb_vorbis_pack.a stb_vorbis_pack.o #$(AR) rcs ../lib/stb_vorbis_pack.a stb_vorbis_pack.o
#gcc -fPIC -shared -Wl,-soname=stb_image.so -o ../lib/stb_image.so stb_image.o #$(CC) -fPIC -shared -Wl,-soname=stb_image.so -o ../lib/stb_image.so stb_image.o
#gcc -fPIC -shared -Wl,-soname=stb_image_write.so -o ../lib/stb_image_write.so stb_image_write.o #$(CC) -fPIC -shared -Wl,-soname=stb_image_write.so -o ../lib/stb_image_write.so stb_image_write.o
#gcc -fPIC -shared -Wl,-soname=stb_image_resize.so -o ../lib/stb_image_resize.so stb_image_resize.o #$(CC) -fPIC -shared -Wl,-soname=stb_image_resize.so -o ../lib/stb_image_resize.so stb_image_resize.o
#gcc -fPIC -shared -Wl,-soname=stb_truetype.so -o ../lib/stb_truetype.so stb_image_truetype.o #$(CC) -fPIC -shared -Wl,-soname=stb_truetype.so -o ../lib/stb_truetype.so stb_image_truetype.o
#gcc -fPIC -shared -Wl,-soname=stb_rect_pack.so -o ../lib/stb_rect_pack.so stb_rect_packl.o #$(CC) -fPIC -shared -Wl,-soname=stb_rect_pack.so -o ../lib/stb_rect_pack.so stb_rect_packl.o
#gcc -fPIC -shared -Wl,-soname=stb_vorbis.so -o ../lib/stb_vorbis.so stb_vorbisl.o #$(CC) -fPIC -shared -Wl,-soname=stb_vorbis.so -o ../lib/stb_vorbis.so stb_vorbisl.o
rm *.o rm *.o