Initial commit

This commit is contained in:
2022-01-20 21:58:50 +08:00
commit b44d41ec66
86 changed files with 5415 additions and 0 deletions

49
internal/game/game.go Normal file
View File

@@ -0,0 +1,49 @@
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
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
}