Jump to content


Photo

Surface Mouse_x / Y


  • Please log in to reply
3 replies to this topic

#1 Pstadler

Pstadler

    GMC Member

  • GMC Member
  • 58 posts

Posted 08 August 2009 - 01:29 AM

Good day,
I have a problem with my surface. I created a surface then tried to draw a sprite at mouse_x / mouse_y, but I recognized that the sprite isn't actually drawn where it should be.

() sprite

() cursor (mouse_x mouse_y)


Is it because of the surface has its own x and y? How can I fix this problem?

Thanks


EDIT:
Problem only when scaling the surface!

Edited by Pstadler, 08 August 2009 - 01:35 AM.

  • 0

#2 ragarnak

ragarnak

    GMC Member

  • Retired Staff
  • 19468 posts
  • Version:GM8

Posted 08 August 2009 - 01:56 AM

I have a problem with my surface. I created a surface then tried to draw a sprite at mouse_x / mouse_y, but I recognized that the sprite isn't actually drawn where it should be.

Those mouse-coordinates are respective to the current View, the pixel at the top-left of the surface is allways at the 0,0 coordinate (even when used in the draw-event).

Hope that helps.
  • 0

#3 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • Global Moderators
  • 14393 posts
  • Version:GM:Studio

Posted 08 August 2009 - 04:59 AM

call

d3d_transform_set_translation(-view_xview, -view_yview, 0);

before you draw to the surface

and when done call
d3d_transform_add_translation(view_xview, view_yview, 0);


or simple draw at mouse_x-view_xview, mouse_y-view_yview like rag is implying so subtly

Edited by icuurd12b42, 08 August 2009 - 05:01 AM.

  • 0

#4 Pstadler

Pstadler

    GMC Member

  • GMC Member
  • 58 posts

Posted 08 August 2009 - 09:55 PM

Thank you guys very much!
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users