Page 1 of 1
Help after Runprogram
Posted: Fri Jan 17, 2014 12:10 am
by ASI
Need a little help with a minor problem i have.
I have a menu program which works fine until i launch a game, Use runprogram with selected game.
No problem everything works ok, until return to menu, which will display screen then get a blank screen
until another keypress etc and display updated.
My code is as follows to update display
Code: Select all
ClearScreen(RGB(0,0,0))
If #Testing=#False
StartDrawing(ScreenOutput())
Else
StartDrawing(WindowOutput(0))
EndIf
;DrawImage(ImageID(0), 0,0)
;DrawingMode(#PB_2DDrawing_Default)
DrawingFont(Font1)
DisplayList(SubList,Game)
DisplaySnap()
DisplayMarquee()
DrawingMode(#PB_2DDrawing_Transparent)
DrawAlphaImage(ImageID(0), 0,0)
; Draw Title
FrontColor(RGB($FF,$00,$FF))
DrawingFont(Font1)
Tlen=700/TextWidth("A")
DrawText(400-(TextWidth(Left(GamesList(CatList(SubList)\Index(Game)\Link)\Description,Tlen))/2),152,Left(GamesList(CatList(SubList)\Index(Game)\Link)\Description,Tlen))
StopDrawing()
Re: Help after Runprogram
Posted: Fri Jan 17, 2014 8:08 am
by infratec
Hi,
you posted the wrong part of the code
It's not a problem of your 'drawing' part.
It sounds more like a problem of your event loop.
Bernd
Re: Help after Runprogram
Posted: Fri Jan 17, 2014 8:53 am
by ASI
event loop
Code: Select all
Repeat
If #Testing=#True
Repeat
Event = WindowEvent()
Select Event
Case #PB_Event_CloseWindow
End
EndSelect
Until Event = 0
EndIf
FlipBuffers()
If Game_Test<>Game
If IsScreenActive()
UpdateDisplay()
EndIf
EndIf
ExamineKeyboard()
Game_Test=Game
;##########################
;# Game Up / Down
;##########################
If KeyboardPushed(Cfg\Up) ; Up 1 Game Item
Repeat
ExamineKeyboard()
Until KeyboardReleased(Cfg\Up)
Game-1
If Game=<0 : Game = 1 : EndIf
EndIf
If KeyboardPushed(Cfg\Down) ; Down 1 Game Item
Repeat
ExamineKeyboard()
Until KeyboardReleased(Cfg\Down)
Game+1
If Game>Games_Max : Game = Games_Max : EndIf
EndIf
;##########################
;# Page Up / Down (1 Page At Time)
;##########################
If KeyboardPushed(Cfg\PageUp) ; Up 1 Page Item
Repeat
ExamineKeyboard()
Until KeyboardReleased(Cfg\PageUp)
Game-16
If Game=<0 : Game = 1 : EndIf
EndIf
If KeyboardPushed(Cfg\PageDn) ; Down 1 Page Item
Repeat
ExamineKeyboard()
Until KeyboardReleased(Cfg\PageDn)
Game+16
If Game>Games_Max : Game = Games_Max : EndIf
EndIf
;##########################
;# Page Up / Down (Fast Scroll No Delay)
;##########################
If KeyboardPushed(Cfg\QuickUp) ; Up 1 Page Item
Game-16
If Game=<0 : Game = 1 : EndIf
EndIf
If KeyboardPushed(Cfg\QuickDn) ; Down 1 Page Item
Game+16
If Game>Games_Max : Game = Games_Max : EndIf
EndIf
;##########################
;# Next / Prev Category
;##########################
If KeyboardPushed(Cfg\Cat_Next) ; Next Cat List
Repeat
ExamineKeyboard()
Until KeyboardReleased(Cfg\Cat_Next)
SubList+1
If CatList(SubList)\CatName="" : SubList-1 : EndIf
Games_Max = CatList(Sublist)\GameCount
Game=1
Game_Test=0
EndIf
If KeyboardPushed(Cfg\Cat_Prev) ; Prev Cat List
Repeat
ExamineKeyboard()
Until KeyboardReleased(Cfg\Cat_Prev)
SubList-1
If CatList(SubList)\CatName="" : SubList+1 : EndIf
Games_Max = CatList(Sublist)\GameCount
Game=1
Game_Test=0
EndIf
If KeyboardPushed(Cfg\Start) ; Run The Game NOW!!!!!!!!!!!!
Repeat
ExamineKeyboard()
Until KeyboardReleased(Cfg\Start)
RunProgram(Cfg\MameDir+Cfg\MameExe, GamesList(CatList(SubList)\Index(Game)\Link)\RomName,Cfg\MameDir,#PB_Program_Hide|#PB_Program_Wait)
EndIf
Until KeyboardPushed(Cfg\Quit)
if i change last part of code to this it works fine
but item selected is now 2 items after the the item in runprogram
but if i alter same code to Game+1 then do Game-1
It does not work and get blank screen again..
Code: Select all
If KeyboardPushed(Cfg\Start) ; Run The Game NOW!!!!!!!!!!!!
Repeat
ExamineKeyboard()
Until KeyboardReleased(Cfg\Start)
RunProgram(Cfg\MameDir+Cfg\MameExe, GamesList(CatList(SubList)\Index(Game)\Link)\RomName,Cfg\MameDir,#PB_Program_Hide|#PB_Program_Wait)
Game+1
UpdateDisplay()
FlipBuffers()
Game+1
UpdateDisplay()
EndIf
OK Solution solved.
Thanks for help
I just needed to set Game_Test = 0 after the runprogram