Jump to content


Photo

Getting a black screen instead of my surface...


  • Please log in to reply
7 replies to this topic

#1 RangerX

RangerX

    GMC Member

  • GMC Member
  • 904 posts
  • Version:GM8.1

Posted 20 August 2012 - 06:17 AM

Ok, right now I was trying to display my game on a surface and display that surface instead of the normal screen. I wanted to do this because I want to see if the interpolation on a surface would be better than the UNBEARABLE EYE KILLING interpolation of the normal screen. (please tell me right away if I am going to be deceived with surfaces too!)


Anyhow, here's the logic I thought out:


1- In a room start event I create the surface that should be the same as the view size (well, same as its port).

global.GameScreen=surface_create(view_wport[view_current],view_hport[view_current]);


2- In the draw events of my objects, I set that surface as the target.

surface_set_target(global.GameScreen);


3- Finally, for the next frame to actually be the surface displayed on screen, I put surface drawing code in a begin step event:

surface_set_target(global.GameScreen);
screen_redraw();
draw_surface(global.GameScreen,0,0);




The result of this is:
All that was normally drawn on my screen is not there. I only get a black screen wich is probably my black blackground I have in that room.
So clearly I am missing something. I couldn't understand better how to make this work. When I google search results from this forum I am not getting topics that are truly useful and most of them treating of how to draw a screen (or view) to a surface are unanswered or not clearly answered.

help? :)
(I also would want to credit the person who will help me here in my game -- unless you mind)

Edited by RangerX, 20 August 2012 - 06:20 AM.

  • 0

#2 Nocturne

Nocturne

    Nocturne Games

  • Administrators
  • 16780 posts
  • Version:GM:Studio

Posted 20 August 2012 - 06:54 AM

Are you using GM:Html5 or GM:Studio with the HTML5 module?
  • 0

#3 RangerX

RangerX

    GMC Member

  • GMC Member
  • 904 posts
  • Version:GM8.1

Posted 20 August 2012 - 06:57 AM

Right now I was trying to do this in GameMaker 8 standard (vers. 8.1.141)
I do also own a liscence of GameMaker HTML5 and I plan to use it later, to make a browser version of my game down the road.

Edited by RangerX, 20 August 2012 - 06:58 AM.

  • 0

#4 Nocturne

Nocturne

    Nocturne Games

  • Administrators
  • 16780 posts
  • Version:GM:Studio

Posted 20 August 2012 - 07:01 AM

In GM8 you should not really be drawing to a surface in the draw event itself, especially if you are using views as this bugs them out. Also, you need to set the target, draw to the surface and then RESET the target (which you are not doing) so the source of your problem is probably there. SO the complete sequence should be (Warning! Pseudo Code!)...

//CREATE EVENT
surf = surface_create(blah);

//STEP EVENT
surface_set_traget(surf);
draw stuff!!!
surface_reset_target();

//DRAW EVENT
draw_surface(blah);


Bear in mind that in GM:S there is a completely different setup to achieve this!


EDIT: Misread the post and I see that you are not drawing to the surface in the draw event. However I still believe your problem is that you are not re-setting the surface value...

Edited by Nocturne, 20 August 2012 - 07:03 AM.

  • 1

#5 RangerX

RangerX

    GMC Member

  • GMC Member
  • 904 posts
  • Version:GM8.1

Posted 20 August 2012 - 07:13 AM

Ok, reading your pseudo code... so my stuff that I draw in the draw event should now be drawn in a step event then only the surface is actually drawn in the draw event?
  • 0

#6 Nocturne

Nocturne

    Nocturne Games

  • Administrators
  • 16780 posts
  • Version:GM:Studio

Posted 20 August 2012 - 07:24 AM

Correct! And don't forget to reset the target...
  • 0

#7 RangerX

RangerX

    GMC Member

  • GMC Member
  • 904 posts
  • Version:GM8.1

Posted 20 August 2012 - 05:23 PM

Ok, it appears to be working but now I am facing a new prob. Stuff is drawn but is never erased. I'm failing to see some "surface_clear" function or something the likes. Something that wouldn't kill my surface (so I don't have to create it all the time) and something that would erase the previously drawn step...

Any advice?

EDIT: 2 things.
First thing is that I tried using "surface free" and it works wonderfully. I need to recreate my surface each step though. Second thing is my deception... the anti-aliasing isn't better at all with surfaces and whenever I let the player resize the window or would resize it according their monitor, my pixel is basically destroyed. :((

I think I will never solve this problem. Or I don't get how to rightfully handle the scaling with GameMaker. Even a game that is "fixed scale 200%" and then made "fullscreen" the scale isn't perfectly fixed or respected and the pixel art suffers.

Edited by RangerX, 20 August 2012 - 05:46 PM.

  • 0

#8 Nocturne

Nocturne

    Nocturne Games

  • Administrators
  • 16780 posts
  • Version:GM:Studio

Posted 20 August 2012 - 06:00 PM

You clear a surface with the "draw_clear" function (or "draw_clear_alpha" if you need transparency).
  • 1




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users