Weastøne Entertainment
Member
Hello there!,
I am having some difficulties with surfaces when trying to use them as background; first of all, I'd like to use the draw gui event for that instead of the regular draw event.
Then, there are two methods I am considering which are to create a sprite from the application surface, or to directly copy the application surface (which I would prefer). The problem is that when I try to do this methods, the first one just doesn't scale correctly (not even in the regular draw event), and the second one has a little bit of misplacement that needs adjustment in some way I haven't figured out...
The code for the surface is:
and then at the Draw GUI event:
(I free the surface after using it)
The problem with this is that it draws ULTRA zoomed in, and I don't understand why...
Could anyone advise me?, or suggest a better way?
Thank you very much!
Edit: Solution found
What I did was to draw it on the regular draw event:
End Step:
Draw:
where paused_x/y are the view_x/yport, and
I am having some difficulties with surfaces when trying to use them as background; first of all, I'd like to use the draw gui event for that instead of the regular draw event.
Then, there are two methods I am considering which are to create a sprite from the application surface, or to directly copy the application surface (which I would prefer). The problem is that when I try to do this methods, the first one just doesn't scale correctly (not even in the regular draw event), and the second one has a little bit of misplacement that needs adjustment in some way I haven't figured out...
The code for the surface is:
Code:
surface_width = surface_get_width(application_surface);
surface_height = surface_get_height(application_surface);
surface = surface_create(surface_width, surface_height);
surface_copy(surface, 0, 0, application_surface);
Code:
if (surface_exists(surface)) {
draw_surface(surface, 0, 0);
}
The problem with this is that it draws ULTRA zoomed in, and I don't understand why...
Could anyone advise me?, or suggest a better way?
Thank you very much!
Edit: Solution found
What I did was to draw it on the regular draw event:
End Step:
Code:
gpu_set_blendmode_ext(bm_one, bm_one);
surface = surface_create(camera_get_view_width(0), camera_get_view_height(0));
surface_copy(surface, view_xport[0], view_yport[0], application_surface);
gpu_set_blendmode(bm_normal);
Code:
if (surface_exists(surface)) {
draw_surface_ext(surface, surface_x, surface_y, surface_xscale, surface_yscale, 0, c_white, 1);
}
Code:
surface_xscale = view_wport[0] / camera_get_view_width(0);
surface_yscale = view_hport[0] / camera_get_view_height(0);
Last edited: