Given d3d_set_ortho isnt cross platform compatible, I was wondering how people are approaching drawing overlays/HUDs, particularly in games where the same view is zooming the rest of the room.
Having certain objects offset the zoom with draw_sprite_ext works ok for sprites, but not for fonts afaik.
So is it surfaces? drawing everything in your overlay to a surface, then using draw_surface_ext at a scale factor which counters the view scaling?
Thanks for any contributions.
Best method for HUD
Started by vann, Apr 15 2012 02:28 PM
5 replies to this topic
#1
Posted 15 April 2012 - 02:28 PM
#2
Posted 15 April 2012 - 03:11 PM
draw_sprite(sprite,img,view_xview[0]+100,view_yview[0]+200).
The same with text.
Is that?
The same with text.
Is that?
#3
Posted 15 April 2012 - 03:41 PM
draw_sprite(sprite,img,view_xview[0]+100,view_yview[0]+200).
The same with text.
Is that?
Exe_Mas, thanks for your reply.
That would have the text and sprites follow the view, but it wont scale them if the view port is not 1:1 with the view size.
Edited by vann, 15 April 2012 - 03:42 PM.
#4
Posted 15 April 2012 - 04:26 PM
If you use Exe_Mas's solution doesn't GM just automatically scale the view onto the port? If not, and you are drawing the HUD outside the view or on top of it, can't you use the port and view size variables to scale?
i.e.
Or for the various HUD components:
i.e.
xscale = view_wport/view_wview; yscale = view_hport/view_hview;
Or for the various HUD components:
// For sprites draw_sprite_ext(sprite, image, x, y, view_wport/view_wview, view_hport/view_hview, rotation, color, alpha); // For text draw_text_ext_transformed(x, y, string, sep, width, view_wport/view_wview, view_hport/view_hview, rotation); // Or if you draw all the text and sprites onto a surface draw_surface_ext(surface, x, y, view_wport/view_wview, view_hport/view_hview, rotation, color, alpha);
Edited by Centauri, 15 April 2012 - 04:27 PM.
#5
Posted 16 April 2012 - 09:40 AM
Centauri,
Actually, the key bit here I hadn't spotted before was the text function
draw_text_ext_transformed
With that in mind, the solution Exe_Mas eludes to would work fine. So thank you both.
Ill consider the surface solution too, but I try to have some fall back options for anything relying on surfaces still.
Actually, the key bit here I hadn't spotted before was the text function
draw_text_ext_transformed
With that in mind, the solution Exe_Mas eludes to would work fine. So thank you both.
Ill consider the surface solution too, but I try to have some fall back options for anything relying on surfaces still.
#6
Posted 23 April 2012 - 06:53 AM
I should say, I tested using draw_text_transformed & when using it to counter-act the view scaling, it produces really terrible results.
It's not hugely suprising, but it means theres no way thats an option for HUDs when the view is being scaled or manipulated in some way.
Back to surfaces as this stage if it needs to be cross platform.
It's not hugely suprising, but it means theres no way thats an option for HUDs when the view is being scaled or manipulated in some way.
Back to surfaces as this stage if it needs to be cross platform.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











