MCPcopy
hub / github.com/EngoEngine/engo / RegisterScene

Function RegisterScene

scene.go:121–130  ·  view source on GitHub ↗

RegisterScene registers the `Scene`, so it can later be used by `SetSceneByName`

(s Scene)

Source from the content-addressed store, hash-verified

119
120// RegisterScene registers the `Scene`, so it can later be used by `SetSceneByName`
121func RegisterScene(s Scene) {
122 sceneMutex.RLock()
123 _, ok := scenes[s.Type()]
124 sceneMutex.RUnlock()
125 if !ok {
126 sceneMutex.Lock()
127 scenes[s.Type()] = &sceneWrapper{scene: s}
128 sceneMutex.Unlock()
129 }
130}
131
132// SetSceneByName does a lookup for the `Scene` where its `Type()` equals `name`, and then sets it as current `Scene`
133func SetSceneByName(name string, forceNewWorld bool) error {

Callers 3

mainFunction · 0.92
TestSceneSwitchingFunction · 0.85
SetSceneFunction · 0.85

Calls 1

TypeMethod · 0.65

Tested by 1

TestSceneSwitchingFunction · 0.68