-
Notifications
You must be signed in to change notification settings - Fork 146
/
platform_desktop.go
102 lines (79 loc) · 1.81 KB
/
platform_desktop.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
//go:build !rgfw && !sdl && !drm && !android
// +build !rgfw,!sdl,!drm,!android
package rl
/*
#include "raylib.h"
#include <stdlib.h>
*/
import "C"
import (
"os"
"unsafe"
)
// InitWindow - Initialize Window and OpenGL Graphics
func InitWindow(width int32, height int32, title string) {
cwidth := (C.int)(width)
cheight := (C.int)(height)
ctitle := C.CString(title)
defer C.free(unsafe.Pointer(ctitle))
C.InitWindow(cwidth, cheight, ctitle)
}
// SetCallbackFunc - Sets callback function
func SetCallbackFunc(func()) {
}
// ShowCursor - Shows cursor
func ShowCursor() {
C.ShowCursor()
}
// HideCursor - Hides cursor
func HideCursor() {
C.HideCursor()
}
// IsCursorHidden - Returns true if cursor is not visible
func IsCursorHidden() bool {
ret := C.IsCursorHidden()
v := bool(ret)
return v
}
// IsCursorOnScreen - Check if cursor is on the current screen.
func IsCursorOnScreen() bool {
ret := C.IsCursorOnScreen()
v := bool(ret)
return v
}
// EnableCursor - Enables cursor
func EnableCursor() {
C.EnableCursor()
}
// DisableCursor - Disables cursor
func DisableCursor() {
C.DisableCursor()
}
// IsFileDropped - Check if a file have been dropped into window
func IsFileDropped() bool {
ret := C.IsFileDropped()
v := bool(ret)
return v
}
// LoadDroppedFiles - Load dropped filepaths
func LoadDroppedFiles() []string {
ret := C.LoadDroppedFiles()
defer C.UnloadDroppedFiles(ret)
tmpslice := (*[1 << 24]*C.char)(unsafe.Pointer(ret.paths))[:ret.count:ret.count]
gostrings := make([]string, ret.count)
for i, s := range tmpslice {
gostrings[i] = C.GoString(s)
}
return gostrings
}
// UnloadDroppedFiles - Unload dropped filepaths
func UnloadDroppedFiles() {
}
// OpenAsset - Open asset
func OpenAsset(name string) (Asset, error) {
f, err := os.Open(name)
if err != nil {
return nil, err
}
return f, nil
}