Start work on menu interactivity.

With this commit, we get a ui.Interface and ui.Widget type. The
interface monitors hover and mouse click state and tells the widgets
about them; the widgets execute code specified by the application when
events occur.

Next step: have wh40k load the main menu and play sound, etc.
This commit is contained in:
2020-03-22 02:58:52 +00:00
parent bcaf3d9b58
commit bfe9fbdf7d
12 changed files with 440 additions and 194 deletions

View File

@@ -33,6 +33,7 @@ type AssetStore struct {
// These members are used to store things we've already loaded
maps map[string]*Map
menus map[string]*Menu
objs map[string]*Object
sets map[string]*Set
sounds map[string]*Sound
@@ -81,6 +82,7 @@ func (a *AssetStore) Refresh() error {
// Refresh
a.entries = newEntryMap
a.maps = make(map[string]*Map)
a.menus = make(map[string]*Menu)
a.objs = make(map[string]*Object)
a.sets = make(map[string]*Set)
a.sounds = make(map[string]*Sound)
@@ -89,7 +91,12 @@ func (a *AssetStore) Refresh() error {
}
func (a *AssetStore) lookup(name, ext string, dirs ...string) (string, error) {
filename := canonical(name + "." + ext)
var filename string
if ext != "" {
filename = canonical(name + "." + ext)
} else {
filename = canonical(name)
}
for _, dir := range dirs {
dir = canonical(dir)