Move some functions to platform_web.go
This commit is contained in:
parent
1fec9fe2f0
commit
8759f0d9bd
2 changed files with 69 additions and 49 deletions
69
raylib/platform_web.go
Normal file
69
raylib/platform_web.go
Normal file
|
@ -0,0 +1,69 @@
|
|||
// +build js
|
||||
|
||||
package raylib
|
||||
|
||||
import (
|
||||
"os"
|
||||
"unsafe"
|
||||
|
||||
"github.com/gopherjs/gopherjs/js"
|
||||
)
|
||||
|
||||
// InitWindow - Initialize Window and OpenGL Graphics
|
||||
func InitWindow(width int32, height int32, t interface{}) {
|
||||
js.Global.Get("Module").Call("_InitWindow", width, height, t.(string))
|
||||
}
|
||||
|
||||
// SetCallbackFunc - Sets callback function
|
||||
func SetCallbackFunc(func(unsafe.Pointer)) {
|
||||
}
|
||||
|
||||
// SetMainLoop - Sets main loop function
|
||||
func SetMainLoop(fn func(), fps int, infinite bool) {
|
||||
js.Global.Set("_go_update_function", fn)
|
||||
js.Global.Get("Module").Call("_emscripten_set_main_loop_go", fps, infinite)
|
||||
}
|
||||
|
||||
// ShowCursor - Shows cursor
|
||||
func ShowCursor() {
|
||||
}
|
||||
|
||||
// HideCursor - Hides cursor
|
||||
func HideCursor() {
|
||||
}
|
||||
|
||||
// IsCursorHidden - Returns true if cursor is not visible
|
||||
func IsCursorHidden() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// EnableCursor - Enables cursor
|
||||
func EnableCursor() {
|
||||
}
|
||||
|
||||
// DisableCursor - Disables cursor
|
||||
func DisableCursor() {
|
||||
}
|
||||
|
||||
// IsFileDropped - Check if a file have been dropped into window
|
||||
func IsFileDropped() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// GetDroppedFiles - Retrieve dropped files into window
|
||||
func GetDroppedFiles(count *int32) (f []string) {
|
||||
return
|
||||
}
|
||||
|
||||
// ClearDroppedFiles - Clear dropped files paths buffer
|
||||
func ClearDroppedFiles() {
|
||||
}
|
||||
|
||||
// OpenAsset - Open asset
|
||||
func OpenAsset(name string) (Asset, error) {
|
||||
f, err := os.Open(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return f, nil
|
||||
}
|
|
@ -10,55 +10,6 @@ import (
|
|||
"github.com/gopherjs/gopherjs/js"
|
||||
)
|
||||
|
||||
// InitWindow - Initialize Window and OpenGL Graphics
|
||||
func InitWindow(width int32, height int32, t interface{}) {
|
||||
js.Global.Get("Module").Call("_InitWindow", width, height, t.(string))
|
||||
}
|
||||
|
||||
// SetCallbackFunc - Sets callback function
|
||||
func SetCallbackFunc(func(unsafe.Pointer)) {
|
||||
}
|
||||
|
||||
// SetMainLoop - Sets main loop function
|
||||
func SetMainLoop(f func(), fps, simulateInfiniteLoop int) {
|
||||
js.Global.Get("Module").Call("_emscripten_set_main_loop", f, fps, simulateInfiniteLoop)
|
||||
}
|
||||
|
||||
// ShowCursor - Shows cursor
|
||||
func ShowCursor() {
|
||||
}
|
||||
|
||||
// HideCursor - Hides cursor
|
||||
func HideCursor() {
|
||||
}
|
||||
|
||||
// IsCursorHidden - Returns true if cursor is not visible
|
||||
func IsCursorHidden() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// EnableCursor - Enables cursor
|
||||
func EnableCursor() {
|
||||
}
|
||||
|
||||
// DisableCursor - Disables cursor
|
||||
func DisableCursor() {
|
||||
}
|
||||
|
||||
// IsFileDropped - Check if a file have been dropped into window
|
||||
func IsFileDropped() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// GetDroppedFiles - Retrieve dropped files into window
|
||||
func GetDroppedFiles(count *int32) (f []string) {
|
||||
return
|
||||
}
|
||||
|
||||
// ClearDroppedFiles - Clear dropped files paths buffer
|
||||
func ClearDroppedFiles() {
|
||||
}
|
||||
|
||||
// InitAudioDevice - Initialize audio device and context
|
||||
func InitAudioDevice() {
|
||||
js.Global.Get("Module").Call("_InitAudioDevice")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue