public static void Init() { _ScreenWidth = ConsoleVarManager.GetValueToUShort("ScreenWidth"); _ScreenHeight = ConsoleVarManager.GetValueToUShort("ScreenHeight"); _CharsPerLine = (ushort)(_ScreenWidth >> 3); // division by 8 _LinesPerScreen = (ushort)((_ScreenHeight >> 3) - 1); // division by 8; last line is console input line _ConsoleBackground = TextureManager.LoadTexture(ConsoleVarManager.GetValueToString("ConsoleBackground"), GL.GL_TEXTURE_2D, TextureManager.TM_PP_NONE); GL.TexEnvi(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, (int)GL.GL_DECAL); _ConsoleChars = TextureManager.LoadTexture(ConsoleVarManager.GetValueToString("ConsoleCharacters"), GL.GL_TEXTURE_2D, TextureManager.TM_PP_NONE); GL.TexEnvi(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, (int)GL.GL_DECAL); }
private static void Command_version(string[] parameters) { ConsoleManager.WriteLine(ConsoleVarManager.GetValueToString("VersionLong")); }
// Init public static void Init() { if (ConsoleVarManager.GetValueToString("Q2ConsoleInit") == "true") { // Init FreeGlut int[] argc = new int[1]; argc[0] = 0; string[] argv = null; FG.Init(argc, argv); FG.InitDisplayMode(FG.GLUT_RGBA | FG.GLUT_DOUBLE | FG.GLUT_DEPTH); FG.InitWindowPosition(25, 25); FG.InitWindowSize(1024, 768); FG.InitContextVersion(2, 1); FG.InitContextFlags((int)FG.GLUT_FORWARD_COMPATIBLE); FG.InitContextProfile((int)FG.GLUT_COMPATIBILITY_PROFILE); int hWindow = FG.CreateWindow(ConsoleVarManager.GetValueToString("VersionLong")); // Setup OpenGL window and OpenGL itself GL.Init(true); // Init DevIL -> Developers Image Libary IL.Init(); ILU.Init(); ILUT.Init(); ILUT.Renderer(ILUT.ILUT_OPENGL); } SetupGL(); // Each time ScreenSize changes, this must be called ConsoleManager.Init(); // Each time ScreenSize changes, this must be called if (ConsoleVarManager.GetValueToString("Q2ConsoleInit") == "true") { string[] OpenGLDotNetInitLog = GLConfig.LogDumpToString(); foreach (string Line in OpenGLDotNetInitLog) { ConsoleManager.WriteLine(Line); } } if (ConsoleVarManager.GetValueToString("Q2ConsoleInit") == "true") { // We don't want to Init and Add commands each time ScreenSize changes CommandManager.Init(); CommandManager.ExecuteCommand("openglinfo"); CommandManager.ExecuteCommand("cpuinfo"); CommandManager.ExecuteCommand("help"); FG.IdleFunc(IdleProc); FG.KeyboardFunc(KeyboardProc); FG.MouseFunc(MouseProc); FG.ReshapeFunc(ReshapeProc); FG.DisplayFunc(DisplayProc); GL.Clear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); FG.SwapBuffers(); // Before entering FG.MainLoop(), we must set the variable ConsoleVarManager.Set("Q2ConsoleInit", "false"); // Enter the FG.MainLoop() FG.SetOption(FG.GLUT_ACTION_ON_WINDOW_CLOSE, (int)FG.GLUT_ACTION_GLUTMAINLOOP_RETURNS); FG.MainLoop(); } }