explore graphics stack
This commit is contained in:
parent
63b296e19c
commit
21c432f583
1 changed files with 13 additions and 2 deletions
|
|
@ -67,6 +67,7 @@ local function initState()
|
|||
joystick = love.joystick.getJoysticks()[1]
|
||||
end
|
||||
return {
|
||||
debug = true,
|
||||
ship = {
|
||||
x = game.width / 2,
|
||||
y = game.height / 2,
|
||||
|
|
@ -204,21 +205,31 @@ function love.gamepadpressed(joystick, button)
|
|||
end
|
||||
|
||||
function love.draw()
|
||||
if state.debug then
|
||||
love.graphics.setColor(1, 1, 1)
|
||||
love.graphics.line(game.width / 2, 0, game.width / 2, game.height)
|
||||
love.graphics.line(0, game.height / 2, game.width, game.height / 2)
|
||||
end
|
||||
for y = -1, 1 do
|
||||
for x = -1, 1 do
|
||||
love.graphics.origin()
|
||||
love.graphics.translate(x * game.width, y * game.height)
|
||||
|
||||
love.graphics.push()
|
||||
love.graphics.translate(state.ship.x, state.ship.y)
|
||||
love.graphics.setColor(1, 1, 1)
|
||||
local scale = 2 * game.ship.radius / math.max(game.ship.sprite:getWidth(), game.ship.sprite:getHeight())
|
||||
love.graphics.draw(game.ship.sprite,
|
||||
state.ship.x,
|
||||
state.ship.y,
|
||||
0,
|
||||
0,
|
||||
(state.ship.facing + phys.tau / 4) % phys.tau,
|
||||
scale,
|
||||
scale,
|
||||
game.ship.sprite:getWidth() / 2,
|
||||
game.ship.sprite:getHeight() / 2
|
||||
)
|
||||
-- TODO rocket exhaust
|
||||
love.graphics.pop()
|
||||
|
||||
for _, bullet in ipairs(state.bullets) do
|
||||
love.graphics.setColor(0, 1, 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue