So my program experience slowdown on random computer, according to people who test the game it also happen in powerful pc too ... it happens rarely though, sometimes it's fixed with a simple restart, sometimes it's fixed with me sending a new game build(even though i didn't change any of the fundamental graphics related code) any ideas?
the first part is simply loading icon, followed by prompt to choose resolution & graphic driver, after that is the game loop
strict
Import "icon_import.o"
' -----------------------------------------------------------------------------
' SetIcon
' -----------------------------------------------------------------------------
'Needed externs
?win32
Extern "win32"
Function ExtractIconA%(hWnd%,File$z,Index%)
Function GetActiveWindow%()
Function SendMessage:Int(hWnd:Int,MSG:Int,wParam:Int,lParam:Int) = "SendMessageA@16"
End Extern
?
' -----------------------------------------------------------------------------
' SetIcon
' -----------------------------------------------------------------------------
Global ScreenWidth: Float
Global ScreenHeight: Float
Local bFullScreen: Int
Local iDriver: Int
AppTitle$="Choose Screen Mode"
Graphics 320,240,0
SetIcon(AppFile, GetActiveWindow())
DrawResolutionChoices()
If KeyDown(KEY_1) Then
ScreenWidth = 1024
ScreenHeight = 768
bFullScreen = False
Else If KeyDown(KEY_2) Then
ScreenWidth = 1280
ScreenHeight = 768
bFullScreen = False
Else If KeyDown(KEY_3) Then
ScreenWidth = 1280
ScreenHeight = 720
bFullScreen = False
Else If KeyDown(KEY_4) Then
ScreenWidth = 1366
ScreenHeight = 768
bFullScreen = False
Else If KeyDown(KEY_5) Then
ScreenWidth = 1024
ScreenHeight = 768
bFullScreen = True
Else If KeyDown(KEY_6) Then
ScreenWidth = 1280
ScreenHeight = 768
bFullScreen = True
Else If KeyDown(KEY_7) Then
ScreenWidth = 1280
ScreenHeight = 720
bFullScreen = True
Else If KeyDown(KEY_8) Then
ScreenWidth = 1366
ScreenHeight = 768
bFullScreen = True
End If
Cls()
FlushKeys()
DrawDriverChoices()
If KeyDown(KEY_1) Then
iDriver = 1
Else If KeyDown(KEY_2) Then
iDriver = 2
End If
SeedRnd MilliSecs()
'Joystick Components
JoyCount()
Local ElapsedTicks:Float = -1
'Timer Components
Local time:TTimer = CreateTimer(60)
If ( iDriver = 1 ) Then
SetGraphicsDriver D3D9Max2DDriver()
If ( GetGraphicsDriver() = Null ) Then SetGraphicsDriver D3D7Max2DDriver()
Graphics( ScreenWidth, ScreenHeight, bFullScreen )
Else
SetGraphicsDriver GLMax2DDriver()
GLGraphics( ScreenWidth, ScreenHeight, bFullScreen )
End If
SetIcon(AppFile, GetActiveWindow())
SetBlend( AlphaBlend )
'Main Loop
Init()
Repeat
WaitTimer(time)
Cls
Move()
Draw()
Flip
'Until KeyDown(KEY_ESCAPE) Or AppTerminate() Or ( Manager.WindowTitle.iExecuteCode = MAIN_EXIT )
Until AppTerminate() Or ( Manager.WindowTitle.iExecuteCode = MAIN_EXIT )
BGMPlayer.Stop()
EndGraphics()
|