Merge remote-tracking branch 'origin/master'

# Conflicts:
#	cmd/game/main.go
#	delaunay_test.go
#	engine/screens/devmenu.go
#	go.mod
This commit is contained in:
thefish
2022-10-12 16:07:35 +03:00
29 changed files with 477 additions and 332 deletions

View File

@ -1,7 +1,6 @@
package screens
import (
"context"
"lab.zaar.be/thefish/alchemyst-go/engine/ecs"
"lab.zaar.be/thefish/alchemyst-go/engine/ecs/systems"
"lab.zaar.be/thefish/alchemyst-go/engine/fov"
@ -15,7 +14,6 @@ import (
)
type GameScreen struct {
ctx context.Context
mw *mainwindow.MainWindow
state *gamestate.GameState
vp *mainwindow.ViewPort
@ -24,9 +22,8 @@ type GameScreen struct {
fov fov.Fov
}
func NewGameScreen(ctx context.Context, mw *mainwindow.MainWindow, state *gamestate.GameState, viewPort *mainwindow.ViewPort, controller *ecs.Controller, scm *types.ScreenManager) *GameScreen {
func NewGameScreen(mw *mainwindow.MainWindow, state *gamestate.GameState, viewPort *mainwindow.ViewPort, controller *ecs.Controller, scm *types.ScreenManager) *GameScreen {
ts := &GameScreen{
ctx: ctx,
mw: mw,
state: state,
vp: viewPort,
@ -49,7 +46,7 @@ func (ts *GameScreen) UseEcs() bool { return true }
func (ts *GameScreen) Enter() {
ts.mw.GetLayer("overlay").ClearArea(0, ts.mw.H-3, 30, 3)
ts.mw.GetLayer("overlay").WithColor("#77777777").
Print(1, ts.mw.H-2, "Press [color=white]?[/color] for help")
Print(ts.mw.W - 17 , 1, "Press [color=white]?[/color] for help")
}
func (ts *GameScreen) Exit() {
//trs := ts.controller.GetSystem(ecs.LevelRenderSystem)
@ -58,6 +55,7 @@ func (ts *GameScreen) Exit() {
//remove what we dont need
}
//fixme kry names to action constants!
func (ts *GameScreen) HandleInput(input string) {
//ts.state.Do(func(){
switch input {
@ -100,13 +98,22 @@ func (ts *GameScreen) HandleInput(input string) {
} //do nothing
//select if there is more than 1
if len(carrieds) > 1 {
appctx.Logger(ts.ctx).Warn().Msg("Passing item list to inventory not implemented yet")
appctx.Logger().Warn().Msg("Passing item list to inventory not implemented yet")
} else {
//call pickup in selected
cc := items.Controller.GetComponent(carrieds[0], ecs.CarriedComponent).(items.Carried)
items.Carried.Pickup(cc, ts.state.Player, carrieds[0])
}
err := items.Carried.Pickup(cc, ts.state.Player, carrieds[0])
if err != nil {
// Message with error
//gameLog.Log.Error(err)
//@fixme!
appctx.Logger().Warn().Err(err)
break;
}
}
//log picked up
//gameLog.Log.Message(err)
break;
case "i":

View File

@ -63,6 +63,8 @@ func (is *InventoryScreen) Enter() {
is.prepared.Prepare(is)
}
//fixme key names to action constants!
//fixme unify scrolling controls!
func (is *InventoryScreen) HandleInput(input string) {
if strings.Contains(string(runeIndex), strings.Replace(input, "Shift+", "", -1)) {
if strings.Contains("Shift+", input) {
@ -76,7 +78,7 @@ func (is *InventoryScreen) HandleInput(input string) {
return
}
switch input {
case "Up":
case "Up", "k":
is.cursor = is.cursor - 1
if is.cursor < 0 {
is.cursor = 0
@ -88,7 +90,7 @@ func (is *InventoryScreen) HandleInput(input string) {
}
}
break
case "Down":
case "Down", "j":
is.cursor = is.cursor + 1
if is.cursor >= len(is.prepared) {
is.cursor = len(is.prepared) - 1
@ -119,7 +121,8 @@ func (is *InventoryScreen) HandleInput(input string) {
}
break
case "enter":
//select current under cursor
//show actions menu for item under cursor
//fixme implement
break;
case "Escape":
fallthrough

View File

@ -19,6 +19,8 @@ func (ts *TitleScreen) UseEcs() bool { return false }
func (ts *TitleScreen) Enter() {
blt.Clear()
}
//fixme key names to action constants!
func (ts *TitleScreen) HandleInput(input string) {
switch input {
case "n":
@ -55,5 +57,5 @@ Roguebasin Libtcod Tutorial (c) 2010-2011, Jotaf Henriques
Brogue 1.3 (c) 2010 Brian Walker
Madness (c) 2010 hmp <humpolec@gmail.com>
BearLibTerminal (c) Cfyz 2009-2019 <http://foo.wyrd.name/en:bearlibterminal>
Gogue (c) jcerise
Gogue (c) 2019 jcerise
`