summaryrefslogtreecommitdiff
path: root/src/gnu_and_bola_brawlers/draw/default.lua
blob: a497604f012d02e1048964517e25b2da86a0e2c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
local draw = {}

--Get current time and update several parameters (time, fps print...)
draw.refresh = function()
  local currentTime = love.timer.getTime()
  if nextTime <= currentTime then
    nextTime = currentTime
    return
  end

  love.timer.sleep(nextTime - currentTime)

  love.graphics.scale(windowProfile.scale.x, windowProfile.scale.y)

  love.graphics.print('FPS: ' .. love.timer.getFPS(), 0, 0)
end

--Draw an object using base image  and character data to position, scale, etc...
draw.object = function(images, character)
  love.graphics.draw(
    images[1],
    images.quad,
    character.position.x,
    character.position.y,
    character.orientation,
    character.scale.x,
    character.scale.y,
    character.origin.x,
    character.origin.y
  )
end

return draw