You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.0 KiB

  1. fullScreener = Class{}
  2. function fullScreener:init(a,b,c,d,e,f)
  3. self.a = a
  4. self.b = b
  5. self.c = c
  6. self.d = d
  7. self.e = e
  8. self.f = f
  9. end
  10. function fullScreener:toggle(vh, vw)
  11. self.a = self.a + 1
  12. if (self.a > 1) then
  13. self.a = 0
  14. end
  15. if (self.a == 0 ) then
  16. if (self.b == 1) then
  17. self.c = 1
  18. self.d = 1
  19. self.e = 0
  20. self.f = 0
  21. simpleScale.updateWindow(WINDOW_WIDTH, WINDOW_HEIGHT,{fullscreen = false})
  22. self.b = 0
  23. end
  24. end
  25. if (self.a == 1) then
  26. if (self.b == 0) then
  27. simpleScale.updateWindow(WINDOW_WIDTH, WINDOW_HEIGHT, {fullscreen = true})
  28. local newWidth = love.graphics.getWidth()
  29. local newHeight = love.graphics.getHeight()
  30. self.c = VIRTUAL_WIDTH / newWidth
  31. self.d = VIRTUAL_HEIGHT / newHeight
  32. self.e = math.fmod(newWidth * self.d, VIRTUAL_WIDTH) / 2
  33. self.f = math.fmod(newHeight * self.d, VIRTUAL_HEIGHT) / 2
  34. self.b = 1
  35. end
  36. end
  37. end