dmitri.shuralyov.com/gpu/mtl/...

example/movingtriangle: simplify ContentView code

Get the ContentView right away, instead of going through cocoaWindow.
The ContentView is all that's needed from cocoaWindow at this time.
This is simpler and reads better.
dmitshur committed 3 months ago commit c9d1ccdd732c27473f903791c278423da078587e
example/movingtriangle/main.go
@@ -61,13 +61,13 @@ func run() error {
 	ml.SetDevice(device)
 	ml.SetPixelFormat(mtl.PixelFormatBGRA8UNorm)
 	ml.SetDrawableSize(window.GetFramebufferSize())
 	ml.SetMaximumDrawableCount(3)
 	ml.SetDisplaySyncEnabled(true)
-	cocoaWindow := ns.NewWindow(unsafe.Pointer(window.GetCocoaWindow()))
-	cocoaWindow.ContentView().SetLayer(ml)
-	cocoaWindow.ContentView().SetWantsLayer(true)
+	cv := ns.NewWindow(unsafe.Pointer(window.GetCocoaWindow())).ContentView()
+	cv.SetLayer(ml)
+	cv.SetWantsLayer(true)
 
 	// Set callbacks.
 	window.SetFramebufferSizeCallback(func(_ *glfw.Window, width, height int) {
 		ml.SetDrawableSize(width, height)
 	})