## How can I resize an image without resizing the entire co-ordinate system

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
shabbs15
Prole
Posts: 6
Joined: Sat Jun 29, 2019 8:43 am

### How can I resize an image without resizing the entire co-ordinate system

Code: Select all

window = love.window.setMode( 500, 500 )
love.graphics.setDefaultFilter("nearest", "nearest", 0)

monsterImage = love.graphics.newImage("Monster.png")

love.graphics.setBackgroundColor(255, 255, 255)

function love.draw()
love.graphics.scale(4,4)
love.graphics.draw(monsterImage, 50, 50)
end

When I run this, the image is 4 times larger but it's position is also 4 times bigger so this means it is in the centre of the screen. How can I only enlarge the image and not it's position.

Sorry for the, I'm guessing, easy question

KayleMaster
Party member
Posts: 214
Joined: Mon Aug 29, 2016 8:51 am

### Re: How can I resize an image without resizing the entire co-ordinate system

Did you try scaling in the draw call instead of the entire stack? sx, sy are the parameters, check the API.

raidho36
Party member
Posts: 2001
Joined: Mon Jun 17, 2013 12:00 pm

### Re: How can I resize an image without resizing the entire co-ordinate system

Image is drawn at its top left corner, but you can offset it to draw it at its center instead. You can use extended draw command with more arguments to do this.

shabbs15
Prole
Posts: 6
Joined: Sat Jun 29, 2019 8:43 am

### Re: How can I resize an image without resizing the entire co-ordinate system

KayleMaster wrote:
Sat Jun 29, 2019 12:42 pm
Did you try scaling in the draw call instead of the entire stack? sx, sy are the parameters, check the API.
I thought I did that in the draw call. Can you expand on what you think I should do. Sorry for the late response btw

tahoma
Prole
Posts: 22
Joined: Mon Apr 22, 2019 1:13 am

### Re: How can I resize an image without resizing the entire co-ordinate system

shabbs15 wrote:
Tue Jul 02, 2019 3:14 pm
KayleMaster wrote:
Sat Jun 29, 2019 12:42 pm
Did you try scaling in the draw call instead of the entire stack? sx, sy are the parameters, check the API.
I thought I did that in the draw call. Can you expand on what you think I should do. Sorry for the late response btw
See the definition of the draw function. Scaling factors some in as inputs to the function.

pgimeno
Party member
Posts: 1946
Joined: Sun Oct 18, 2015 2:58 pm
Location: Valencia, ES

### Re: How can I resize an image without resizing the entire co-ordinate system

I think shabbs15 confused the draw event/callback (love.draw) with the draw call (love.graphics.draw).

### Who is online

Users browsing this forum: Google [Bot] and 11 guests