-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
45c6718
commit c5cba9a
Showing
4 changed files
with
3,641 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
module github.com/gen2brain/raylib-go/raylib | ||
|
||
go 1.21 | ||
|
||
require ( | ||
github.com/ebitengine/purego v0.5.0 | ||
golang.org/x/sys v0.14.0 | ||
) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
github.com/ebitengine/purego v0.5.0 h1:JrMGKfRIAM4/QVKaesIIT7m/UVjTj5GYhRSQYwfVdpo= | ||
github.com/ebitengine/purego v0.5.0/go.mod h1:ah1In8AOtksoNK6yk5z1HTJeUkC1Ez4Wk2idgGslMwQ= | ||
golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= | ||
golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
//go:build !cgo && windows | ||
// +build !cgo,windows | ||
|
||
package rl | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/ebitengine/purego" | ||
"golang.org/x/sys/windows" | ||
) | ||
|
||
const ( | ||
libname = "raylib.dll" | ||
) | ||
|
||
// loadLibrary loads the raylib dll and panics on error | ||
func loadLibrary() uintptr { | ||
if handle, err := windows.LoadLibrary(libname); err != nil { | ||
panic(fmt.Errorf("cannot load library %s: %w", libname, err)) | ||
} else { | ||
return uintptr(handle) | ||
} | ||
} | ||
|
||
func traceLogCallbackWrapper(fn TraceLogCallbackFun) uintptr { | ||
return purego.NewCallback(func(logLevel int32, text *byte) uintptr { | ||
fn(int(logLevel), windows.BytePtrToString(text)) | ||
return 0 | ||
}) | ||
} |
Oops, something went wrong.