Download

Get engine resolution, Get engine instance.

UDK | SystemSettings so in here you see there is a getter, but I have no idea how to access that engine.uc instance. any idea :eek:??? I need it to save the resolution and load…

Extend the engine to what ever you want to call your engine. i will use YourGameEngine for this



//your new engine class
class YourGameEngine extends GameEngine
config(Engine);

function Init()
{
   `log("Did my game engine start up?");
    //can add some code here to initialize whatever.
}


////////// in what ever file you want to do this in.
 local YourGameEngine YGE

if(YGE == none)
{
   YGE = YourGameEngine(class'Engine'.static.GetEngine());
}

//now you can use  YGE. to access into the engine.


Wait will not that start a whole instance of UE3 ? Ahh ok using static, I know how to use that…

I did something like


class'engine'.static.GetEngine() and then I referenced on a local variable and CurrentEngine.GetSystemSettingInt("ResX") .....

and worked for me.

In our menu is where we get ours, like this



var int LastResolutionIndex, NewResolutionIndex, GoodResolutionIndex;
var string GoodResolutionVal, FullScreenVal;
var bool bResetResolution, bSetGoodResolution;

/** Set the screen settings. */
function ApplyVideoSettings()
{
  local int i, ResolutionIndex, FullscreenIndex, GammaIndex, AntiAliasingIndex, AnisotropicFilteringIndex, VsyncIndex;
  local string LocationPart, RelevantPart, ResolutionVal,/* FullscreenVal,*/ GammaVal, AntiAliasingVal, AnisotropicFilteringVal, VsyncVal;
  local DataStoreClient DSClient;
  local PBUIDataStore_StringList StringListDataStore;

for ( i = 0; i < SettingsList.Length; i++)
{
  // Get the datastore tag and its path in seperate variables
  SplitMarkupString(i, RelevantPart, LocationPart);

  if (RelevantPart == "Resolution" || RelevantPart == "Fullscreen"
     || RelevantPart == "Gamma" || RelevantPart == "AntiAliasing"
     || RelevantPart == "AnisotropicFiltering" || RelevantPart == "Vsync")
   {

    // Get the global data store client
    DSClient = class'UIInteraction'.static.GetDataStoreClient();
    StringListDataStore = PBUIDataStore_StringList(DSClient.FindDataStore('PBStringList'));

    // Get current value of 'Resolution' and index of value 'Fullscreen'
     StringListDataStore.GetCurrentValue('Resolution', ResolutionVal);
     FullscreenIndex = StringListDataStore.GetCurrentValueIndex('Fullscreen');
    ResolutionIndex = StringListDataStore.GetCurrentValueIndex('Resolution');
    // If true(fullscreen[1]) "windowed", if false(fullscreen[0]) "fullscreen"
    FullscreenVal = bool(FullscreenIndex) ? "w" : "f";
    `log("GFxPBFrontEnd_VideoSettings: Setres"@ResolutionVal$FullscreenVal);

    if (bResetResolution)
    {
       ConsoleCommand("Setres"@GoodResolutionVal); //reverts ResX ResY
       StringListDataStore.SetCurrentValueIndex('Resolution', GoodResolutionIndex);
    }
    else
    {
       ConsoleCommand("Setres"@ResolutionVal/*$FullscreenVal*/); //sets ResX ResY
      StringListDataStore.SetCurrentValueIndex('Resolution', NewResolutionIndex);
     }

     if (FullscreenVal == "w")
     {
       ConsoleCommand("Scale Set Fullscreen False"); //sets Fullscreen fail-safe
     }
     else
     {
       ConsoleCommand("Scale Set Fullscreen True"); //sets Fullscreen fail-safe
     }
     // Set the current values as the DefaultValueIndex in UDKGame.ini
      StringListDataStore.SetDefaultValueIndex('Resolution', ResolutionIndex);
      StringListDataStore.SetDefaultValueIndex('Fullscreen', FullscreenIndex);

   }
 }
  if (bResetResolution)
  { //dont show key menu if reverted the video
     UpdateListDataProvider();
     bResetResolution=false;
   }
   else if (GoodResolutionIndex != NewResolutionIndex)
   { //show the key menu if resolution has changed
       LoadResolutionMsg();
   }
}


that is just part of the code there is another section that determines if you can run that resolution and if you cant it kicks you back to your old setting so the game don’t go to a resolution your monitor does not support and go black screen. Which in turn will cause the player to have to go edit the config to get a working resolution, so the game can be seen on screen.

Thanks will post my code as well.