graphics.lua 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. local lg = _G.love.graphics
  2. local graphics = { isCreated = lg and true or false }
  3. function graphics.newSpriteBatch(...)
  4. if graphics.isCreated then
  5. return lg.newSpriteBatch(...)
  6. end
  7. end
  8. function graphics.newCanvas(...)
  9. if graphics.isCreated then
  10. return lg.newCanvas(...)
  11. end
  12. end
  13. function graphics.newImage(...)
  14. if graphics.isCreated then
  15. return lg.newImage(...)
  16. end
  17. end
  18. function graphics.newQuad(...)
  19. if graphics.isCreated then
  20. return lg.newQuad(...)
  21. end
  22. end
  23. function graphics.getCanvas(...)
  24. if graphics.isCreated then
  25. return lg.getCanvas(...)
  26. end
  27. end
  28. function graphics.setCanvas(...)
  29. if graphics.isCreated then
  30. return lg.setCanvas(...)
  31. end
  32. end
  33. function graphics.clear(...)
  34. if graphics.isCreated then
  35. return lg.clear(...)
  36. end
  37. end
  38. function graphics.push(...)
  39. if graphics.isCreated then
  40. return lg.push(...)
  41. end
  42. end
  43. function graphics.origin(...)
  44. if graphics.isCreated then
  45. return lg.origin(...)
  46. end
  47. end
  48. function graphics.scale(...)
  49. if graphics.isCreated then
  50. return lg.scale(...)
  51. end
  52. end
  53. function graphics.translate(...)
  54. if graphics.isCreated then
  55. return lg.translate(...)
  56. end
  57. end
  58. function graphics.pop(...)
  59. if graphics.isCreated then
  60. return lg.pop(...)
  61. end
  62. end
  63. function graphics.draw(...)
  64. if graphics.isCreated then
  65. return lg.draw(...)
  66. end
  67. end
  68. function graphics.rectangle(...)
  69. if graphics.isCreated then
  70. return lg.rectangle(...)
  71. end
  72. end
  73. function graphics.getColor(...)
  74. if graphics.isCreated then
  75. return lg.getColor(...)
  76. end
  77. end
  78. function graphics.setColor(...)
  79. if graphics.isCreated then
  80. return lg.setColor(...)
  81. end
  82. end
  83. function graphics.line(...)
  84. if graphics.isCreated then
  85. return lg.line(...)
  86. end
  87. end
  88. function graphics.polygon(...)
  89. if graphics.isCreated then
  90. return lg.polygon(...)
  91. end
  92. end
  93. function graphics.points(...)
  94. if graphics.isCreated then
  95. return lg.points(...)
  96. end
  97. end
  98. function graphics.getWidth()
  99. if graphics.isCreated then
  100. return lg.getWidth()
  101. end
  102. return 0
  103. end
  104. function graphics.getHeight()
  105. if graphics.isCreated then
  106. return lg.getHeight()
  107. end
  108. return 0
  109. end
  110. return graphics