Stalker-x with translate and scale mouse help

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
yetneverdone
Party member
Posts: 446
Joined: Sat Sep 24, 2016 11:20 am
Contact:

Stalker-x with translate and scale mouse help

Post by yetneverdone »

I need help,
im using stalker-x camera lib, im also using translate and scale as follows:

Code: Select all

function love.draw()
  lg.push()
  lg.scale(game_ratio)
  lg.translate(windowWidth/2/game_ratio-gameWidth/2, windowHeight/2/game_ratio-gameHeight/2) --this draws the game in the center of the window
  Camera: attach ()
  --other draw stuffs
  Camera:detach()
  lg.pop()
end
Before that, i have a clickEntity function, which checks if i clicked on an entity, but now after using camera and translate and scale, i cant get the proper coordinates for checking
User avatar
Nikki
Citizen
Posts: 83
Joined: Wed Jan 25, 2017 5:42 pm

Re: Stalker-x with translate and scale mouse help

Post by Nikki »

I am no familiar with stalker-x perse, but it sounds like you need to get the world coords given your mousecoords.
https://github.com/SSYGEN/STALKER-X#toworldcoordsx-y
User avatar
yetneverdone
Party member
Posts: 446
Joined: Sat Sep 24, 2016 11:20 am
Contact:

Re: Stalker-x with translate and scale mouse help

Post by yetneverdone »

Nikki wrote: Mon Feb 19, 2018 1:59 pm I am no familiar with stalker-x perse, but it sounds like you need to get the world coords given your mousecoords.
https://github.com/SSYGEN/STALKER-X#toworldcoordsx-y
Ive tried that, not working as well. The position is kinda off, like it's working when i click a few pixels above the entity itself
lachlaan
Prole
Posts: 30
Joined: Sun Jun 30, 2013 7:23 pm

Re: Stalker-x with translate and scale mouse help

Post by lachlaan »

Try derpy debugging like i do. Print stuff out like the position of your entity and the position of your cursor. Check if the scaling doesn't mess with the actual resolution the game is processed in vs the cursor.
hasen
Party member
Posts: 157
Joined: Sat Jan 20, 2018 2:01 pm

Re: Stalker-x with translate and scale mouse help

Post by hasen »

Use the getMousePosition() function from the Stalker-X library.
Post Reply

Who is online

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