March 05, 2021, 06:37:52 AM

Author Topic: [bb] get available resolutions for fullscreen mode by RemiD [ 1+ years ago ]  (Read 501 times)

Offline BlitzBot

Title : get available resolutions for fullscreen mode
Author : RemiD
Posted : 1+ years ago

Description : an example on how to get the available resolutions for fullscreen mode where the width is superior to the height and height/width >= 0.5 and width/height <=2 and the colors depth is 32bits

Code :
Code: BlitzBasic
  1. Graphics3D(640,480,32,2)
  2.  
  3. Global ResolutionsCount%
  4. Dim ResolutionPWidth%(100)
  5. Dim ResolutionPHeight%(100)
  6.  
  7. For i% = 1 To CountGfxModes()
  8.  ;DebugLog("")
  9.  ;DebugLog("GfxModeWidth("+i+") = "+GfxModeWidth(i))
  10.  ;DebugLog("GfxModeHeight("+i+") = "+GfxModeHeight(i))
  11.  ;DebugLog("GfxModeDepth("+i+") = "+GfxModeDepth(i))
  12.  If( GfxModeWidth(i) >= 640 And GfxModeHeight(i) >= 480 And GfxModeDepth(i) = 32 And Float(GfxModeHeight(i))/Float(GfxModeWidth(i)) >= 0.5 And Float(GfxModeWidth(i))/Float(GfxModeHeight(i)) <= 2 And GfxModeWidth(i) > GfxModeHeight(i) )
  13.   ResolutionsCount = ResolutionsCount + 1
  14.   Id% = ResolutionsCount
  15.   ResolutionPWidth(Id) = GfxModeWidth(i)
  16.   ResolutionPHeight(Id) = GfxModeHeight(i)
  17.   Print( "Resolution("+Str(Id)+") = "+Str(ResolutionPWidth(Id))+"x"+Str(ResolutionPHeight(Id)) )
  18.  EndIf
  19. Next
  20.  
  21. WaitKey()
  22.  
  23. End()


Comments : none...

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal