FoxyOfJungle
Kazan Games
Hello, everyone!
Objective:
Obtain the mouse position within the room.
Problem:
if I use the "view" in normal size and with
But, if I disable the application_surface and I create a new surface and use that surface using view_set_surface_id() as a view, the values of
See:
Look at the RED area. Note that when I assign the view to the surface, the coordinates change immediately.
There is a "view" that is associated with a "camera", in which it view the room. And this "view" is being drawn on the "surface". I used view_set_surface_id() to do that.
I noticed that the value returned from
CREATE EVENT:
DRAW GUI EVENT:
It can be some calculation that uses the coordinates of the GUI, mouse_x and y and the size of the surface or the room size, but I don't know what to do. I spent hours trying to solve this, I need help
Thank you
Objective:
Obtain the mouse position within the room.
Problem:
if I use the "view" in normal size and with
application_surface
enabled, the mouse_x
and mouse_y
work normally. (for now ok).But, if I disable the application_surface and I create a new surface and use that surface using view_set_surface_id() as a view, the values of
mouse_x
and mouse_y
change:See:
Look at the RED area. Note that when I assign the view to the surface, the coordinates change immediately.
There is a "view" that is associated with a "camera", in which it view the room. And this "view" is being drawn on the "surface". I used view_set_surface_id() to do that.
I noticed that the value returned from
mouse_x
and mouse_y
, always has the highest value equal to the size of the room.CREATE EVENT:
GML:
// Initialize Surfaces
workplace_surface = -1; //workplace view surface
workplace_width = 500;
workplace_height = 280;
workplace_x = 100;
workplace_y = 50;
// Setup Views and Cameras
application_surface_draw_enable(true); //setup application surface
view_enabled = true; //enable the use of views
view_set_visible(0, true); //make view 0 visible
workplace_camera = camera_create_view(0, 0, workplace_width, workplace_height, 0, -1, -1, -1, 0, 0); //create workplace camera
view_set_camera(0, workplace_camera);
view_set_wport(0, workplace_width); //(the surface used should be the size of the view camera itself (not the view port))
view_set_hport(0, workplace_height);
workplace_zoomlevel = 1;
workplace_zoomwidth_default = workplace_width;
workplace_zoomheight_default = workplace_height;
workplace_follow_x = 0;
workplace_follow_y = 0;
DRAW GUI EVENT:
GML:
// workplace surface draw
if surface_exists(workplace_surface)
{
draw_surface(workplace_surface, workplace_x, workplace_y);
draw_rectangle_color(workplace_x, workplace_y, workplace_x+workplace_width, workplace_y+workplace_height, c_white,c_white,c_white,c_white,true);
}
else
{
workplace_surface = surface_create(workplace_width, workplace_height);
surface_set_target(workplace_surface);
draw_clear_alpha(c_black, 0);
surface_reset_target();
view_set_surface_id(0,workplace_surface);
}
It can be some calculation that uses the coordinates of the GUI, mouse_x and y and the size of the surface or the room size, but I don't know what to do. I spent hours trying to solve this, I need help
Thank you
Last edited: