Exemple #1
0
        public void LauncherRun( LauncherArgument args )
        {
            thisThread = Thread.CurrentThread;

            Form window = LiqueurSystem.Window.Handle as Form;

            window.Load += ( object sender, EventArgs e ) =>
            {
                LiqueurSystem.Window.Title = "Project Liqueur";
                args.Initialize ();
            };
            window.Activated += ( object sender, EventArgs e ) => { args.Activated (); };
            window.Deactivate += ( object sender, EventArgs e ) => { args.Deactivated (); };
            ( LiqueurSystem.Window as Window ).UpdateFrame += ( object sender, EventArgs e ) =>
            {
                if ( invokedMethod.Count > 0 )
                {
                    foreach ( Action action in invokedMethod.ToArray () )
                    {
                        action ();
                        lock ( invokedMethod ) { invokedMethod.Remove ( action ); }
                    }
                }
                if ( !isMultithread )
                    args.UpdateLogic ();
            };
            window.Resize += ( object sender, EventArgs e ) => { args.Resize (); };
            ( LiqueurSystem.Window as Window ).RenderFrame += ( object sender, EventArgs e ) =>
            {
                args.DrawLogic ();
            };
            if ( isMultithread )
            {
                updateThread = new Thread ( () =>
                {
                    while ( window.IsHandleCreated )
                    {
                        args.UpdateLogic ();
                        Thread.Sleep ( 0 );
                    }
                } );
                updateThread.Start ();
            }

            ( LiqueurSystem.Window as Window ).Run ();
        }
Exemple #2
0
        public void LauncherRun( LauncherArgument args )
        {
            GraphicsContext.ShareContexts = true;
            OpenTK.Platform.iPhoneOS.iPhoneOSGameView gameView = LiqueurSystem.Window.Handle as OpenTK.Platform.iPhoneOS.iPhoneOSGameView;

            gameView.Resize += ( object sender, EventArgs e ) => { args.Resize (); };
            gameView.Load += ( object sender, EventArgs e ) =>
            {
                LiqueurSystem.Window.Title = "Project Liqueur";
                args.Initialize ();
            };
            gameView.UpdateFrame += ( object sender, OpenTK.FrameEventArgs e ) =>
            {
                args.UpdateLogic ();
            };
            gameView.RenderFrame += ( object sender, OpenTK.FrameEventArgs e ) =>
            {
                args.DrawLogic ();
            };
            gameView.Run ();
        }
Exemple #3
0
        public void LauncherRun( LauncherArgument args )
        {
            GraphicsContext.ShareContexts = true;
            OpenTK.Platform.Android.AndroidGameView gameView = LiqueurSystem.Window.Handle as OpenTK.Platform.Android.AndroidGameView;

            gameView.Resize += ( object sender, EventArgs e ) => { args.Resize (); };
            gameView.FocusedChanged += ( object sender, EventArgs e ) =>
            {
                if ( gameView.Focused )
                {
                    if ( LiqueurSystem.GraphicsDevice.FullscreenMode )
                        OpenTK.DisplayDevice.Default.ChangeResolution ( OpenTK.DisplayDevice.Default.SelectResolution ( ( int )
                                                                                                                       LiqueurSystem.GraphicsDevice.ScreenSize.X, ( int ) LiqueurSystem.GraphicsDevice.ScreenSize.Y, 32, 60 ) );
                    args.Activated ();
                }
                else
                {
                    args.Deactivated ();
                    OpenTK.DisplayDevice.Default.RestoreResolution ();
                    OpenTK.DisplayDevice.Default.ChangeResolution ( ( LiqueurSystem.GraphicsDevice as GraphicsDevice ).originalResolution );
                }
            };
            gameView.Load += ( object sender, EventArgs e ) =>
            {
                LiqueurSystem.Window.Title = "Project Liqueur";
                args.Initialize ();
            };
            gameView.UpdateFrame += ( object sender, OpenTK.FrameEventArgs e ) =>
            {
                args.UpdateLogic ();
            };
            gameView.RenderFrame += ( object sender, OpenTK.FrameEventArgs e ) =>
            {
                args.DrawLogic ();
            };
            gameView.Run ();
        }
Exemple #4
0
        public void LauncherRun( LauncherArgument args )
        {
            GraphicsContext.ShareContexts = true;
            GameWindow window = LiqueurSystem.Window.Handle as GameWindow;

            thisThread = Thread.CurrentThread;

            string versionString = GL.GetString ( StringName.Version );
            if ( int.Parse ( versionString [ 0 ].ToString () ) < 2 )
                throw new PlatformNotSupportedException (
                    string.Format ( "Platform is not support OpenGL {0}.0 (Support maximum OpenGL Version of This platform: {1})",
                    2, versionString )
                );

            window.Resize += ( object sender, EventArgs e ) => { args.Resize (); };
            window.FocusedChanged += ( object sender, EventArgs e ) =>
            {
                if ( window.Focused )
                {
                    if ( LiqueurSystem.GraphicsDevice.FullscreenMode )
                        OpenTK.DisplayDevice.Default.ChangeResolution ( OpenTK.DisplayDevice.Default.SelectResolution ( ( int )
                            LiqueurSystem.GraphicsDevice.ScreenSize.X, ( int ) LiqueurSystem.GraphicsDevice.ScreenSize.Y, 32, 60 ) );
                    args.Activated ();
                }
                else
                {
                    args.Deactivated ();
                    OpenTK.DisplayDevice.Default.RestoreResolution ();
                    OpenTK.DisplayDevice.Default.ChangeResolution ( ( LiqueurSystem.GraphicsDevice as GraphicsDevice ).originalResolution );
                }
            };
            window.Context.SwapInterval = 0;

            window.Load += ( object sender, EventArgs e ) =>
            {
                LiqueurSystem.Window.Title = "Project Liqueur";
                args.Initialize ();
            };
            window.UpdateFrame += ( object sender, FrameEventArgs e ) =>
            {
                if ( invokedMethod.Count > 0 )
                {
                    foreach ( Action action in invokedMethod.ToArray () )
                    {
                        action ();
                        lock ( invokedMethod ) { invokedMethod.Remove ( action ); }
                    }
                }
                if ( !isMultithread )
                    args.UpdateLogic ();
            };
            window.RenderFrame += ( object sender, FrameEventArgs e ) =>
            {
                args.DrawLogic ();
                Thread.Sleep ( 0 );
            };
            if ( isMultithread )
            {
                updateThread = new Thread ( () =>
                {
                    while ( !window.IsExiting )
                    {
                        args.UpdateLogic ();
                        Thread.Sleep ( 0 );
                    }
                } );
                updateThread.Start ();
            }
            window.Run ();
        }