App returns the Application singleton, creating it the first time.
()
| 31 | |
| 32 | // App returns the Application singleton, creating it the first time. |
| 33 | func 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. |
nothing calls this directly
no test coverage detected