Add support for PLATFORM_DRM
This commit is contained in:
parent
43484d2b81
commit
a9172dcaf0
4 changed files with 194 additions and 0 deletions
9
raylib/cgo_linux_drm.go
Normal file
9
raylib/cgo_linux_drm.go
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
// +build linux,drm,!rpi,!android
|
||||||
|
|
||||||
|
package rl
|
||||||
|
|
||||||
|
/*
|
||||||
|
#cgo linux,drm LDFLAGS: -lGLESv2 -lEGL -ldrm -lgbm -lpthread -lrt -lm -ldl
|
||||||
|
#cgo linux,drm CFLAGS: -DPLATFORM_DRM -DGRAPHICS_API_OPENGL_ES2 -DEGL_NO_X11 -I/usr/include/libdrm
|
||||||
|
*/
|
||||||
|
import "C"
|
9
raylib/cgo_linux_rpi.go
Normal file
9
raylib/cgo_linux_rpi.go
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
// +build linux,rpi,!drm,!android
|
||||||
|
|
||||||
|
package rl
|
||||||
|
|
||||||
|
/*
|
||||||
|
#cgo linux,rpi LDFLAGS: -L/opt/vc/lib -L/opt/vc/lib64 -lbrcmGLESv2 -lbrcmEGL -lpthread -lrt -lm -lbcm_host -lvcos -lvchiq_arm -ldl
|
||||||
|
#cgo linux,rpi CFLAGS: -DPLATFORM_RPI -DGRAPHICS_API_OPENGL_ES2 -I/opt/vc/include -I/opt/vc/include/interface/vcos -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads
|
||||||
|
*/
|
||||||
|
import "C"
|
88
raylib/platform_drm.go
Normal file
88
raylib/platform_drm.go
Normal file
|
@ -0,0 +1,88 @@
|
||||||
|
// +build linux,drm,!rpi,!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()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetDroppedFiles - Retrieve dropped files into window
|
||||||
|
func GetDroppedFiles(count *int32) (files []string) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClearDroppedFiles - Clear dropped files paths buffer
|
||||||
|
func ClearDroppedFiles() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// OpenAsset - Open asset
|
||||||
|
func OpenAsset(name string) (Asset, error) {
|
||||||
|
f, err := os.Open(name)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return f, nil
|
||||||
|
}
|
88
raylib/platform_rpi.go
Normal file
88
raylib/platform_rpi.go
Normal file
|
@ -0,0 +1,88 @@
|
||||||
|
// +build linux,rpi,!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()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetDroppedFiles - Retrieve dropped files into window
|
||||||
|
func GetDroppedFiles(count *int32) (files []string) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClearDroppedFiles - Clear dropped files paths buffer
|
||||||
|
func ClearDroppedFiles() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// OpenAsset - Open asset
|
||||||
|
func OpenAsset(name string) (Asset, error) {
|
||||||
|
f, err := os.Open(name)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return f, nil
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue