Example #1
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void button1_Click(object sender, EventArgs e)
 {
     OpenTK.DisplayDevice dev = OpenTK.DisplayDevice.Default;
     OpenTK.GameWindow asd2 = new OpenTK.GameWindow(1024,768, OpenTK.Graphics.GraphicsMode.Default, "Project X", OpenTK.GameWindowFlags.Default, dev, 3, 0, OpenTK.Graphics.GraphicsContextFlags.Debug);
     //asd2.Run();
     CrashHandler ch = new CrashHandler();
     GLWindow asd3 = new GLWindow(null, "", null, null,ref ch);
     asd3.Run();
 }
Example #2
0
        // OpenGL version after 3.0 needs there own matrix libs so we need to create them if we run over 3.0!!! if set major and minor to 0 we can get around it?!
        /// <summary>
        /// Constructor method for a GLWindow
        /// </summary>
        /// <param name="Events">Events</param>
        /// <param name="SpringOrFall">Is it spring or fall?</param>
        /// <param name="runtime"></param>
        /// <param name="res">Resolution?</param>
        /// <param name="Crash">Crash handler</param>
        public GLWindow(System.Xml.Linq.XDocument Events, string SpringOrFall, string runtime, int[] res, ref CrashHandler Crash)
            : base(res[0], res[1], new OpenTK.Graphics.GraphicsMode(/*new OpenTK.Graphics.ColorFormat(32), 24, 8, 0*/)/*OpenTK.Graphics.GraphicsMode.Default*/, TITLE, GameWindowFlags.Default, DisplayDevice.Default, 0, 0, OpenTK.Graphics.GraphicsContextFlags.Debug | OpenTK.Graphics.GraphicsContextFlags.Default)
        {
            this.WindowBorder = WindowBorder.Fixed;
            Util.SpringOrFall = SpringOrFall;
            #if !DEBUG
            //OpenTK.DisplayDevice.Default.ChangeResolution(this.Width, this.Height, OpenTK.DisplayDevice.AvailableDisplays[0].BitsPerPixel, OpenTK.DisplayDevice.AvailableDisplays[0].RefreshRate);
            WindowState = WindowState.Fullscreen;
            WindowBorder = WindowBorder.Hidden;
            Util.Fullscreen = true;
            System.Windows.Forms.Cursor.Hide();

            #else
            _WriteVersion();

            #endif
            // fix me...
            /*if (runtime.Length < 24) // YYYY-MM-DDYYYY-MM-DDxxxxxx
            {
                throw new Exception("Error in runtime, it is to short");
            }*/

            System.Diagnostics.Debug.WriteLine("Currently used textures: " + Util.CurrentUsedTextures);

            //Keyboard.KeyDown += OnKeyboardKeyDown; // this is depricated...
            this.KeyDown += OnKeyboardKeyDown;

            Closing += OnClosing;

            //blnPointDraw = false;
            //blnWireFrameDraw = false;
            DateTime dtStart = DateTime.Parse(runtime.Substring(0, 10));
            DateTime dtEnd = DateTime.Parse(runtime.Substring(10, 10));
            CrashH = Crash;
            Resolution = res;

            //TimeSpan tsDiff = dtEnd.Subtract(dtStart);

            events = new Event.Event(dtStart, dtEnd, int.Parse(runtime.Substring(20)), Events, ref CrashH);
        }