SOLVED Should I give up on this trivial problem?

A

Adry

Guest
Hey community ! I've been running circles trying to get this really insignificant thing to work, but now it seems like I've become obsessed.. Sigh, but I'm thinking of just letting it go 'cause it's causing unnecessary frustration..
Basically, I'm trying to get one single sprite, (background sprite) to display at a different pixel resolution than what the window size displays. I have taken some pictures to further illustrate this:

This is how it displays within the draw event on a 480 * 420 window:

draw event_with mag.png

This is what I'd like to achieve..
achieve.png
The window is still 480 * 420, however as you can see, the surface has a resolution of 160 * 140, the original pixel size. Here is my frustration..
I can only seem to accomplish this via the draw_gui event. This is a problem because this is supposed to be a background and the GUI draw event draws this as you all know to the front of the screen.
Is there any other way to do this? Or I'm I trying to do something that I can't really fix with code? Any advice? Here is my code from the GUI draw event:

GML:
// IN THE CREATE EVENT
surface = -1; // Initialise the variable that wil hold the surface ID
display_set_gui_size(480, 420);

// IN THE DRAW GUI EVENT
if !surface_exists(surface) // Check and see if surface exists
{
// Surface doesn't exist so create it and make it the size of the background sprite
surface = surface_create(480, 420);

// Now draw the background to the surface
surface_set_target(surface);
draw_sprite_tiled(battle_bg_c, 0, 0, 0);
surface_reset_target();
}
else
{
// Draw the surface
draw_surface(surface, 0,  0);

}
 
A

Adry

Guest
Hmm.. This is what happens, it gets smaller, but the pixels are still bound by the windows resolution..?

Untitled.png

Here's how I coded it.:
GML:
// IN THE DRAW GUI EVENT
if !surface_exists(surface) // Check and see if surface exists
{
// Surface doesn't exist so create it and make it the size of the background sprite
surface = surface_create(480, 420);

// Now draw the background to the surface
surface_set_target(surface);

draw_sprite_tiled_ext(battle_bg_c, 0, 0, 0, 1/3, 1/3, c_white, 1);
surface_reset_target();
}
else
{
// Draw the surface
draw_surface(surface, 0,  0);

}
 

AnotherHero

Member
I'm curious why you can only accomplish this in draw_gui?

What I would do (based on your previous posts) is still create your game in 160x140 and use a view with a width/height of 160x140, but have your viewport (window) be 480x420. Would this help?
 
A

Adry

Guest
Hey just wanted to give an update! Some one helped me work the problem with this:

Code:
BG_Random = spr_background;

var lay_id = layer_get_id("Background");

var back_id = layer_background_get_id(lay_id);

layer_background_sprite(back_id, BG_Random);

layer_background_xscale(back_id,1/3);

layer_background_yscale(back_id,1/3);

layer_background_blend(back_id,c_white);

layer_background_htiled(back_id, true);

layer_background_vtiled(back_id, true);

surface_resize(application_surface,480,420);
 
Top