WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   System Preferences - Graphics (https://www.wowinterface.com/forums/showthread.php?t=57813)

gmarco 02-11-20 01:39 AM

System Preferences - Graphics
 
Hi everyone,

I'd like to make a little addon to switch from full screen to windowed mode.

The problem is that the system preferences do it so nicely:



While a simple code to switch from a mode to the other like this:

Lua Code:
  1. C_CVar.SetCVar("gxMaximize", "1")
  2. RestartGx()

or

Lua Code:
  1. C_CVar.SetCVar("gxMaximize", "0")
  2. C_CVar.SetCVar("gxWindowedResolution", "1790x1007")
  3. RestartGx()

freeze for a little bit the game and is not as perfect as the first.

So the question.
How is, if any, the best way to achieve this ?

Thanks so much.

LudiusMaximus 02-11-20 03:37 AM

I just tried to find out what the Blizzard UI does when you click the "Apply" button. This seems to work for me:

Code:

OptionsFrameOkay_OnClick(VideoOptionsFrame, 1);
But it does not take into account any changed cvars. So the next step would be to find out what happens when you toggle the "display mode" drop down in the options...

LudiusMaximus 02-11-20 03:43 AM

OK, it turns out UpdateWindow() is what you are looking for!

Code:

C_CVar.SetCVar("gxMaximize", "0")
C_CVar.SetCVar("gxWindowedResolution", "400x400")
UpdateWindow()


gmarco 02-11-20 11:22 AM

It works like a charm.

Thanks so much.


All times are GMT -6. The time now is 08:16 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI