mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-11-07 10:47:19 -05:00
Merge pull request #993 from gucio321/onHover-bugs2
Revert "fixed onHover bug in d2ui.Sprite"
This commit is contained in:
commit
fdbfc9a58e
@ -37,25 +37,17 @@ func (ui *UIManager) NewSprite(animationPath, palettePath string) (*Sprite, erro
|
|||||||
|
|
||||||
base := NewBaseWidget(ui)
|
base := NewBaseWidget(ui)
|
||||||
|
|
||||||
sprite := &Sprite{
|
return &Sprite{
|
||||||
BaseWidget: base,
|
BaseWidget: base,
|
||||||
animation: animation,
|
animation: animation,
|
||||||
Logger: ui.Logger,
|
Logger: ui.Logger,
|
||||||
}
|
}, nil
|
||||||
|
|
||||||
sprite.SetVisible(false)
|
|
||||||
|
|
||||||
ui.addWidget(sprite)
|
|
||||||
|
|
||||||
return sprite, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render renders the sprite on the given surface
|
// Render renders the sprite on the given surface
|
||||||
func (s *Sprite) Render(target d2interface.Surface) {
|
func (s *Sprite) Render(target d2interface.Surface) {
|
||||||
_, frameHeight := s.animation.GetCurrentFrameSize()
|
_, frameHeight := s.animation.GetCurrentFrameSize()
|
||||||
|
|
||||||
s.width, s.height = s.animation.GetCurrentFrameSize()
|
|
||||||
|
|
||||||
target.PushTranslation(s.x, s.y-frameHeight)
|
target.PushTranslation(s.x, s.y-frameHeight)
|
||||||
defer target.Pop()
|
defer target.Pop()
|
||||||
|
|
||||||
@ -101,6 +93,11 @@ func (s *Sprite) RenderSegmented(target d2interface.Surface, segmentsX, segments
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetSize returns the size of the current frame
|
||||||
|
func (s *Sprite) GetSize() (width, height int) {
|
||||||
|
return s.GetCurrentFrameSize()
|
||||||
|
}
|
||||||
|
|
||||||
// GetFrameSize gets the Size(width, height) of a indexed frame.
|
// GetFrameSize gets the Size(width, height) of a indexed frame.
|
||||||
func (s *Sprite) GetFrameSize(frameIndex int) (x, y int, err error) {
|
func (s *Sprite) GetFrameSize(frameIndex int) (x, y int, err error) {
|
||||||
return s.animation.GetFrameSize(frameIndex)
|
return s.animation.GetFrameSize(frameIndex)
|
||||||
|
Loading…
Reference in New Issue
Block a user