51 lines
1.1 KiB
Go
51 lines
1.1 KiB
Go
package game
|
|
|
|
import (
|
|
"edgaru089.ml/go/gl01/internal/entity"
|
|
"edgaru089.ml/go/gl01/internal/render"
|
|
"edgaru089.ml/go/gl01/internal/util/itype"
|
|
"edgaru089.ml/go/gl01/internal/world"
|
|
"github.com/inkyblackness/imgui-go/v4"
|
|
|
|
_ "edgaru089.ml/go/gl01/internal/entity/entities"
|
|
)
|
|
|
|
// Game holds a game scene.
|
|
type Game struct {
|
|
world *world.World
|
|
|
|
player *entity.Entity
|
|
|
|
view *render.View
|
|
worldrender *render.WorldRenderer
|
|
|
|
prevCursorPos itype.Vec2d
|
|
cameraPos itype.Vec3d
|
|
rotY itype.Angle
|
|
rotZ float32 // Degrees in range (-90, 90)
|
|
|
|
fbSize itype.Vec2i
|
|
|
|
io imgui.IO
|
|
gui guiState
|
|
paused bool
|
|
}
|
|
|
|
// NewGame creates a new, empty Game.
|
|
func NewGame() (g *Game) {
|
|
return &Game{
|
|
world: world.NewWorld(),
|
|
player: entity.NewEntity("player", itype.Vec3d{18, 80, 18}),
|
|
worldrender: &render.WorldRenderer{},
|
|
cameraPos: itype.Vec3d{18, 80, 18},
|
|
rotY: 0,
|
|
rotZ: 0,
|
|
}
|
|
}
|
|
|
|
// LoadGameFromPath loads a saved game from a filesystem folder in a read-write fashion.
|
|
func LoadGameFromPath(path string) (g *Game, err error) {
|
|
|
|
return
|
|
}
|