info_page_selector.go 1010 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package UI
  2. import (
  3. //"fmt"
  4. // "github.com/veandco/go-sdl2/ttf"
  5. // "github.com/cuu/gogame/surface"
  6. // "github.com/cuu/gogame/event"
  7. "github.com/cuu/gogame/color"
  8. "github.com/cuu/gogame/draw"
  9. "github.com/cuu/gogame/rect"
  10. )
  11. type InfoPageSelector struct {
  12. PageSelector
  13. BackgroundColor *color.Color
  14. }
  15. func NewInfoPageSelector() *InfoPageSelector {
  16. p := &InfoPageSelector{}
  17. p.Width = Width
  18. p.BackgroundColor = &color.Color{131, 199, 219, 255} //SkinManager().GiveColor('Front')
  19. return p
  20. }
  21. func (self *InfoPageSelector) AnimateDraw(x2, y2 int) {
  22. //pass
  23. }
  24. func (self *InfoPageSelector) Draw() {
  25. idx := self.Parent.GetPsIndex()
  26. mylist := self.Parent.GetMyList()
  27. if idx < len(mylist) {
  28. _, y := mylist[idx].Coord()
  29. _, h := mylist[idx].Size()
  30. self.PosY = y + 1
  31. self.Height = h - 3
  32. canvas_ := self.Parent.GetCanvasHWND()
  33. rect_ := rect.Rect(self.PosX, self.PosY, self.Width-4, self.Height)
  34. draw.AARoundRect(canvas_, &rect_, self.BackgroundColor, 4, 0, self.BackgroundColor)
  35. }
  36. }