From 7a467d5aaee6e0364a36b01a46d6d83e27f3f94b Mon Sep 17 00:00:00 2001 From: Konstantin8105 Date: Wed, 23 Nov 2022 12:26:13 +0300 Subject: [PATCH] gui folder --- examples/gui/button/go.mod | 6 +++++- examples/gui/button/main.go | 3 ++- raygui/go.mod | 3 +++ {raylib => raygui}/raygui.go | 9 +++++---- 4 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 raygui/go.mod rename {raylib => raygui}/raygui.go (79%) diff --git a/examples/gui/button/go.mod b/examples/gui/button/go.mod index 60b9419..5d22fef 100644 --- a/examples/gui/button/go.mod +++ b/examples/gui/button/go.mod @@ -2,6 +2,10 @@ module example go 1.19 -require github.com/Konstantin8105/raylib-go/raylib v0.0.0-20221122153952-2f5d9114177b +require ( + github.com/Konstantin8105/raylib-go/raygui v0.0.0-20221122151443-e8a384ed1346 + github.com/Konstantin8105/raylib-go/raylib v0.0.0-20221122153952-2f5d9114177b +) replace github.com/Konstantin8105/raylib-go/raylib => ../../../raylib +replace github.com/Konstantin8105/raylib-go/raygui => ../../../raygui diff --git a/examples/gui/button/main.go b/examples/gui/button/main.go index c461680..52b60df 100644 --- a/examples/gui/button/main.go +++ b/examples/gui/button/main.go @@ -4,6 +4,7 @@ import ( "fmt" rl "github.com/Konstantin8105/raylib-go/raylib" + gui "github.com/Konstantin8105/raylib-go/raygui" ) func main() { @@ -18,7 +19,7 @@ func main() { rl.ClearBackground(rl.Black) - button = rl.Button(rl.NewRectangle(50, 150, 100, 40), "Click") + button = gui.Button(rl.NewRectangle(50, 150, 100, 40), "Click") if button { fmt.Println("Clicked on button") } diff --git a/raygui/go.mod b/raygui/go.mod new file mode 100644 index 0000000..b893ee8 --- /dev/null +++ b/raygui/go.mod @@ -0,0 +1,3 @@ +module github.com/Konstantin8105/raylib-go/raygui + +go 1.19 diff --git a/raylib/raygui.go b/raygui/raygui.go similarity index 79% rename from raylib/raygui.go rename to raygui/raygui.go index fde38ea..cf29678 100644 --- a/raylib/raygui.go +++ b/raygui/raygui.go @@ -1,18 +1,19 @@ -package rl +package raygui /* #cgo CFLAGS: -DRAYGUI_IMPLEMENTATION -#include "raygui.h" +#include "../raylib/raygui.h" #include */ import "C" import ( "unsafe" + rl "github.com/Konstantin8105/raylib-go/raylib" ) // int GuiToggleGroup(Rectangle bounds, const char *text, int active) -func ToggleGroup(bounds Rectangle, text string, active int) int { +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) @@ -26,7 +27,7 @@ func ToggleGroup(bounds Rectangle, text string, active int) int { } // bool GuiButton(Rectangle bounds, const char *text) -func Button(bounds Rectangle, text string) bool { +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)