From 01a000b9fa5a54154ad569b3ef39c45031739386 Mon Sep 17 00:00:00 2001 From: Ivan Kuzmenko <6745157+rndtrash@users.noreply.github.com> Date: Mon, 1 Sep 2025 18:45:53 +0300 Subject: [PATCH] Implemented the mouse scale patch on native platform --- game/hammouse.gif | Bin 0 -> 219 bytes game/hammouse.png | Bin 0 -> 329 bytes game/main.lua | 17 +++++++++++------ game/platform/native.lua | 28 +++++++++++++++++++++++++++- 4 files changed, 38 insertions(+), 7 deletions(-) create mode 100644 game/hammouse.gif create mode 100644 game/hammouse.png diff --git a/game/hammouse.gif b/game/hammouse.gif new file mode 100644 index 0000000000000000000000000000000000000000..ccfc3e8d69160c2967c6f6518418f7275397827e GIT binary patch literal 219 zcmZ?wbhEHbRA5kGIK;*P1Qr$+E-o$+5fRzh+5a0H{)2(yPZmZl26hG=kP47m2Id7E z1$X`#7zs?<^W(y--;0@^S0-fiN|*|$&0=FZ*rms^?sKI1cZEM&=CVEGmgwCTwQ^Ag zm->bWliTOGX?VU?$qugBatUo3T38k Q&M8RD-MczUmXpC60G@*C$b-1Z2$#IHL zf-ld(iNR!f!}V(ELdgqGA+P!G>N6HF@@QJ?EkD4wVAuL<&fjk{*m`h%Ti>AJx3^D_ z@pScbS?83{1ORaZeA)m2 literal 0 HcmV?d00001 diff --git a/game/main.lua b/game/main.lua index e563296..3cc12db 100644 --- a/game/main.lua +++ b/game/main.lua @@ -6,7 +6,7 @@ end local platform = require "platform.platform" local ttf local bf -local bfi +local hamsterMouse local function drawText(str, x, y) local font = love.graphics.getFont() @@ -18,10 +18,14 @@ function love.load() ttf = love.graphics.newFont() bf = love.graphics.newImageFont("font.png", - " abcdefghijklmnopqrstuvwxyz" .. - "ABCDEFGHIJKLMNOPQRSTUVWXYZ0" .. - "123456789.,!?-+/():;%&`'*#=[]\"") - bfi = love.graphics.newImage("font.png") + " abcdefghijklmnopqrstuvwxyz" .. + "ABCDEFGHIJKLMNOPQRSTUVWXYZ0" .. + "123456789.,!?-+/():;%&`'*#=[]\"") + if love.system.getOS() == 'DOS' then + hamsterMouse = love.graphics.newImage("hammouse.gif") + else + hamsterMouse = love.graphics.newImage("hammouse.png") + end end function love.draw() @@ -34,7 +38,8 @@ function love.draw() love.graphics.print(" abcdefghijklmnopqrstuvwxyz", 0, 110) love.graphics.print("ABCDEFGHIJKLMNOPQRSTUVWXYZ0", 0, 130) love.graphics.print("123456789.,!?-+/():;%&`'*#=[]\"", 0, 150) - love.graphics.draw(bfi, 0, 170) + + love.graphics.draw(hamsterMouse, love.mouse.getX(), love.mouse.getY()) platform.drawEnd() end diff --git a/game/platform/native.lua b/game/platform/native.lua index e5fada3..5b9d639 100644 --- a/game/platform/native.lua +++ b/game/platform/native.lua @@ -1,4 +1,4 @@ -local platform = {} +local platform = { mouse = {} } local screenWidth = 320 local screenHeight = 200 @@ -8,6 +8,7 @@ local canvas function platform.init() love.graphics.setDefaultFilter("nearest") + love.graphics.setCanvas() -- Reset the canvas to avoid any bugs love.window.setMode(screenWidth * screenScale, screenHeight * screenScale, { resizable = false, vsync = true }) canvas = love.graphics.newCanvas(screenWidth, screenHeight) end @@ -21,4 +22,29 @@ function platform.drawEnd() love.graphics.draw(canvas, 0, 0, 0, screenScale, screenScale) end +local mouseGetX = function() + return platform.mouse._ogMouseGetX() / screenScale +end +if mouseGetX ~= love.mouse.getX then + platform.mouse._ogMouseGetX = love.mouse.getX + love.mouse.getX = mouseGetX +end + +local mouseGetY = function() + return platform.mouse._ogMouseGetY() / screenScale +end +if mouseGetY ~= love.mouse.getY then + platform.mouse._ogMouseGetY = love.mouse.getY + love.mouse.getY = mouseGetY +end + +local mouseGetPosition = function() + local x, y = platform.mouse._ogMouseGetPosition() + return x / screenScale, y / screenScale +end +if mouseGetPosition ~= love.mouse.getPosition then + platform.mouse._ogMouseGetPosition = love.mouse.getPosition + love.mouse.getPosition = mouseGetPosition +end + return platform