diff --git a/pong-1/push.lua b/pong-1/push.lua index 0e0709a..026fcb2 100644 --- a/pong-1/push.lua +++ b/pong-1/push.lua @@ -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 diff --git a/pong-10/main.lua b/pong-10/main.lua index 6f19e49..bdb6e16 100644 --- a/pong-10/main.lua +++ b/pong-10/main.lua @@ -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) diff --git a/pong-10/push.lua b/pong-10/push.lua index 0e0709a..026fcb2 100644 --- a/pong-10/push.lua +++ b/pong-10/push.lua @@ -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 diff --git a/pong-11/main.lua b/pong-11/main.lua index 58956e1..fe03279 100644 --- a/pong-11/main.lua +++ b/pong-11/main.lua @@ -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) diff --git a/pong-11/push.lua b/pong-11/push.lua index 0e0709a..026fcb2 100644 --- a/pong-11/push.lua +++ b/pong-11/push.lua @@ -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 diff --git a/pong-12/main.lua b/pong-12/main.lua index b06a998..e9aed91 100644 --- a/pong-12/main.lua +++ b/pong-12/main.lua @@ -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) diff --git a/pong-12/push.lua b/pong-12/push.lua index 0e0709a..026fcb2 100644 --- a/pong-12/push.lua +++ b/pong-12/push.lua @@ -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 diff --git a/pong-2/main.lua b/pong-2/main.lua index aa4b0bf..7f5aa6b 100644 --- a/pong-2/main.lua +++ b/pong-2/main.lua @@ -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') diff --git a/pong-2/push.lua b/pong-2/push.lua index 0e0709a..026fcb2 100644 --- a/pong-2/push.lua +++ b/pong-2/push.lua @@ -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 diff --git a/pong-3/main.lua b/pong-3/main.lua index c4aa3c8..23713b5 100644 --- a/pong-3/main.lua +++ b/pong-3/main.lua @@ -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) diff --git a/pong-3/push.lua b/pong-3/push.lua index 0e0709a..026fcb2 100644 --- a/pong-3/push.lua +++ b/pong-3/push.lua @@ -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 diff --git a/pong-4/main.lua b/pong-4/main.lua index 8d8bbcb..da91213 100644 --- a/pong-4/main.lua +++ b/pong-4/main.lua @@ -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) diff --git a/pong-4/push.lua b/pong-4/push.lua index 0e0709a..026fcb2 100644 --- a/pong-4/push.lua +++ b/pong-4/push.lua @@ -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 diff --git a/pong-5/main.lua b/pong-5/main.lua index 62222eb..3e59abe 100644 --- a/pong-5/main.lua +++ b/pong-5/main.lua @@ -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) diff --git a/pong-5/push.lua b/pong-5/push.lua index 0e0709a..026fcb2 100644 --- a/pong-5/push.lua +++ b/pong-5/push.lua @@ -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 diff --git a/pong-6/main.lua b/pong-6/main.lua index f86f891..ee2daf9 100644 --- a/pong-6/main.lua +++ b/pong-6/main.lua @@ -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) diff --git a/pong-6/push.lua b/pong-6/push.lua index 0e0709a..026fcb2 100644 --- a/pong-6/push.lua +++ b/pong-6/push.lua @@ -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 diff --git a/pong-7/main.lua b/pong-7/main.lua index 0c940ee..bac37ba 100644 --- a/pong-7/main.lua +++ b/pong-7/main.lua @@ -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) diff --git a/pong-7/push.lua b/pong-7/push.lua index 0e0709a..026fcb2 100644 --- a/pong-7/push.lua +++ b/pong-7/push.lua @@ -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 diff --git a/pong-8/main.lua b/pong-8/main.lua index 2d4873f..ad430d8 100644 --- a/pong-8/main.lua +++ b/pong-8/main.lua @@ -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) diff --git a/pong-8/push.lua b/pong-8/push.lua index 0e0709a..026fcb2 100644 --- a/pong-8/push.lua +++ b/pong-8/push.lua @@ -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 diff --git a/pong-9/main.lua b/pong-9/main.lua index d7f1b58..e34bdd8 100644 --- a/pong-9/main.lua +++ b/pong-9/main.lua @@ -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) diff --git a/pong-9/push.lua b/pong-9/push.lua index 0e0709a..026fcb2 100644 --- a/pong-9/push.lua +++ b/pong-9/push.lua @@ -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 diff --git a/pong-final/main.lua b/pong-final/main.lua index c8df5fc..4ca030c 100644 --- a/pong-final/main.lua +++ b/pong-final/main.lua @@ -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 diff --git a/pong-final/push.lua b/pong-final/push.lua index 723eb26..c9f2aa8 100644 --- a/pong-final/push.lua +++ b/pong-final/push.lua @@ -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 = { diff --git a/pong-final/push_old.lua b/pong-final/push_old.lua index 0e0709a..026fcb2 100644 --- a/pong-final/push_old.lua +++ b/pong-final/push_old.lua @@ -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