reorganize
This commit is contained in:
@ -1,4 +1,9 @@
|
||||
package types
|
||||
package gamestate
|
||||
|
||||
import (
|
||||
"lab.zaar.be/thefish/alchemyst-go/engine/gamemap"
|
||||
"lab.zaar.be/thefish/alchemyst-go/engine/mob"
|
||||
)
|
||||
|
||||
type GameState struct {
|
||||
Mainfunc chan func()
|
||||
@ -7,7 +12,8 @@ type GameState struct {
|
||||
RawInput chan int
|
||||
FovRecompute chan struct{}
|
||||
Redraw chan struct{}
|
||||
Player *Player
|
||||
Level *gamemap.Level
|
||||
Player *mob.Player
|
||||
}
|
||||
|
||||
// do runs f on the main thread.
|
21
engine/mob/mob.go
Normal file
21
engine/mob/mob.go
Normal file
@ -0,0 +1,21 @@
|
||||
package mob
|
||||
|
||||
import "lab.zaar.be/thefish/alchemyst-go/engine/types"
|
||||
|
||||
type Mob struct {
|
||||
*types.Appearance
|
||||
types.Coords
|
||||
BlocksPass bool
|
||||
}
|
||||
|
||||
func (m *Mob) Walk(dx, dy int) {
|
||||
|
||||
}
|
||||
|
||||
func (m *Mob) Render() {
|
||||
|
||||
}
|
||||
|
||||
func (m *Mob) MoveToCoords(c types.Coords) {
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package types
|
||||
package mob
|
||||
|
||||
type Player struct {
|
||||
Mob
|
@ -1,17 +1,17 @@
|
||||
package screens
|
||||
|
||||
import (
|
||||
"lab.zaar.be/thefish/alchemyst-go/engine/types"
|
||||
"lab.zaar.be/thefish/alchemyst-go/engine/gamestate"
|
||||
"lab.zaar.be/thefish/alchemyst-go/ui/mainwindow"
|
||||
)
|
||||
|
||||
type GameScreen struct {
|
||||
mw *mainwindow.MainWindow
|
||||
state *types.GameState
|
||||
state *gamestate.GameState
|
||||
vp *mainwindow.ViewPort
|
||||
}
|
||||
|
||||
func NewGameScreen(mw *mainwindow.MainWindow, state *types.GameState, viewPort *mainwindow.ViewPort) *GameScreen {
|
||||
func NewGameScreen(mw *mainwindow.MainWindow, state *gamestate.GameState, viewPort *mainwindow.ViewPort) *GameScreen {
|
||||
return &GameScreen{mw: mw, state: state, vp: viewPort}
|
||||
}
|
||||
|
||||
@ -44,8 +44,6 @@ func (ts *GameScreen) HandleInput(input string) {
|
||||
case "n", "3":
|
||||
ts.state.Player.Walk(-1, 3)
|
||||
break
|
||||
|
||||
|
||||
default:
|
||||
ts.mw.GetLayer("base").ClearArea(0, 3, 40, 1)
|
||||
ts.mw.GetLayer("base").Print(1, 3, "Key: "+input)
|
||||
|
@ -1,19 +0,0 @@
|
||||
package types
|
||||
|
||||
type Mob struct {
|
||||
*Appearance
|
||||
Coords
|
||||
BlocksPass bool
|
||||
}
|
||||
|
||||
func (m *Mob) Walk(dx, dy int) {
|
||||
|
||||
}
|
||||
|
||||
func (m *Mob) Render() {
|
||||
|
||||
}
|
||||
|
||||
func (m *Mob) MoveToCoords(c Coords) {
|
||||
|
||||
}
|
Reference in New Issue
Block a user