Energy Engine
Member
Hello GMC,
As the title says, I'm wondering if it's possible to have:
. An application surface that is drawn 4x the native resolution of my game (4x window size and view, but keep ports unchanged), WHILE having one specific element rendered as a high resolution sprite where the sprite is also drawn 4x the native resolution. The high resolution rendering I'm talking about happens when increasing the port sizes also by 4x. I understand surfaces are a way to achieve this, but I'm having some difficulties. I basically need this so that when in-game scaling is done (which is a must), it doesn't look completely horrible.
When I perform in-game scaling, if the application surface is rendered such that the views, window sizes and importantly, the port sizes, are all increased to 4x, the in-game scaling looks good. However, if I increase everything except the port sizes and perform scaling, the sprites look too distorted. Yet, I need to have the option of rendering the application surface without changing the port sizes for sake of performance. So I figured a surface would help with this. Code is below:
surface object. Create:
Draw end:
Currently, with the above code, I get a black screen that covers the entire screen, with the test sprite on which the scaling is to be performed drawn on top of the black screen, but still distorted. Please note that if the ratio values in the create/draw end are left consistent (as they ought to be), nothing gets drawn on screen. But obviously having two different ratio values doesn't make sense... just testing to see if this works. Native view size is 384 x 216, rendered at 4x to give 1536 x 864. Surely what I'm after can be achieved with surfaces?
Never used surfaces before, so any guidance will be much appreciated. Thanks!
As the title says, I'm wondering if it's possible to have:
. An application surface that is drawn 4x the native resolution of my game (4x window size and view, but keep ports unchanged), WHILE having one specific element rendered as a high resolution sprite where the sprite is also drawn 4x the native resolution. The high resolution rendering I'm talking about happens when increasing the port sizes also by 4x. I understand surfaces are a way to achieve this, but I'm having some difficulties. I basically need this so that when in-game scaling is done (which is a must), it doesn't look completely horrible.
When I perform in-game scaling, if the application surface is rendered such that the views, window sizes and importantly, the port sizes, are all increased to 4x, the in-game scaling looks good. However, if I increase everything except the port sizes and perform scaling, the sprites look too distorted. Yet, I need to have the option of rendering the application surface without changing the port sizes for sake of performance. So I figured a surface would help with this. Code is below:
surface object. Create:
GML:
surf_x=0
surf_y=0
surf_width = 500
surf_height = 100//95 //55
ratio = 4
surf = surface_create(surf_width * ratio, surf_height * ratio);
Code:
var upscl = 1.16//1.08
ratio = 1//s_hport / global.window_size_native_height;
surf_x = 0//x//
surf_y = 0//y//
sx = (x - __view_get( e__VW.XView, 0 )) * ratio;
sy = (y - __view_get( e__VW.YView, 0 )) * ratio;
if surface_exists(surf){
surface_set_target(surf)
draw_clear(c_black)
draw_sprite_ext(spr_test_stand, 0, oPlayer.x, oPlayer.y, 1 * upscl, 1 * upscl, image_angle, c_white, 1)
surface_reset_target();
draw_surface_ext( surf, surf_x, surf_y, 1/ratio, 1/ratio, 0, c_white, 1);
// draw_surface_ext( surf, surf_x, surf_y, 1, 1, 0, c_white, 1);
}// surf ex chk
Never used surfaces before, so any guidance will be much appreciated. Thanks!