Get the briefing menu linked up
Yes, that means hypertext is now a clickable.
This commit is contained in:
@@ -23,12 +23,14 @@ func init() {
|
||||
//
|
||||
// For non-animated non-interactive elements, just give them a single frame.
|
||||
type noninteractive struct {
|
||||
path string
|
||||
frames animation
|
||||
rect image.Rectangle
|
||||
|
||||
// Some non-interactives, e.g., overlays, are an image + text to be shown
|
||||
textImg *ebiten.Image
|
||||
|
||||
clickImpl // Alright, alright, it turns out the bridge mission briefing is clickable
|
||||
hoverImpl
|
||||
}
|
||||
|
||||
@@ -56,6 +58,7 @@ func registerStatic(d *Driver, r *menus.Record) error {
|
||||
}
|
||||
|
||||
ni := &noninteractive{
|
||||
path: r.Path(),
|
||||
frames: animation{sprite.Image},
|
||||
hoverImpl: hoverImpl{text: r.Text},
|
||||
rect: sprite.Rect,
|
||||
@@ -74,10 +77,12 @@ func registerHypertext(d *Driver, r *menus.Record) error {
|
||||
}
|
||||
|
||||
ni := &noninteractive{
|
||||
path: r.Path(),
|
||||
hoverImpl: hoverImpl{text: r.Text},
|
||||
rect: sprite.Rect,
|
||||
}
|
||||
|
||||
d.clickables = append(d.clickables, ni)
|
||||
d.hoverables = append(d.hoverables, ni)
|
||||
|
||||
return nil
|
||||
@@ -91,6 +96,7 @@ func registerOverlay(d *Driver, r *menus.Record) error {
|
||||
}
|
||||
|
||||
ni := &noninteractive{
|
||||
path: r.Path(),
|
||||
frames: animation{sprite.Image},
|
||||
rect: sprite.Rect,
|
||||
}
|
||||
@@ -126,6 +132,7 @@ func registerAnimation(d *Driver, r *menus.Record) error {
|
||||
}
|
||||
|
||||
ani := &noninteractive{
|
||||
path: r.Path(),
|
||||
frames: animation(frames),
|
||||
hoverImpl: hoverImpl{text: r.Text},
|
||||
rect: sprite.Rect,
|
||||
@@ -155,6 +162,7 @@ func registerAnimationHover(d *Driver, r *menus.Record) error {
|
||||
|
||||
ani := &animationHover{
|
||||
noninteractive: noninteractive{
|
||||
path: r.Path(),
|
||||
frames: animation(enterFrames),
|
||||
hoverImpl: hoverImpl{text: r.Text},
|
||||
rect: sprite.Rect,
|
||||
@@ -169,6 +177,10 @@ func registerAnimationHover(d *Driver, r *menus.Record) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (n *noninteractive) id() string {
|
||||
return n.path
|
||||
}
|
||||
|
||||
func (n *noninteractive) bounds() image.Rectangle {
|
||||
return n.rect
|
||||
}
|
||||
|
Reference in New Issue
Block a user