MCPcopy
hub / github.com/g3n/engine / App

Function App

app/app-browser.go:33–55  ·  view source on GitHub ↗

App returns the Application singleton, creating it the first time.

()

Source from the content-addressed store, hash-verified

31
32// App returns the Application singleton, creating it the first time.
33func App() *Application {
34
35 // Return singleton if already created
36 if a != nil {
37 return a
38 }
39 a = new(Application)
40 // Initialize window
41 err := window.Init(canvasId)
42 if err != nil {
43 panic(err)
44 }
45 a.IWindow = window.Get()
46 // TODO audio setup here
47 a.keyState = window.NewKeyState(a) // Create KeyState
48 // Create renderer and add default shaders
49 a.renderer = renderer.NewRenderer(a.Gls())
50 err = a.renderer.AddDefaultShaders()
51 if err != nil {
52 panic(fmt.Errorf("AddDefaultShaders:%v", err))
53 }
54 return a
55}
56
57// Run starts the update loop.
58// It calls the user-provided update function every frame.

Callers

nothing calls this directly

Calls 6

InitFunction · 0.92
GetFunction · 0.92
NewKeyStateFunction · 0.92
NewRendererFunction · 0.92
AddDefaultShadersMethod · 0.80
GlsMethod · 0.65

Tested by

no test coverage detected