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:
@@ -170,29 +170,6 @@ func (r *Record) Toplevel() *Record {
|
||||
return r
|
||||
}
|
||||
|
||||
func (r *Record) SelectSprite(step int, pressed, focused bool) int {
|
||||
switch r.Type {
|
||||
case TypeStatic:
|
||||
return r.SpriteId[0]
|
||||
case TypeMenu:
|
||||
return r.SpriteId[0] // Probably -1
|
||||
case TypeOverlay:
|
||||
return r.Share
|
||||
case TypeMainButton:
|
||||
// A main button has 4 states: unfocused, focused (animated), mousedown, disabled
|
||||
if focused && pressed {
|
||||
return r.Share + 1
|
||||
} else if focused {
|
||||
return r.SpriteId[0] + (step % r.DrawType)
|
||||
}
|
||||
|
||||
// TODO: disabled
|
||||
return r.Share
|
||||
}
|
||||
|
||||
return -1
|
||||
}
|
||||
|
||||
func setProperty(r *Record, k, v string) {
|
||||
vSplit := strings.Split(v, ",")
|
||||
vInt, _ := strconv.Atoi(v)
|
||||
|
Reference in New Issue
Block a user