Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. def SetSize(self, width, height):
  2.  
  3. width = max(self.CORNER_WIDTH*2, width)
  4. height = max(self.CORNER_HEIGHT*2, height)
  5. Window.SetSize(self, width, height)
  6.  
  7. self.Corners[self.LB].SetPosition(0, height - self.CORNER_HEIGHT)
  8. self.Corners[self.RT].SetPosition(width - self.CORNER_WIDTH, 0)
  9. self.Corners[self.RB].SetPosition(width - self.CORNER_WIDTH, height - self.CORNER_HEIGHT)
  10. self.Lines[self.R].SetPosition(width - self.CORNER_WIDTH, self.CORNER_HEIGHT)
  11. self.Lines[self.B].SetPosition(self.CORNER_WIDTH, height - self.CORNER_HEIGHT)
  12.  
  13. verticalShowingPercentage = float((height - self.CORNER_HEIGHT*2) - self.LINE_HEIGHT) / self.LINE_HEIGHT
  14. horizontalShowingPercentage = float((width - self.CORNER_WIDTH*2) - self.LINE_WIDTH) / self.LINE_WIDTH
  15. self.Lines[self.L].SetRenderingRect(0, 0, 0, verticalShowingPercentage)
  16. self.Lines[self.R].SetRenderingRect(0, 0, 0, verticalShowingPercentage)
  17. self.Lines[self.T].SetRenderingRect(0, 0, horizontalShowingPercentage, 0)
  18. self.Lines[self.B].SetRenderingRect(0, 0, horizontalShowingPercentage, 0)
  19.  
  20. CORNER_WIDTH = 4
  21. CORNER_HEIGHT = 4
  22. LINE_WIDTH = 4
  23. LINE_HEIGHT = 4
  24. BOARD_COLOR = 0xFF070707
  25.  
  26. LT = 0
  27. LB = 1
  28. RT = 2
  29. RB = 3
  30. L = 0
  31. R = 1
  32. T = 2
  33. B = 3
  34.  
  35. def __init__(self, layer = "UI"):
  36. Window.__init__(self, layer)
  37.  
  38. CornerFileNames = [ "d:/ymir work/ui/pattern/thinboardcircle/ThinBoard_Corner_"+dir+"_circle.tga" for dir in ["LeftTop","LeftBottom","RightTop","RightBottom"] ]
  39. LineFileNames = [ "d:/ymir work/ui/pattern/thinboardcircle/ThinBoard_Line_"+dir+"_circle.tga" for dir in ["Left","Right","Top","Bottom"] ]
  40.  
  41. self.Corners = []
  42. for fileName in CornerFileNames:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement