gui folder
This commit is contained in:
parent
fe6d2c0ed3
commit
7a467d5aae
4 changed files with 15 additions and 6 deletions
3
raygui/go.mod
Normal file
3
raygui/go.mod
Normal file
|
@ -0,0 +1,3 @@
|
|||
module github.com/Konstantin8105/raylib-go/raygui
|
||||
|
||||
go 1.19
|
40
raygui/raygui.go
Normal file
40
raygui/raygui.go
Normal file
|
@ -0,0 +1,40 @@
|
|||
package raygui
|
||||
|
||||
/*
|
||||
#cgo CFLAGS: -DRAYGUI_IMPLEMENTATION
|
||||
#include "../raylib/raygui.h"
|
||||
#include <stdlib.h>
|
||||
*/
|
||||
import "C"
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
rl "github.com/Konstantin8105/raylib-go/raylib"
|
||||
)
|
||||
|
||||
// int GuiToggleGroup(Rectangle bounds, const char *text, int active)
|
||||
func ToggleGroup(bounds rl.Rectangle, text string, active int) int {
|
||||
var cbounds C.struct_Rectangle
|
||||
cbounds.x = C.float(bounds.X)
|
||||
cbounds.y = C.float(bounds.Y)
|
||||
cbounds.width = C.float(bounds.Width)
|
||||
cbounds.height = C.float(bounds.Height)
|
||||
ctext := C.CString(text)
|
||||
defer C.free(unsafe.Pointer(ctext))
|
||||
cactive := C.int(active)
|
||||
res := C.GuiToggleGroup(cbounds, ctext, cactive)
|
||||
return int(res)
|
||||
}
|
||||
|
||||
// bool GuiButton(Rectangle bounds, const char *text)
|
||||
func Button(bounds rl.Rectangle, text string) bool {
|
||||
var cbounds C.struct_Rectangle
|
||||
cbounds.x = C.float(bounds.X)
|
||||
cbounds.y = C.float(bounds.Y)
|
||||
cbounds.width = C.float(bounds.Width)
|
||||
cbounds.height = C.float(bounds.Height)
|
||||
ctext := C.CString(text)
|
||||
defer C.free(unsafe.Pointer(ctext))
|
||||
res := C.GuiButton(cbounds, ctext)
|
||||
return bool(res)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue