Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • entry
  • comments
  • views

Screen Size Lib

Naughty Alien


Hello guys. This time, here is small utility, nothing spectacular, just smal library what will let you manage available screen size your GPU support, easy. You can also use it in main menu where you will setup all available resolutions and browse trough list, or automatically detect maximum resolution upon start and set screen, etc. So here are commands.


So, first we need to initialize library.


Global SCREEN_SIZE:TScreenSize

SCREEN_SIZE = TScreenSize.Create(bitDepth:Int=32)


bitDepth is your screen depth and by default is 32, and it means, supported resolutions will be for 32 bit depth.


Now library is initialized. All available resolutions GPU support are accessible trough screen size modes. Screen size modes are nothing but indexes of array, where screen size is stored, for width and height. So, in order to know how many available resolutions we have, we will use this command:



NUMBER_OF_AVAILABLE_RESOLUTIONS = SCREEN_SIZE.get_number_of_modes_available()


So, if you want to go trough list of all available resolutions,



If you want to set up screen size, you can do it like this:

SCREEN_SIZE.size(width:Int=True, height:Int=False,mode_:Int=0,higherRes:Int=False)


If width is true, returned size will be width. If height is true, height size will be returned.

If mode is provided in range 0 to NUMBER_OF_AVAILABLE_RESOLUTIONS, It will be provided size for that mode, for width or height, depending which one is flagged true.

If higherRes is true, it will be returned largest screen size for width or height, depending which one is flagged true.


So, for example, if you want to setup your screen upon loading on to maximum resolution, since you dont know in advance what kind of GPU/Monitor will be used, and you want to set it higher so user can later change it, you will do simply this(example with framework):


Global SCREEN_SIZE:TScreenSize

SCREEN_SIZE = TScreenSize.Create(bitDepth:Int=32)

Graphics(SCREEN_SIZE.size(,,, True), SCREEN_SIZE.size(False, True,, True), 32)


LogStreamEnabled = False'AppLogMode equivalent

Global FW:TFramewerk

FW = TFramewerk.Create()

If Not FW RuntimeError "Failed to initialize engine."


..and rest is history smile.png . By combining on many ways, you can have many use of it, from menu systems where screens will be detected, up to automatic initializations, etc.. Also, you dont have to sort out screen sizes. They are already sorted (0 means lovest resolution, SCREEN_SIZE.get_number_of_modes_available(), is the highest), so its easy.


Anyway, you can see how to use lib in provided example, so it should be self explanatory. In case it doesnt work, let me know.



As usual, copy e1.mod to mod folder, and include it as it was done in provided example, and you are good to go..cheerrsss...




  • Upvote 3


Recommended Comments

Pity I don't use BMax. Nice of you to post it non the less NA. Will get round to writing something myself to enumerate the video modes eventually.

  • Upvote 1
Link to comment
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...