Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix both compatibility issues #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pong-1/push.lua
Original file line number Diff line number Diff line change
@@ -98,7 +98,7 @@ function push:setShader(name, shader)
end

function push:initValues()
self._PSCALE = self._highdpi and love.window.getPixelScale() or 1
self._PSCALE = self._highdpi and love.window.getDPIScale() or 1

self._SCALE = {
x = self._RWIDTH/self._WWIDTH * self._PSCALE,
@@ -218,7 +218,7 @@ function push:switchFullscreen(winw, winh)
end

function push:resize(w, h)
local pixelScale = love.window.getPixelScale()
local pixelScale = love.window.getDPIScale()
if self._highdpi then w, h = w / pixelScale, h / pixelScale end
self._RWIDTH = w
self._RHEIGHT = h
2 changes: 1 addition & 1 deletion pong-10/main.lua
Original file line number Diff line number Diff line change
@@ -255,7 +255,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)
love.graphics.clear(40/255, 45/255, 52/255, 1)

love.graphics.setFont(smallFont)

4 changes: 2 additions & 2 deletions pong-10/push.lua
Original file line number Diff line number Diff line change
@@ -98,7 +98,7 @@ function push:setShader(name, shader)
end

function push:initValues()
self._PSCALE = self._highdpi and love.window.getPixelScale() or 1
self._PSCALE = self._highdpi and love.window.getDPIScale() or 1

self._SCALE = {
x = self._RWIDTH/self._WWIDTH * self._PSCALE,
@@ -218,7 +218,7 @@ function push:switchFullscreen(winw, winh)
end

function push:resize(w, h)
local pixelScale = love.window.getPixelScale()
local pixelScale = love.window.getDPIScale()
if self._highdpi then w, h = w / pixelScale, h / pixelScale end
self._RWIDTH = w
self._RHEIGHT = h
2 changes: 1 addition & 1 deletion pong-11/main.lua
Original file line number Diff line number Diff line change
@@ -271,7 +271,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)
love.graphics.clear(40/255, 45/255, 52/255, 1)

love.graphics.setFont(smallFont)

4 changes: 2 additions & 2 deletions pong-11/push.lua
Original file line number Diff line number Diff line change
@@ -98,7 +98,7 @@ function push:setShader(name, shader)
end

function push:initValues()
self._PSCALE = self._highdpi and love.window.getPixelScale() or 1
self._PSCALE = self._highdpi and love.window.getDPIScale() or 1

self._SCALE = {
x = self._RWIDTH/self._WWIDTH * self._PSCALE,
@@ -218,7 +218,7 @@ function push:switchFullscreen(winw, winh)
end

function push:resize(w, h)
local pixelScale = love.window.getPixelScale()
local pixelScale = love.window.getDPIScale()
if self._highdpi then w, h = w / pixelScale, h / pixelScale end
self._RWIDTH = w
self._RHEIGHT = h
2 changes: 1 addition & 1 deletion pong-12/main.lua
Original file line number Diff line number Diff line change
@@ -279,7 +279,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)
love.graphics.clear(40/255, 45/255, 52/255, 1)

love.graphics.setFont(smallFont)

4 changes: 2 additions & 2 deletions pong-12/push.lua
Original file line number Diff line number Diff line change
@@ -98,7 +98,7 @@ function push:setShader(name, shader)
end

function push:initValues()
self._PSCALE = self._highdpi and love.window.getPixelScale() or 1
self._PSCALE = self._highdpi and love.window.getDPIScale() or 1

self._SCALE = {
x = self._RWIDTH/self._WWIDTH * self._PSCALE,
@@ -218,7 +218,7 @@ function push:switchFullscreen(winw, winh)
end

function push:resize(w, h)
local pixelScale = love.window.getPixelScale()
local pixelScale = love.window.getDPIScale()
if self._highdpi then w, h = w / pixelScale, h / pixelScale end
self._RWIDTH = w
self._RHEIGHT = h
2 changes: 1 addition & 1 deletion pong-2/main.lua
Original file line number Diff line number Diff line change
@@ -75,7 +75,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)
love.graphics.clear(40/255, 45/255, 52/255, 1)

-- draw welcome text toward the top of the screen
love.graphics.printf('Hello Pong!', 0, 20, VIRTUAL_WIDTH, 'center')
4 changes: 2 additions & 2 deletions pong-2/push.lua
Original file line number Diff line number Diff line change
@@ -98,7 +98,7 @@ function push:setShader(name, shader)
end

function push:initValues()
self._PSCALE = self._highdpi and love.window.getPixelScale() or 1
self._PSCALE = self._highdpi and love.window.getDPIScale() or 1

self._SCALE = {
x = self._RWIDTH/self._WWIDTH * self._PSCALE,
@@ -218,7 +218,7 @@ function push:switchFullscreen(winw, winh)
end

function push:resize(w, h)
local pixelScale = love.window.getPixelScale()
local pixelScale = love.window.getDPIScale()
if self._highdpi then w, h = w / pixelScale, h / pixelScale end
self._RWIDTH = w
self._RHEIGHT = h
2 changes: 1 addition & 1 deletion pong-3/main.lua
Original file line number Diff line number Diff line change
@@ -114,7 +114,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)
love.graphics.clear(40/255, 45/255, 52/255, 1)

-- draw welcome text toward the top of the screen
love.graphics.setFont(smallFont)
4 changes: 2 additions & 2 deletions pong-3/push.lua
Original file line number Diff line number Diff line change
@@ -98,7 +98,7 @@ function push:setShader(name, shader)
end

function push:initValues()
self._PSCALE = self._highdpi and love.window.getPixelScale() or 1
self._PSCALE = self._highdpi and love.window.getDPIScale() or 1

self._SCALE = {
x = self._RWIDTH/self._WWIDTH * self._PSCALE,
@@ -218,7 +218,7 @@ function push:switchFullscreen(winw, winh)
end

function push:resize(w, h)
local pixelScale = love.window.getPixelScale()
local pixelScale = love.window.getDPIScale()
if self._highdpi then w, h = w / pixelScale, h / pixelScale end
self._RWIDTH = w
self._RHEIGHT = h
2 changes: 1 addition & 1 deletion pong-4/main.lua
Original file line number Diff line number Diff line change
@@ -153,7 +153,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)
love.graphics.clear(40/255, 45/255, 52/255, 1)

-- draw different things based on the state of the game
love.graphics.setFont(smallFont)
4 changes: 2 additions & 2 deletions pong-4/push.lua
Original file line number Diff line number Diff line change
@@ -98,7 +98,7 @@ function push:setShader(name, shader)
end

function push:initValues()
self._PSCALE = self._highdpi and love.window.getPixelScale() or 1
self._PSCALE = self._highdpi and love.window.getDPIScale() or 1

self._SCALE = {
x = self._RWIDTH/self._WWIDTH * self._PSCALE,
@@ -218,7 +218,7 @@ function push:switchFullscreen(winw, winh)
end

function push:resize(w, h)
local pixelScale = love.window.getPixelScale()
local pixelScale = love.window.getDPIScale()
if self._highdpi then w, h = w / pixelScale, h / pixelScale end
self._RWIDTH = w
self._RHEIGHT = h
2 changes: 1 addition & 1 deletion pong-5/main.lua
Original file line number Diff line number Diff line change
@@ -154,7 +154,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)
love.graphics.clear(40/255, 45/255, 52/255, 1)

-- draw different things based on the state of the game
love.graphics.setFont(smallFont)
4 changes: 2 additions & 2 deletions pong-5/push.lua
Original file line number Diff line number Diff line change
@@ -98,7 +98,7 @@ function push:setShader(name, shader)
end

function push:initValues()
self._PSCALE = self._highdpi and love.window.getPixelScale() or 1
self._PSCALE = self._highdpi and love.window.getDPIScale() or 1

self._SCALE = {
x = self._RWIDTH/self._WWIDTH * self._PSCALE,
@@ -218,7 +218,7 @@ function push:switchFullscreen(winw, winh)
end

function push:resize(w, h)
local pixelScale = love.window.getPixelScale()
local pixelScale = love.window.getDPIScale()
if self._highdpi then w, h = w / pixelScale, h / pixelScale end
self._RWIDTH = w
self._RHEIGHT = h
2 changes: 1 addition & 1 deletion pong-6/main.lua
Original file line number Diff line number Diff line change
@@ -168,7 +168,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)
love.graphics.clear(40/255, 45/255, 52/255, 1)

-- draw different things based on the state of the game
love.graphics.setFont(smallFont)
4 changes: 2 additions & 2 deletions pong-6/push.lua
Original file line number Diff line number Diff line change
@@ -98,7 +98,7 @@ function push:setShader(name, shader)
end

function push:initValues()
self._PSCALE = self._highdpi and love.window.getPixelScale() or 1
self._PSCALE = self._highdpi and love.window.getDPIScale() or 1

self._SCALE = {
x = self._RWIDTH/self._WWIDTH * self._PSCALE,
@@ -218,7 +218,7 @@ function push:switchFullscreen(winw, winh)
end

function push:resize(w, h)
local pixelScale = love.window.getPixelScale()
local pixelScale = love.window.getDPIScale()
if self._highdpi then w, h = w / pixelScale, h / pixelScale end
self._RWIDTH = w
self._RHEIGHT = h
2 changes: 1 addition & 1 deletion pong-7/main.lua
Original file line number Diff line number Diff line change
@@ -207,7 +207,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)
love.graphics.clear(40/255, 45/255, 52/255, 1)

-- draw different things based on the state of the game
love.graphics.setFont(smallFont)
4 changes: 2 additions & 2 deletions pong-7/push.lua
Original file line number Diff line number Diff line change
@@ -98,7 +98,7 @@ function push:setShader(name, shader)
end

function push:initValues()
self._PSCALE = self._highdpi and love.window.getPixelScale() or 1
self._PSCALE = self._highdpi and love.window.getDPIScale() or 1

self._SCALE = {
x = self._RWIDTH/self._WWIDTH * self._PSCALE,
@@ -218,7 +218,7 @@ function push:switchFullscreen(winw, winh)
end

function push:resize(w, h)
local pixelScale = love.window.getPixelScale()
local pixelScale = love.window.getDPIScale()
if self._highdpi then w, h = w / pixelScale, h / pixelScale end
self._RWIDTH = w
self._RHEIGHT = h
2 changes: 1 addition & 1 deletion pong-8/main.lua
Original file line number Diff line number Diff line change
@@ -223,7 +223,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)
love.graphics.clear(40/255, 45/255, 52/255, 1)

-- draw different things based on the state of the game
love.graphics.setFont(smallFont)
4 changes: 2 additions & 2 deletions pong-8/push.lua
Original file line number Diff line number Diff line change
@@ -98,7 +98,7 @@ function push:setShader(name, shader)
end

function push:initValues()
self._PSCALE = self._highdpi and love.window.getPixelScale() or 1
self._PSCALE = self._highdpi and love.window.getDPIScale() or 1

self._SCALE = {
x = self._RWIDTH/self._WWIDTH * self._PSCALE,
@@ -218,7 +218,7 @@ function push:switchFullscreen(winw, winh)
end

function push:resize(w, h)
local pixelScale = love.window.getPixelScale()
local pixelScale = love.window.getDPIScale()
if self._highdpi then w, h = w / pixelScale, h / pixelScale end
self._RWIDTH = w
self._RHEIGHT = h
2 changes: 1 addition & 1 deletion pong-9/main.lua
Original file line number Diff line number Diff line change
@@ -226,7 +226,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)
love.graphics.clear(40/255, 45/255, 52/255, 1)

love.graphics.setFont(smallFont)

4 changes: 2 additions & 2 deletions pong-9/push.lua
Original file line number Diff line number Diff line change
@@ -98,7 +98,7 @@ function push:setShader(name, shader)
end

function push:initValues()
self._PSCALE = self._highdpi and love.window.getPixelScale() or 1
self._PSCALE = self._highdpi and love.window.getDPIScale() or 1

self._SCALE = {
x = self._RWIDTH/self._WWIDTH * self._PSCALE,
@@ -218,7 +218,7 @@ function push:switchFullscreen(winw, winh)
end

function push:resize(w, h)
local pixelScale = love.window.getPixelScale()
local pixelScale = love.window.getDPIScale()
if self._highdpi then w, h = w / pixelScale, h / pixelScale end
self._RWIDTH = w
self._RHEIGHT = h
2 changes: 1 addition & 1 deletion pong-final/main.lua
Original file line number Diff line number Diff line change
@@ -303,7 +303,7 @@ function love.draw()
-- begin drawing with push, in our virtual resolution
push:start()

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

-- render different things depending on which part of the game we're in
if gameState == 'start' then
2 changes: 1 addition & 1 deletion pong-final/push.lua
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

local love11 = love.getVersion() == 11
local getDPI = love11 and love.window.getDPIScale or love.window.getPixelScale
local getDPI = love11 and love.window.getDPIScale or love.window.getDPIScale

local push = {

4 changes: 2 additions & 2 deletions pong-final/push_old.lua
Original file line number Diff line number Diff line change
@@ -98,7 +98,7 @@ function push:setShader(name, shader)
end

function push:initValues()
self._PSCALE = self._highdpi and love.window.getPixelScale() or 1
self._PSCALE = self._highdpi and love.window.getDPIScale() or 1

self._SCALE = {
x = self._RWIDTH/self._WWIDTH * self._PSCALE,
@@ -218,7 +218,7 @@ function push:switchFullscreen(winw, winh)
end

function push:resize(w, h)
local pixelScale = love.window.getPixelScale()
local pixelScale = love.window.getDPIScale()
if self._highdpi then w, h = w / pixelScale, h / pixelScale end
self._RWIDTH = w
self._RHEIGHT = h