diff --git a/bsptest.go b/bsptest.go index 9d8cd5d..24a8826 100644 --- a/bsptest.go +++ b/bsptest.go @@ -3,6 +3,8 @@ package main import ( "fmt" + "git.dummkopf.live/InventorX/pinwindows" + gui "github.com/gen2brain/raylib-go/raygui" rl "github.com/gen2brain/raylib-go/raylib" ) @@ -27,6 +29,13 @@ type wall struct { direction rl.Vector2 } +func UpdateRenderTexture(texture *rl.RenderTexture2D) { + if rl.IsWindowResized() { + rl.UnloadRenderTexture(*texture) + *texture = rl.LoadRenderTexture(int32(rl.GetScreenWidth()), int32(rl.GetScreenHeight())) + } +} + func (w wall) Draw() { rl.DrawLineV(w.v1, w.v2, rl.White) midpoint := rl.Vector2MoveTowards(w.v1, w.v2, rl.Vector2Distance(w.v1, w.v2)/2) @@ -53,25 +62,49 @@ func main() { var frametime float32 = 0 walltest := wall{rl.Vector2{X: 50, Y: 50}, rl.Vector2{X: 100, Y: 100}, rl.Vector2{X: 50, Y: 50}} + var MapOrigWalls []wall + MapOrigWalls = append(MapOrigWalls, walltest) + + mainwindowmanager := pinwindows.NewRayGuiWindowManager() + raywin := pinwindows.NewRayGuiWindow(100, 100, 200, 200) + mainwindowmanager.AddWindow(&raywin) + for !rl.WindowShouldClose() { + mainwindowmanager.ManageWindowlist() + mainwindowmanager.ProcessUserWindowMovement() + + raywin.BeginDrawMode() + rl.ClearBackground(rl.White) + rl.DrawText("erm", 0, 0, 012, rl.Black) + raywin.EndDrawMode() + frametime = rl.GetFrameTime() + UpdateRenderTexture(&rendertexture) + + mainwindowmanager.DrawInternalWindowList() //camera.Target = rl.Vector2{0, 0} rl.BeginTextureMode(rendertexture) rl.ClearBackground(rl.Black) + + mainwindowmanager.DrawWindowlist() + //rl.EndMode2D() //draw Scaled UI (buttons wont work here) rl.DrawText(fmt.Sprintf("%f", frametime), 0, 0, 22, rl.Black) walltest.Draw() + rl.DrawCircle(int32(rl.GetMousePosition().X), int32(rl.GetMousePosition().Y), 10, rl.Blue) rl.EndTextureMode() rl.BeginDrawing() rl.DrawTexturePro(rendertexture.Texture, rl.NewRectangle(0, 0, float32(rendertexture.Texture.Width), -float32(rendertexture.Texture.Height)), rl.NewRectangle(0, 0, float32(rl.GetScreenWidth()), float32(rl.GetScreenHeight())), rl.NewVector2(0, 0), 0, rl.White) - + gui.Button(rl.NewRectangle(1000, 600, 50, 50), "erm") + var sind int32 = 0 + gui.ListView(rl.NewRectangle(0, 0, 100, 500), "test\n,; test", &sind, 0) //Absoulte drawing rl.EndDrawing() } diff --git a/go.mod b/go.mod index 8ca240a..f37e0e9 100644 --- a/go.mod +++ b/go.mod @@ -3,11 +3,12 @@ module git.dummkopf.live/InventorX/bsptest go 1.22.2 require ( + git.dummkopf.live/InventorX/pinwindows v0.0.0-20240421060047-a58c367a1d9f github.com/gen2brain/raylib-go/raygui v0.0.0-20240418150228-9548fadb54e6 github.com/gen2brain/raylib-go/raylib v0.0.0-20240418150228-9548fadb54e6 ) require ( - github.com/ebitengine/purego v0.6.0-alpha.1.0.20231122024802-192c5e846faa // indirect - golang.org/x/sys v0.14.0 // indirect + github.com/ebitengine/purego v0.7.1 // indirect + golang.org/x/sys v0.19.0 // indirect ) diff --git a/go.sum b/go.sum index 339657b..6c25918 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,20 @@ +git.dummkopf.live/InventorX/pinwindows v0.0.0-20240421041403-1fd13fa66f1c h1:u/dL6KY+u7q+0XsvVs5/yLghcwkTzBe94EsFjwAjPCQ= +git.dummkopf.live/InventorX/pinwindows v0.0.0-20240421041403-1fd13fa66f1c/go.mod h1:nkyhUxcpBZlUgL0IU/wCFtcTJjQ6V/r2kBzdMWKimNQ= +git.dummkopf.live/InventorX/pinwindows v0.0.0-20240421053049-34b3c75bf99a h1:xZ3JdZboTfYRG6z9dzSAcnxsWx5GKK3SorM2I0Ft/qM= +git.dummkopf.live/InventorX/pinwindows v0.0.0-20240421053049-34b3c75bf99a/go.mod h1:nkyhUxcpBZlUgL0IU/wCFtcTJjQ6V/r2kBzdMWKimNQ= +git.dummkopf.live/InventorX/pinwindows v0.0.0-20240421055100-1eca7bfb5c2b h1:8hn/ASa144aUDKUKWEcTyJ14QiqEK+RlWHZGq102FSw= +git.dummkopf.live/InventorX/pinwindows v0.0.0-20240421055100-1eca7bfb5c2b/go.mod h1:nkyhUxcpBZlUgL0IU/wCFtcTJjQ6V/r2kBzdMWKimNQ= +git.dummkopf.live/InventorX/pinwindows v0.0.0-20240421060047-a58c367a1d9f h1:WjV8Ow4fcSWouY5I6jWaPtwB0CyfbVng3SSNwma6eD0= +git.dummkopf.live/InventorX/pinwindows v0.0.0-20240421060047-a58c367a1d9f/go.mod h1:nkyhUxcpBZlUgL0IU/wCFtcTJjQ6V/r2kBzdMWKimNQ= github.com/ebitengine/purego v0.6.0-alpha.1.0.20231122024802-192c5e846faa h1:Ik7QikRgeH+bFOfAcMpttCbs6XxWXxCLXMm4awxtOXk= github.com/ebitengine/purego v0.6.0-alpha.1.0.20231122024802-192c5e846faa/go.mod h1:ah1In8AOtksoNK6yk5z1HTJeUkC1Ez4Wk2idgGslMwQ= +github.com/ebitengine/purego v0.7.1 h1:6/55d26lG3o9VCZX8lping+bZcmShseiqlh2bnUDiPA= +github.com/ebitengine/purego v0.7.1/go.mod h1:ah1In8AOtksoNK6yk5z1HTJeUkC1Ez4Wk2idgGslMwQ= github.com/gen2brain/raylib-go/raygui v0.0.0-20240418150228-9548fadb54e6 h1:50+kpfeZzxc1A2FralhIzPMJH9gprSm6+36EMlkbyMA= github.com/gen2brain/raylib-go/raygui v0.0.0-20240418150228-9548fadb54e6/go.mod h1:Ra1zgJP7vnGst+STvzPPiVJhjicklFWONCz5nu6MnOM= github.com/gen2brain/raylib-go/raylib v0.0.0-20240418150228-9548fadb54e6 h1:mNKFgLZIU0eEHKHjb7Uk9ZuSy65DdgmEf2xxum0Tof4= github.com/gen2brain/raylib-go/raylib v0.0.0-20240418150228-9548fadb54e6/go.mod h1:P/hDjVwz/9fhR0ww3+umzDpDA7Bf7Tce4xNChHIEFqE= golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= +golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=