Example #1
0
 public static void Init()
 {
     if (File.Exists(GetConfigFilePath()))
     {
         Load();
     }
     else
     {
         Current = new CFG();
         ResetControls();
         ResetGraphics();
         ResetDisplay();
         Save();
     }
 }
Example #2
0
        public static void Load()
        {
            lock (_lock_SaveLoadCFG)
            {
                Current = Newtonsoft.Json.JsonConvert.DeserializeObject <CFG>(
                    File.ReadAllText(GetConfigFilePath()));

                //InterrootLoader.Interroot = Current.InterrootLoader_Interroot;
                //InterrootLoader.Type = Current.InterrootLoader_Type;

                GFX.LODMode              = Current.GFX_LODMode;
                GFX.LOD1Distance         = Current.GFX_LOD1Distance;
                GFX.LOD2Distance         = Current.GFX_LOD2Distance;
                GFX.EnableFrustumCulling = Current.GFX_EnableFrustumCulling;
                GFX.EnableTextures       = Current.GFX_EnableTextures;
                GFX.Wireframe            = Current.GFX_Wireframe;
                //GFX.EnableLighting = Current.GFX_EnableLighting;
                //GFX.TestLightSpin = Current.GFX_TestLightSpin;
                //GFX.EnableHeadlight = Current.GFX_EnableHeadlight;

                DBG.ShowModelNames                = Current.DBG_ShowModelNames;
                DBG.ShowModelBoundingBoxes        = Current.DBG_ShowModelBoundingBoxes;
                DBG.ShowModelSubmeshBoundingBoxes = Current.DBG_ShowModelSubmeshBoundingBoxes;
                DBG.ShowPrimitiveNametags         = Current.DBG_ShowPrimitiveNametags;
                DBG.PrimitiveNametagSize          = Current.DBG_PrimitiveNametagSize;
                DBG.ShowGrid            = Current.DBG_ShowGrid;
                DBG.SimpleTextLabelSize = Current.DBG_SimpleTextLabelSize;

                GFX.ModelDrawer.GoToModelsAsTheySpawn = Current.GFX_ModelDrawer_GoToModelsAsTheySpawn;

                GFX.World.CameraMoveSpeed        = Current.GFX_World_CameraMoveSpeed;
                GFX.World.CameraTurnSpeedGamepad = Current.GFX_World_CameraTurnSpeedGamepad;
                GFX.World.CameraTurnSpeedMouse   = Current.GFX_World_CameraTurnSpeedMouse;
                GFX.World.FieldOfView            = Current.GFX_World_FieldOfView;
                GFX.World.NearClipDistance       = Current.GFX_World_NearClipDistance;
                GFX.World.FarClipDistance        = Current.GFX_World_FarClipDistance;

                GFX.Display.Width      = Current.GFX_Display_Width;
                GFX.Display.Height     = Current.GFX_Display_Height;
                GFX.Display.Format     = Current.GFX_Display_Format;
                GFX.Display.Vsync      = Current.GFX_Display_Vsync;
                GFX.Display.Fullscreen = Current.GFX_Display_Fullscreen;
                GFX.Display.SimpleMSAA = Current.GFX_Display_SimpleMSAA;

                GFX.Display.Apply();
            }
        }