62 lignes
1.1 KiB

  1. Gui = Class {}
  2. function Gui:init(tempScale)
  3. self.scale = tempScale
  4. end
  5. -- FUNCTIONS
  6. function Gui:drawSpeed()
  7. local speed = player:getSpeed()
  8. -- Drawing
  9. love.graphics.setColor(1, 1, 1)
  10. love.graphics.printf(speed, 5, 45, width, "left")
  11. end
  12. function Gui:drawWarp()
  13. local warp = warpspeed
  14. love.graphics.setColor(1, 1, 1)
  15. love.graphics.printf("Warp Speed: x"..warp, 5, 5, width, "left")
  16. end
  17. function Gui:drawThrottle()
  18. local offset = 15
  19. local border = 10
  20. local w,h = 60, 140
  21. local x, y = 0, height-h
  22. x, y = x+offset, y-offset
  23. -- Draw Border:
  24. local BDcol = 0.1
  25. love.graphics.setColor(BDcol, BDcol, BDcol)
  26. love.graphics.rectangle("fill", x, y, w, h)
  27. x, y = x+border, y+border
  28. w, h = w-border*2, h-border*2
  29. -- Draw Background:
  30. local BGcol = 0.4
  31. love.graphics.setColor(BGcol, BGcol, BGcol)
  32. love.graphics.rectangle("fill", x, y, w, h)
  33. -- Draw Throttle:
  34. love.graphics.setColor(1, 1, 1)
  35. local change = h*player.throttle
  36. love.graphics.rectangle("fill", x, (y+h)-change, w, change)
  37. end
  38. -- MAIN
  39. function Gui:update(dt)
  40. end
  41. function Gui:draw()
  42. self:drawThrottle()
  43. self:drawWarp()
  44. self:drawSpeed()
  45. end