Ejemplo n.º 1
0
        /// <summary>
        /// Runs the UI application's main loop. The GameWindow updates and renders at the specified frequency.
        /// </summary>
        /// <param name="args">Arguments from the commandline.</param>
        /// <param name="updatesPerSecond">The frequency of UpdateFrame events.</param>
        /// <param name="framesPerSecond">The frequency of RenderFrame events.</param>
        public void Run(string[] args, double updatesPerSecond, double framesPerSecond)
        {
            // Initialize SDL2
            SDL.TizenAppInit(args.Length, args);
            SDL.SetMainReady();
            Toolkit.Init();

            // Set Internal Event Handlers
            Backend.AddEventHandler(TizenGameCoreBackend.InternalCreateEventType, () =>
            {
                // In Tizen SDL Backend, GL Attributes should be set before creating the window.
                SetGLAttributes(GraphicsMode, GLMajor, GLMinor);
                window = new TizenGameWindow(GraphicsMode, DisplayDevice.Default, Current.ApplicationInfo.ExecutablePath, GLMajor, GLMinor);
            });

            Backend.AddEventHandler(TizenGameCoreBackend.InternalTerminateEventType, () =>
            {
                window.Exit();
            });

            Backend.AddEventHandler(TizenGameCoreBackend.InternalResumeEventType, () =>
            {
                window.Paused = false;
            });

            Backend.AddEventHandler(TizenGameCoreBackend.InternalPauseEventType, () =>
            {
                window.Paused = true;
            });


            // Configure callbacks for application events
            base.Run(args);

            // Run mainloop
            window.RunInternal(updatesPerSecond, framesPerSecond);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Exits the main loop of the application.
 /// </summary>
 /// <since_tizen> 3 </since_tizen>
 public override void Exit()
 {
     window.Exit();
 }