• 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!

Surface_save_part

E

Efrik

Guest
Hi.
I am having an issue with this statement that I can not comprehend.
I am designing a wordsearch writter that should include an option to export the resulting grid. I am trying to save it as a png file. In order tod o so my intention is to save the grid with the "surface_save_part" command.

In orer tod o so the "print" button (sized 3x1 cells) included in the room executes this in the draw event:

if (mouse_x>x)&&(mouse_x<(x+cellX*3))&&(mouse_y>y)&&(mouse_y<y+cellY)&&( mouse_check_button_released(mb_left)){
surface_save_part(application_surface,"searchforme.png",(room_width-(cellX*grindX))/2,96,cellX*grindX,cellY*grindY);

I know I wrote "grind" instead of "grid". That was funny at that moment so I left it like that.
The origin coordinates for the area to save are the same as those for the object that creates the grid. As the grid has a variable size stated by the user, and the grid was supposed to stay at the center of the screen, the X origin was coded as "room_width-(cellX*grindX)/2". It works and the grid is perfectly centered, no matter the size.

The problem comes when I execute the surface_save part. Although the origin and size should be the same, the result is as follows:

The grid where the image comes from has one column more to the right.


The problem should not but gets worse if I rersize the room in case the grid is too big to fit in the original room size.
I´ve tried with surface_save, screen_save, _part, copying the surface, copying the view, and scaling, and the result is allways the same. I may have fail my maths, but the function is the same for the object and the surface, so I doubt it.

Any solution?
 

Mike

nobody important
GMC Elder
If it's just the grid, don't draw it as an image... use primitives. If its slow (for some reason), build a model and "freeze" it. It should be much quicker than drawing a fullscreen image, and take less memory, and not require you to save chunks out.
 
E

Efrik

Guest
My idea was to use the program as a teaching tool, allowing teachers to export an print the wordsearch for their students, so a PNG file should be familiar enough and easy to print or work with. Thats why I´d rather export it as an image.
 
Top