Mirage Source
http://www.miragesource.net/forums/

blting to the screen for x seconds
http://www.miragesource.net/forums/viewtopic.php?f=143&t=5774
Page 1 of 1

Author:  zidsal [ Sun Jun 07, 2009 12:37 pm ]
Post subject:  blting to the screen for x seconds

I'm trying to make it so in my game it will blt the screen black for a second or 2 in game. Currently however the blting last what is a like a mili second. I've tried to just get the game to keep blting to the screen until the loops broken by gettickcount but with no such luck.


Do Until x = True 'infinite loop
DD_BackBuffer.SetFillColor RGB(0, 0, 0)
Call DD_BackBuffer.DrawBox(0, 0, (MAX_MAPX + 1) * PIC_X, (MAX_MAPY + 1) * PIC_Y)

If GetTickCount > tint + 2000 Then ' breaks the loop after 2 seconds
tint = GetTickCount
Exit Do
End If
Loop

any help on the matter would be great

thanks
zidsal

Author:  Pbcrazy [ Sun Jun 07, 2009 12:56 pm ]
Post subject:  Re: blting to the screen for x seconds

don't have a loop inside the main loop, just have a check each time the normal loop passes through.

Code:
If BlckScrnTimer <= GetTickCount
    DD_BackBuffer.SetFillColor RGB(0, 0, 0)
    Call DD_BackBuffer.DrawBox(0, 0, (MAX_MAPX + 1) * PIC_X, (MAX_MAPY + 1) * PIC_Y)
End If


And then if you want to start the blackscreen:

Code:
BlckScrnTimer = GetTickCount + 2000 ' Two seconds.


Hope this helps.

Author:  GIAKEN [ Sun Jun 07, 2009 9:21 pm ]
Post subject:  Re: blting to the screen for x seconds

Instead, make it not call the Render_Graphics sub, which will stop drawing everything and only show black...which would have the same effect but better. So:

Code:
Public tmrStop As Long

.........

If tmrStop < GetTickCount Then Render_Graphics


Then where you want to make everything black, enter this code:

Code:
tmrStop = GetTickCount + 2000


And that will make everything black for 2 seconds.

Author:  zidsal [ Mon Jun 08, 2009 10:48 am ]
Post subject:  Re: blting to the screen for x seconds

thanks for the help guys I've got it working now with out draining fps to 0 :lol:

Author:  GIAKEN [ Mon Jun 08, 2009 8:58 pm ]
Post subject:  Re: blting to the screen for x seconds

Using my method should make the FPS go up exceptionally :P

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/