• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM how to create surface only in the area of view[0]?

jobjorgos

Member
I have a shader for all my rooms of the size below:

nightCycleSurf = surface_create(8192, 8192);

But it causes lag, so how can I make the surface to be just the size of view[0] (which is variable of size and position in the room)?

I just copied all the shader data from a youtube tutorial so I barely know how I can change it too bad :(
I hope its easy, thanks!
 

Nux

GameMaker Staff
GameMaker Dev.
Use view_wview[0] and view_hview[0] instead. If you change the size of the view, make sure to also resize the surface.

You're going to have to draw to the surface relative to the view, so in any draw events make sure you subtract view_xview[0] and view_yview[0] from the x and y values.
 

jobjorgos

Member
Thanks for your response. I have this now:

nightCycleSurf = surface_create(view_wview[0], view_hview[0]);

The size of the surface is good, but the position not.
How can I change the position of the surface? I can not give any other inputs to 'surface_create' than their width and height so I really have no clue how to do that o_O

EDIT: crazy enough by asking the question I answered myself somehow at the same time.
I found the solution that I can change the position of where the surface is drawn here:
draw_surface_ext(nightCycleSurf,0,0,1,1,0,c_white,alpha);

so problem solved:)
 
Last edited:
Top