Skip to content

Commit

Permalink
fix call to graphics.clear for love 11
Browse files Browse the repository at this point in the history
  • Loading branch information
simleo committed Nov 3, 2018
1 parent 7efa8d6 commit 2a4ab88
Show file tree
Hide file tree
Showing 12 changed files with 132 additions and 12 deletions.
12 changes: 11 additions & 1 deletion pong-10/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ VIRTUAL_HEIGHT = 243
-- speed at which we will move our paddle; multiplied by dt in update
PADDLE_SPEED = 200

--[[
Love 11 compat
]]
function clear(r, g, b, a)
if love.getVersion() >= 11 then
r, g, b, a = r / 255, g / 255, b / 255, a / 255
end
love.graphics.clear(r, g, b, a)
end

--[[
Runs when the game first starts up, only once; used to initialize the game.
]]
Expand Down Expand Up @@ -257,7 +267,7 @@ function love.draw()

-- clear the screen with a specific color; in this case, a color similar
-- to some versions of the original Pong
love.graphics.clear(40, 45, 52, 255)
clear(40, 45, 52, 255)

love.graphics.setFont(smallFont)

Expand Down
12 changes: 11 additions & 1 deletion pong-11/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ VIRTUAL_HEIGHT = 243
-- speed at which we will move our paddle; multiplied by dt in update
PADDLE_SPEED = 200

--[[
Love 11 compat
]]
function clear(r, g, b, a)
if love.getVersion() >= 11 then
r, g, b, a = r / 255, g / 255, b / 255, a / 255
end
love.graphics.clear(r, g, b, a)
end

--[[
Runs when the game first starts up, only once; used to initialize the game.
]]
Expand Down Expand Up @@ -273,7 +283,7 @@ function love.draw()

-- clear the screen with a specific color; in this case, a color similar
-- to some versions of the original Pong
love.graphics.clear(40, 45, 52, 255)
clear(40, 45, 52, 255)

love.graphics.setFont(smallFont)

Expand Down
12 changes: 11 additions & 1 deletion pong-12/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ VIRTUAL_HEIGHT = 243
-- speed at which we will move our paddle; multiplied by dt in update
PADDLE_SPEED = 200

--[[
Love 11 compat
]]
function clear(r, g, b, a)
if love.getVersion() >= 11 then
r, g, b, a = r / 255, g / 255, b / 255, a / 255
end
love.graphics.clear(r, g, b, a)
end

--[[
Runs when the game first starts up, only once; used to initialize the game.
]]
Expand Down Expand Up @@ -281,7 +291,7 @@ function love.draw()

-- clear the screen with a specific color; in this case, a color similar
-- to some versions of the original Pong
love.graphics.clear(40, 45, 52, 255)
clear(40, 45, 52, 255)

love.graphics.setFont(smallFont)

Expand Down
12 changes: 11 additions & 1 deletion pong-2/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ WINDOW_HEIGHT = 720
VIRTUAL_WIDTH = 432
VIRTUAL_HEIGHT = 243

--[[
Love 11 compat
]]
function clear(r, g, b, a)
if love.getVersion() >= 11 then
r, g, b, a = r / 255, g / 255, b / 255, a / 255
end
love.graphics.clear(r, g, b, a)
end

--[[
Runs when the game first starts up, only once; used to initialize the game.
]]
Expand Down Expand Up @@ -77,7 +87,7 @@ function love.draw()

-- clear the screen with a specific color; in this case, a color similar
-- to some versions of the original Pong
love.graphics.clear(40, 45, 52, 255)
clear(40, 45, 52, 255)

-- draw welcome text toward the top of the screen
love.graphics.printf('Hello Pong!', 0, 20, VIRTUAL_WIDTH, 'center')
Expand Down
12 changes: 11 additions & 1 deletion pong-3/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ VIRTUAL_HEIGHT = 243
-- speed at which we will move our paddle; multiplied by dt in update
PADDLE_SPEED = 200

--[[
Love 11 compat
]]
function clear(r, g, b, a)
if love.getVersion() >= 11 then
r, g, b, a = r / 255, g / 255, b / 255, a / 255
end
love.graphics.clear(r, g, b, a)
end

--[[
Runs when the game first starts up, only once; used to initialize the game.
]]
Expand Down Expand Up @@ -116,7 +126,7 @@ function love.draw()

-- clear the screen with a specific color; in this case, a color similar
-- to some versions of the original Pong
love.graphics.clear(40, 45, 52, 255)
clear(40, 45, 52, 255)

-- draw welcome text toward the top of the screen
love.graphics.setFont(smallFont)
Expand Down
12 changes: 11 additions & 1 deletion pong-4/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ VIRTUAL_HEIGHT = 243
-- speed at which we will move our paddle; multiplied by dt in update
PADDLE_SPEED = 200

--[[
Love 11 compat
]]
function clear(r, g, b, a)
if love.getVersion() >= 11 then
r, g, b, a = r / 255, g / 255, b / 255, a / 255
end
love.graphics.clear(r, g, b, a)
end

--[[
Runs when the game first starts up, only once; used to initialize the game.
]]
Expand Down Expand Up @@ -155,7 +165,7 @@ function love.draw()

-- clear the screen with a specific color; in this case, a color similar
-- to some versions of the original Pong
love.graphics.clear(40, 45, 52, 255)
clear(40, 45, 52, 255)

-- draw different things based on the state of the game
love.graphics.setFont(smallFont)
Expand Down
12 changes: 11 additions & 1 deletion pong-5/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ VIRTUAL_HEIGHT = 243
-- speed at which we will move our paddle; multiplied by dt in update
PADDLE_SPEED = 200

--[[
Love 11 compat
]]
function clear(r, g, b, a)
if love.getVersion() >= 11 then
r, g, b, a = r / 255, g / 255, b / 255, a / 255
end
love.graphics.clear(r, g, b, a)
end

--[[
Runs when the game first starts up, only once; used to initialize the game.
]]
Expand Down Expand Up @@ -156,7 +166,7 @@ function love.draw()

-- clear the screen with a specific color; in this case, a color similar
-- to some versions of the original Pong
love.graphics.clear(40, 45, 52, 255)
clear(40, 45, 52, 255)

-- draw different things based on the state of the game
love.graphics.setFont(smallFont)
Expand Down
12 changes: 11 additions & 1 deletion pong-6/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ VIRTUAL_HEIGHT = 243
-- speed at which we will move our paddle; multiplied by dt in update
PADDLE_SPEED = 200

--[[
Love 11 compat
]]
function clear(r, g, b, a)
if love.getVersion() >= 11 then
r, g, b, a = r / 255, g / 255, b / 255, a / 255
end
love.graphics.clear(r, g, b, a)
end

--[[
Runs when the game first starts up, only once; used to initialize the game.
]]
Expand Down Expand Up @@ -170,7 +180,7 @@ function love.draw()

-- clear the screen with a specific color; in this case, a color similar
-- to some versions of the original Pong
love.graphics.clear(40, 45, 52, 255)
clear(40, 45, 52, 255)

-- draw different things based on the state of the game
love.graphics.setFont(smallFont)
Expand Down
12 changes: 11 additions & 1 deletion pong-7/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ VIRTUAL_HEIGHT = 243
-- speed at which we will move our paddle; multiplied by dt in update
PADDLE_SPEED = 200

--[[
Love 11 compat
]]
function clear(r, g, b, a)
if love.getVersion() >= 11 then
r, g, b, a = r / 255, g / 255, b / 255, a / 255
end
love.graphics.clear(r, g, b, a)
end

--[[
Runs when the game first starts up, only once; used to initialize the game.
]]
Expand Down Expand Up @@ -209,7 +219,7 @@ function love.draw()

-- clear the screen with a specific color; in this case, a color similar
-- to some versions of the original Pong
love.graphics.clear(40, 45, 52, 255)
clear(40, 45, 52, 255)

-- draw different things based on the state of the game
love.graphics.setFont(smallFont)
Expand Down
12 changes: 11 additions & 1 deletion pong-8/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ VIRTUAL_HEIGHT = 243
-- speed at which we will move our paddle; multiplied by dt in update
PADDLE_SPEED = 200

--[[
Love 11 compat
]]
function clear(r, g, b, a)
if love.getVersion() >= 11 then
r, g, b, a = r / 255, g / 255, b / 255, a / 255
end
love.graphics.clear(r, g, b, a)
end

--[[
Runs when the game first starts up, only once; used to initialize the game.
]]
Expand Down Expand Up @@ -225,7 +235,7 @@ function love.draw()

-- clear the screen with a specific color; in this case, a color similar
-- to some versions of the original Pong
love.graphics.clear(40, 45, 52, 255)
clear(40, 45, 52, 255)

-- draw different things based on the state of the game
love.graphics.setFont(smallFont)
Expand Down
12 changes: 11 additions & 1 deletion pong-9/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ VIRTUAL_HEIGHT = 243
-- speed at which we will move our paddle; multiplied by dt in update
PADDLE_SPEED = 200

--[[
Love 11 compat
]]
function clear(r, g, b, a)
if love.getVersion() >= 11 then
r, g, b, a = r / 255, g / 255, b / 255, a / 255
end
love.graphics.clear(r, g, b, a)
end

--[[
Runs when the game first starts up, only once; used to initialize the game.
]]
Expand Down Expand Up @@ -228,7 +238,7 @@ function love.draw()

-- clear the screen with a specific color; in this case, a color similar
-- to some versions of the original Pong
love.graphics.clear(40, 45, 52, 255)
clear(40, 45, 52, 255)

love.graphics.setFont(smallFont)

Expand Down
12 changes: 11 additions & 1 deletion pong-final/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ VIRTUAL_HEIGHT = 243
-- paddle movement speed
PADDLE_SPEED = 200

--[[
Love 11 compat
]]
function clear(r, g, b, a)
if love.getVersion() >= 11 then
r, g, b, a = r / 255, g / 255, b / 255, a / 255
end
love.graphics.clear(r, g, b, a)
end

--[[
Called just once at the beginning of the game; used to set up
game objects, variables, etc. and prepare the game world.
Expand Down Expand Up @@ -305,7 +315,7 @@ function love.draw()
-- begin drawing with push, in our virtual resolution
push:start()

love.graphics.clear(40, 45, 52, 255)
clear(40, 45, 52, 255)

-- render different things depending on which part of the game we're in
if gameState == 'start' then
Expand Down

0 comments on commit 2a4ab88

Please sign in to comment.