raylib-go/raylib/raygui.go
Konstantin8105 fe6d2c0ed3 step
2022-11-22 18:50:35 +03:00

39 lines
995 B
Go

package rl
/*
#cgo CFLAGS: -DRAYGUI_IMPLEMENTATION
#include "raygui.h"
#include <stdlib.h>
*/
import "C"
import (
"unsafe"
)
// int GuiToggleGroup(Rectangle bounds, const char *text, int active)
func ToggleGroup(bounds 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 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)
}