Skip to content

Instantly share code, notes, and snippets.

@flushpot1125
Created June 22, 2024 12:54
Show Gist options
  • Save flushpot1125/5a3726441fe7655e580ac69f52ceb9e0 to your computer and use it in GitHub Desktop.
Save flushpot1125/5a3726441fe7655e580ac69f52ceb9e0 to your computer and use it in GitHub Desktop.
} attachments: {
Attachment(id: "ui_panel") {
HStack {
// A button to reload the current scene.
Button { godotVision.reloadScene() } label: {
Text("Reload")
}
// Buttons for loading example scenes.
sceneButton(label: "Hello", resourcePath: "res://examples/hello/example_godot_vision_scene.tscn")
sceneButton(label: "Physics", resourcePath: "res://examples/physics_toy/physics_toy.tscn")
//sceneButton(label: "Materials", resourcePath: "res://tests/materials/materials.tscn")
sceneButton(label: "Skeletons", resourcePath: "res://examples/rigged_models/example_rigged_models.tscn")
sceneButton(label: "CSG", resourcePath: "res://examples/csg/csg.tscn")
}.padding(36).frame(width: 700).glassBackgroundEffect()
}
}
}
.modifier(GodotVisionRealityViewModifier(coordinator: godotVision))
}
@ViewBuilder
func sceneButton(label: String, resourcePath: String) -> some View {
Button {
godotVision.changeSceneToFile(atResourcePath: resourcePath)
} label: {
Text(label)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment