I know enough to be dangerous so far so please be kind! I have a project that i can scale the window to different scales by pressing the 123or 4 number. the graphics all scale but my mouseclicks are all at the original spots making everything off. Im not sure how to even go about this but how do I increase the window and all its components together?
i start with these window settings in the main love.load.
Any help would be greatly appreciated.
function love.load()
love.window.setMode(900, 600, {resizable=true, vsync=false, minwidth=400, minheight=300})
love.window.setPosition(300,100)
love.graphics.scale(SCALE,SCALE)
COREWIDTH = 600
COREHEIGHT =400
SCALE = 1
Scaling and scaling xy values?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- Prole
- Posts: 2
- Joined: Fri Nov 13, 2020 6:51 pm
Scaling and scaling xy values?
Chris Turner
Re: Scaling and scaling xy values?
You have to *scale* mouse coordinates.
Code: Select all
function love.mousepressed(x, y)
x = x * SCALE
y = y * SCALE
-- handle mousepressed events...
end
-
- Prole
- Posts: 2
- Joined: Fri Nov 13, 2020 6:51 pm
Re: Scaling and scaling xy values?
thank you for the response. seems like I cant get that to work. mouse still is way off when scaled up. not sure what Im doing wrong.
Chris Turner
Re: Scaling and scaling xy values?
The default program loop (love.run) resets the coordinate system (with love.graphics.origin) each frame, so your love.graphics.scale() in love.load() doesn't actually affect any drawing operations. You should call love.graphics.scale() right before drawing, together with what norubal said.
Tools: Hot Particles, LuaPreprocess, InputField, (more) Games: Momento Temporis
"If each mistake being made is a new one, then progress is being made."
"If each mistake being made is a new one, then progress is being made."
Who is online
Users browsing this forum: Bing [Bot] and 6 guests