mirror of
https://github.com/bloeys/nterm.git
synced 2025-12-29 14:38:19 +00:00
Running window
This commit is contained in:
75
main.go
75
main.go
@ -1,5 +1,76 @@
|
||||
package main
|
||||
|
||||
func main() {
|
||||
println("Hi!")
|
||||
import (
|
||||
"github.com/bloeys/nmage/engine"
|
||||
"github.com/bloeys/nmage/input"
|
||||
"github.com/bloeys/nmage/renderer/rend3dgl"
|
||||
nmageimgui "github.com/bloeys/nmage/ui/imgui"
|
||||
)
|
||||
|
||||
var _ engine.Game = &program{}
|
||||
|
||||
type program struct {
|
||||
shouldRun bool
|
||||
win *engine.Window
|
||||
imguiInfo nmageimgui.ImguiInfo
|
||||
}
|
||||
|
||||
func (p *program) Init() {
|
||||
|
||||
}
|
||||
|
||||
func (p *program) Start() {
|
||||
|
||||
}
|
||||
|
||||
func (p *program) FrameStart() {
|
||||
|
||||
}
|
||||
|
||||
func (p *program) Update() {
|
||||
|
||||
if input.IsQuitClicked() {
|
||||
p.shouldRun = false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (p *program) Render() {
|
||||
|
||||
}
|
||||
|
||||
func (p *program) FrameEnd() {
|
||||
|
||||
}
|
||||
|
||||
func (g *program) GetWindow() *engine.Window {
|
||||
return g.win
|
||||
}
|
||||
|
||||
func (g *program) GetImGUI() nmageimgui.ImguiInfo {
|
||||
return g.imguiInfo
|
||||
}
|
||||
|
||||
func (p *program) ShouldRun() bool {
|
||||
return p.shouldRun
|
||||
}
|
||||
|
||||
func (p *program) Deinit() {
|
||||
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
win, err := engine.CreateOpenGLWindowCentered("nTerm", 1280, 720, engine.WindowFlags_ALLOW_HIGHDPI|engine.WindowFlags_RESIZABLE, rend3dgl.NewRend3DGL())
|
||||
if err != nil {
|
||||
panic("Failed to create window. Err: " + err.Error())
|
||||
}
|
||||
|
||||
p := &program{
|
||||
shouldRun: true,
|
||||
win: win,
|
||||
imguiInfo: nmageimgui.NewImGUI(),
|
||||
}
|
||||
|
||||
engine.Run(p)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user