155 lines
4.4 KiB
Plaintext
155 lines
4.4 KiB
Plaintext
Procedure.s GetCurrentResolution()
|
|
If GUI\FullScreen=#True
|
|
ProcedureReturn "FullScreen:"+Str(ScreenWidth())+"x"+Str(ScreenHeight())
|
|
Else
|
|
ProcedureReturn "Window:"+Str(ScreenWidth())+"x"+Str(ScreenHeight())
|
|
EndIf
|
|
EndProcedure
|
|
|
|
Structure ScreenModeInfo
|
|
width.i
|
|
height.i
|
|
depth.i
|
|
hz.i
|
|
EndStructure
|
|
|
|
Procedure InitScreen()
|
|
ExamineDesktops()
|
|
Protected.l SWidth,SHeight,SDepth
|
|
;Fullscreen
|
|
If GUI\FullScreen=#True
|
|
;Default Screen Resolution
|
|
If GUI\ScreenResolutionWidth=0
|
|
If ExamineScreenModes()
|
|
NewList modes.ScreenModeInfo()
|
|
;Select Last ScreenMode (Higer)
|
|
While NextScreenMode()
|
|
If AddElement(modes())
|
|
modes()\width = ScreenModeWidth()
|
|
modes()\height = ScreenModeHeight()
|
|
modes()\depth = ScreenModeDepth()
|
|
modes()\hz = ScreenModeRefreshRate()
|
|
EndIf
|
|
SortStructuredList( modes(), #PB_Sort_Descending, OffsetOf(ScreenModeInfo\hz), #PB_Integer)
|
|
SortStructuredList( modes(), #PB_Sort_Descending, OffsetOf(ScreenModeInfo\width), #PB_Integer)
|
|
SortStructuredList( modes(), #PB_Sort_Descending, OffsetOf(ScreenModeInfo\height), #PB_Integer)
|
|
FirstElement(modes())
|
|
SWidth=modes()\width
|
|
SHeight=modes()\height
|
|
SDepth=modes()\depth
|
|
Debug Str(Swidth)+"x"+Str(SHeight)+"@"+Str(Sdepth)
|
|
Wend
|
|
EndIf
|
|
End
|
|
|
|
;Use Screen Parameters Resolution
|
|
Else
|
|
SWidth=GUI\ScreenResolutionWidth
|
|
SHeight=GUI\ScreenResolutionHeight
|
|
SDepth=GUI\ScreenResolutionDepth
|
|
EndIf
|
|
Debug "Fullscreen:"+Str(SWidth)+"x"+Str(SHeight)
|
|
If Not OpenScreen(SWidth,SHeight,SDepth,"Loopz Remix "+#Version);,#PB_Screen_NoSynchronization
|
|
MessageRequester("Erreur", "Impossible d'ouvrir un écran "+Str(SWidth)+"x"+Str(SHeight), 0)
|
|
End
|
|
EndIf
|
|
; Windows
|
|
Else
|
|
|
|
;Default Window Resolution
|
|
If GUI\WindowResolutionWidth=0
|
|
SWidth=720*2
|
|
SHeight=480*2
|
|
|
|
;Use Window Parameters Resolution
|
|
Else
|
|
SWidth=GUI\WindowResolutionWidth
|
|
SHeight=GUI\WindowResolutionHeight
|
|
EndIf
|
|
|
|
Debug "Window:"+Str(SWidth)+"x"+Str(SHeight)
|
|
Protected Flags.l
|
|
If GUI\WindowX<>-1 And GUI\WindowY<>-1
|
|
Flags=#PB_Window_SystemMenu
|
|
Else
|
|
Flags=#PB_Window_SystemMenu|#PB_Window_ScreenCentered
|
|
EndIf
|
|
|
|
If OpenWindow(0, GUI\WindowX, GUI\WindowY, DesktopUnscaledX(SWidth), DesktopUnscaledY(SHeight), "Loopz Remix "+#Version, Flags)
|
|
If Not OpenWindowedScreen(WindowID(0), 0, 0, SWidth, SHeight)
|
|
MessageRequester("Erreur", "Impossible d'ouvrir un écran dans la fenêtre!", 0)
|
|
End
|
|
EndIf
|
|
|
|
EndIf
|
|
|
|
EndIf
|
|
|
|
|
|
;GameOriginalWidth=720
|
|
;GameOriginalHeight=405
|
|
;GameoriginalBlockWidth=32
|
|
;GameHigestWidth=3840
|
|
;GameHigestBlockHeight=128
|
|
GUI\ScreenWidth=20
|
|
GUI\BlockSize=ScreenWidth()/GUI\ScreenWidth
|
|
GUI\ScreenHeight=ScreenHeight()/GUI\BlockSize
|
|
GUI\HalfBlockSize=GUI\BlockSize/2
|
|
GUI\QuarterBlockSize=GUI\BlockSize/4
|
|
GUI\DoubleBlockSize=GUI\BlockSize*2
|
|
|
|
GUI\BenchWidth=(#MaxTableWidth+1)*GUI\BlockSize
|
|
GUI\BenchHeight=(#MaxTableHeight+1)*GUI\BlockSize
|
|
GUI\BenchX=(ScreenWidth()-GUI\BenchWidth)/2
|
|
GUI\BenchY=GUI\BlockSize
|
|
|
|
GUI\JewelBlue_X=10.5*GUI\BlockSize
|
|
GUI\JewelRed_X=13*GUI\BlockSize
|
|
|
|
GUI\TimerWidth=GUI\BlockSize * 8
|
|
GUI\TimerX=GUI\BenchX+(GUI\BenchWidth - GUI\TimerWidth ) /2
|
|
GUI\TimerY=GUI\BenchY+GUI\BenchHeight+GUI\BlockSize
|
|
|
|
LoadSpriteSheet()
|
|
CompilerIf #UsePackFile=#True
|
|
CatchBitmapFont(#Spr_FontA,"MonoFont")
|
|
CatchBitmapFont(#Spr_FontB,"LoopzFont")
|
|
CompilerElse
|
|
LoadBitmapFont(#Spr_FontA,"MonoFont")
|
|
LoadBitmapFont(#Spr_FontB,"LoopzFont")
|
|
CompilerEndIf
|
|
|
|
EndProcedure
|
|
|
|
Procedure DeInitScreen()
|
|
CloseScreen()
|
|
If IsWindow(0)
|
|
CloseWindow(0)
|
|
EndIf
|
|
EndProcedure
|
|
|
|
Macro FlipBuffersAndRetrieveFPS()
|
|
Static fpsCounter
|
|
Static fpsStartTime
|
|
|
|
If FlipBuffers()
|
|
fpsCounter + 1
|
|
EndIf
|
|
|
|
If (ElapsedMilliseconds()-fpsStartTime)>=1000
|
|
GUI\fpsValue=fpsCounter
|
|
fpsCounter=0
|
|
fpsStartTime=ElapsedMilliseconds()
|
|
If GUI\fpsValue<Game\ScoreData\Fps_Min
|
|
Game\ScoreData\Fps_Min=GUI\fpsValue
|
|
EndIf
|
|
If GUI\fpsValue>Game\ScoreData\Fps_Max
|
|
Game\ScoreData\Fps_Max=GUI\fpsValue
|
|
EndIf
|
|
EndIf
|
|
|
|
EndMacro
|
|
; IDE Options = PureBasic 6.00 LTS (Linux - x64)
|
|
; CursorPosition = 38
|
|
; Folding = -
|
|
; EnableXP |