Jump to content

Getting Desktop Resolution


Einlander
 Share

Recommended Posts

This is a simple script that will let you get the desktops current resolution. It has not been tested in linux.

It creates a hidden window, Maximizes it, and gets the window size. That's it.

It returns a Vec2(). DO NOT USE IF THE PROGRAM IS ALREADY FULLSCREEN. It will cause you some annoyances.

	function GetDesktopResolution() --Vec2()
		-- get current desktop resolution ; Super quick and dirty method, works on windows dont know about linux
		local launchertestwindow = Window:Create(System.AppName,0,0,1024,768,Window.Tool)
		launchertestwindow:Maximize()
		local desktopres = Vec2(launchertestwindow:GetWidth(),launchertestwindow:GetHeight())	
		launchertestwindow:Release()
		return desktopres
	end

 

  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   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.

 Share

×
×
  • Create New...