Skip to content

Conversation

@gucio321
Copy link
Collaborator

@gucio321 gucio321 commented Sep 10, 2024

@gucio321
Copy link
Collaborator Author

@gucio321 gucio321 force-pushed the imguizmo branch 2 times, most recently from 3c00ef1 to c067b0c Compare October 27, 2024 09:07
@gucio321
Copy link
Collaborator Author

this compiles. Usage example will be created in a separted pr.
Here is some code but it doesn't wrok

demo
package main

import (
	"github.com/AllenDang/cimgui-go/backend"
	"github.com/AllenDang/cimgui-go/backend/glfwbackend"
	"github.com/AllenDang/cimgui-go/imgui"
	"github.com/AllenDang/cimgui-go/imguizmo"
	_ "github.com/AllenDang/cimgui-go/immarkdown"
	_ "github.com/AllenDang/cimgui-go/imnodes"
)

var (
	currentBackend backend.Backend[glfwbackend.GLFWWindowFlags]
	cameraView     = []float32{
		1.0, 0.0, 0.0, 0.0,
		0.0, 1.0, 0.0, 0.0,
		0.0, 0.0, 1.0, 0.0,
		0.0, 0.0, 0.0, 1.0,
	}
	cameraProjection = make([]float32, 16)
	identityMatrix   = []float32{
		1.0, 0.0, 0.0, 0.0,
		0.0, 1.0, 0.0, 0.0,
		0.0, 0.0, 1.0, 0.0,
		0.0, 0.0, 0.0, 1.0,
	}
)

func loop() {
	imguizmo.BeginFrame()
	io := imgui.CurrentIO()
	ds := io.DisplaySize()
	imguizmo.SetRect(0, 0, ds.X, ds.Y)

	imguizmo.Manipulate(cameraView, cameraProjection, 0, 0, &(identityMatrix[0]))
}

func main() {
	currentBackend, _ = backend.CreateBackend(glfwbackend.NewGLFWBackend())
	currentBackend.CreateWindow("Hello from cimgui-go", 1200, 900)
	currentBackend.SetAfterCreateContextHook(func() {
		imguizmo.SetImGuiContext(imgui.CurrentContext())
	})
	currentBackend.Run(loop)
}

@gucio321 gucio321 merged commit b4c397e into AllenDang:main Oct 27, 2024
5 checks passed
@gucio321 gucio321 deleted the imguizmo branch October 27, 2024 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant