feat: quick scaffolding for game window
Init: Created initial NPC data structures UI: Created basic ncurses TUI for development Types: Created basic helper types
This commit is contained in:
parent
03d6ee47fa
commit
8b6b1f1ac0
8 changed files with 159 additions and 22 deletions
10
utils/types/menus.go
Normal file
10
utils/types/menus.go
Normal file
|
@ -0,0 +1,10 @@
|
|||
package types
|
||||
|
||||
import (
|
||||
. "github.com/gbin/goncurses"
|
||||
)
|
||||
|
||||
type GameMenuItem struct {
|
||||
Name string
|
||||
Operation func(*Window)
|
||||
}
|
12
utils/types/npcs.go
Normal file
12
utils/types/npcs.go
Normal file
|
@ -0,0 +1,12 @@
|
|||
package types
|
||||
|
||||
type NpcAi struct {
|
||||
PromptCharacterString string
|
||||
QueryFromTableName string
|
||||
}
|
||||
type Npc struct {
|
||||
Name string
|
||||
Ai NpcAi
|
||||
}
|
||||
|
||||
|
20
utils/types/types.go
Normal file
20
utils/types/types.go
Normal file
|
@ -0,0 +1,20 @@
|
|||
package types
|
||||
|
||||
import "time"
|
||||
|
||||
|
||||
type Data struct {
|
||||
Npcs []Npc
|
||||
}
|
||||
type Game struct {
|
||||
SaveGame string
|
||||
LastSaved time.Time
|
||||
DataStored Data
|
||||
}
|
||||
|
||||
func (game Game) NewGame(game_name string, data Data) Game {
|
||||
game.SaveGame = game_name
|
||||
game.LastSaved = time.Now()
|
||||
game.DataStored = data
|
||||
return game
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
package window
|
||||
import (
|
||||
. "github.com/gbin/goncurses"
|
||||
)
|
||||
func createWindow(scr Screen) Window {}
|
||||
}
|
13
utils/window_helper/window_helper.go
Normal file
13
utils/window_helper/window_helper.go
Normal file
|
@ -0,0 +1,13 @@
|
|||
package window_helper
|
||||
import (
|
||||
. "github.com/gbin/goncurses"
|
||||
)
|
||||
|
||||
func CreateMenu(win *Window, menu_string []string) {
|
||||
x, y := 2, 2
|
||||
win.Clear()
|
||||
win.Box(0, 0)
|
||||
for i, str := range menu_string {
|
||||
win.MovePrint(y+i, x, str)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue