예제 #1
0
파일: VID.cs 프로젝트: optimus-code/Q2Sharp
 public static void Shutdown()
 {
     if (reflib_active)
     {
         Globals.re.GetKeyboardHandler().Close();
         IN.Shutdown();
         Globals.re.Shutdown();
         FreeReflib();
     }
 }
예제 #2
0
파일: VID.cs 프로젝트: optimus-code/Q2Sharp
        static bool LoadRefresh(string name, bool fast)
        {
            if (reflib_active)
            {
                Globals.re.GetKeyboardHandler().Close();
                IN.Shutdown();
                Globals.re.Shutdown();
                FreeReflib();
            }

            Com.Printf("------- Loading " + name + " -------\\n");
            bool found = false;

            String[] driverNames = Renderer.GetDriverNames();
            for (int i = 0; i < driverNames.Length; i++)
            {
                if (driverNames[i].Equals(name))
                {
                    found = true;
                    break;
                }
            }

            if (!found)
            {
                Com.Printf("LoadLibrary(\\\"" + name + "\\\") failed\\n");
                return(false);
            }

            Com.Printf("LoadLibrary(\\\"" + name + "\\\")\\n");
            Globals.re = Renderer.GetDriver(name, fast);
            if (Globals.re == null)
            {
                Com.Error(Defines.ERR_FATAL, name + " can't load but registered");
            }

            if (Globals.re.ApiVersion() != Defines.API_VERSION)
            {
                FreeReflib();
                Com.Error(Defines.ERR_FATAL, name + " has incompatible api_version");
            }

            IN.Real_IN_Init();
            if (!Globals.re.Init((int)vid_xpos.value, (int)vid_ypos.value))
            {
                Globals.re.Shutdown();
                FreeReflib();
                return(false);
            }

            Globals.re.GetKeyboardHandler().Init();
            Com.Printf("------------------------------------\\n");
            reflib_active = true;
            return(true);
        }
예제 #3
0
파일: VID.cs 프로젝트: optimus-code/Q2Sharp
        static void FreeReflib()
        {
            if (Globals.re != null)
            {
                Globals.re.GetKeyboardHandler().Close();
                IN.Shutdown();
            }

            Globals.re    = null;
            reflib_active = false;
        }