Example #1
0
        private void DrawingSurfaceBackground_Loaded(object sender, RoutedEventArgs e)
        {
            if (m_d3dBackground == null)
            {
                m_d3dBackground = new Direct3DBackground();

                // Définir les limites de la fenêtre en pixels indépendants du périphérique
                m_d3dBackground.WindowBounds = new Windows.Foundation.Size(
                    (float)Application.Current.Host.Content.ActualWidth,
                    (float)Application.Current.Host.Content.ActualHeight
                    );

                // Définir la résolution native en pixels
                m_d3dBackground.NativeResolution = new Windows.Foundation.Size(
                    (float)Math.Floor(Application.Current.Host.Content.ActualWidth * Application.Current.Host.Content.ScaleFactor / 100.0f + 0.5f),
                    (float)Math.Floor(Application.Current.Host.Content.ActualHeight * Application.Current.Host.Content.ScaleFactor / 100.0f + 0.5f)
                    );

                // Définir la résolution de rendu sur la résolution native complète
                m_d3dBackground.RenderResolution = m_d3dBackground.NativeResolution;

                // Raccorder le composant natif à DrawingSurfaceBackgroundGrid
                DrawingSurfaceBackground.SetBackgroundContentProvider(m_d3dBackground.CreateContentProvider());
                DrawingSurfaceBackground.SetBackgroundManipulationHandler(m_d3dBackground);
            }
        }
Example #2
0
        private void DrawingSurfaceBackground_Loaded(object sender, RoutedEventArgs e)
        {
            if (_background == null)
            {
                _background = new Direct3DBackground();
                _background.DeviceRotation = _rot;

                // Set window bounds in dips
                _background.WindowBounds = new Windows.Foundation.Size(
                    (float)Application.Current.Host.Content.ActualWidth,
                    (float)Application.Current.Host.Content.ActualHeight
                    );

                // Set native resolution in pixels
                _background.NativeResolution = new Windows.Foundation.Size(
                    (float)Math.Floor(Application.Current.Host.Content.ActualWidth * Application.Current.Host.Content.ScaleFactor / 100.0f + 0.5f),
                    (float)Math.Floor(Application.Current.Host.Content.ActualHeight * Application.Current.Host.Content.ScaleFactor / 100.0f + 0.5f)
                    );

                // Set render resolution to the full native resolution
                _background.RenderResolution = _background.NativeResolution;

                // Hook-up native component to DrawingSurfaceBackgroundGrid
                DrawingSurfaceBackground.SetBackgroundContentProvider(_background.CreateContentProvider());
                DrawingSurfaceBackground.SetBackgroundManipulationHandler(_background);

                _background.PostToUIThread   = PostToUIThread;
                _background.ActivateKeyboard = ActivateKeyboard;
            }
        }
        private void DrawingSurfaceBackground_Loaded(object sender, RoutedEventArgs e)
        {
            if (m_d3dBackground == null)
            {
                m_d3dBackground = new Direct3DBackground();

                // Set window bounds in dips
                m_d3dBackground.WindowBounds = new Windows.Foundation.Size(
                    (float)Application.Current.Host.Content.ActualWidth,
                    (float)Application.Current.Host.Content.ActualHeight
                    );

                // Set native resolution in pixels
                m_d3dBackground.NativeResolution = new Windows.Foundation.Size(
                    (float)Math.Floor(Application.Current.Host.Content.ActualWidth * Application.Current.Host.Content.ScaleFactor / 100.0f + 0.5f),
                    (float)Math.Floor(Application.Current.Host.Content.ActualHeight * Application.Current.Host.Content.ScaleFactor / 100.0f + 0.5f)
                    );

                // Set render resolution to the full native resolution
                m_d3dBackground.RenderResolution = m_d3dBackground.NativeResolution;

                // Hook-up native component to DrawingSurfaceBackgroundGrid
                DrawingSurfaceBackground.SetBackgroundContentProvider(m_d3dBackground.CreateContentProvider());
                DrawingSurfaceBackground.SetBackgroundManipulationHandler(m_d3dBackground);
            }
        }
Example #4
0
        private void DrawingSurfaceBackground_Loaded(object sender, RoutedEventArgs e)
        {
            if (_d3dBackground == null)
            {
                _d3dBackground = new Direct3DBackground();

                // Set window bounds in dips
                _d3dBackground.WindowBounds = new Windows.Foundation.Size(
                    (float)Application.Current.Host.Content.ActualWidth,
                    (float)Application.Current.Host.Content.ActualHeight
                    );

                // Set native resolution in pixels
                _d3dBackground.NativeResolution = new Windows.Foundation.Size(
                    (float)Math.Floor(Application.Current.Host.Content.ActualWidth * Application.Current.Host.Content.ScaleFactor / 100.0f + 0.5f),
                    (float)Math.Floor(Application.Current.Host.Content.ActualHeight * Application.Current.Host.Content.ScaleFactor / 100.0f + 0.5f)
                    );

                // Set render resolution to the full native resolution
                _d3dBackground.RenderResolution = _d3dBackground.NativeResolution;

                // Hook-up native component to DrawingSurfaceBackgroundGrid
                DrawingSurfaceBackground.SetBackgroundContentProvider(_d3dBackground.CreateContentProvider());
                DrawingSurfaceBackground.SetBackgroundManipulationHandler(_d3dBackground);

                _level = new Level();
                _level.Initialise(_d3dBackground.Scene);
            }
        }
Example #5
0
        private void DrawingSurfaceBackground_Loaded(object sender, RoutedEventArgs e)
        {
            if (d3dBackground == null)
            {
                d3dBackground = new Direct3DBackground();

                d3dBackground.NativeResolution = new Windows.Foundation.Size(
            (float)Math.Floor(Application.Current.Host.Content.ActualWidth * Application.Current.Host.Content.ScaleFactor / 100.0f + 0.5f),
            (float)Math.Floor(Application.Current.Host.Content.ActualHeight * Application.Current.Host.Content.ScaleFactor / 100.0f + 0.5f)
            );
                DrawingSurfaceBackground.SetBackgroundManipulationHandler(d3dBackground);
                DrawingSurfaceBackground.SetBackgroundContentProvider(d3dBackground.CreateContentProvider());
            }
        }
Example #6
0
        private void DrawingSurfaceBackground_Loaded(object sender, RoutedEventArgs e)
        {
            if (d3dBackground == null)
            {
                d3dBackground = new Direct3DBackground();

                d3dBackground.NativeResolution = new Windows.Foundation.Size(
                    (float)Math.Floor(Application.Current.Host.Content.ActualWidth * Application.Current.Host.Content.ScaleFactor / 100.0f + 0.5f),
                    (float)Math.Floor(Application.Current.Host.Content.ActualHeight * Application.Current.Host.Content.ScaleFactor / 100.0f + 0.5f)
                    );
                DrawingSurfaceBackground.SetBackgroundManipulationHandler(d3dBackground);
                DrawingSurfaceBackground.SetBackgroundContentProvider(d3dBackground.CreateContentProvider());
            }
        }
Example #7
0
        private async void DrawingSurfaceBackground_Loaded(object sender, RoutedEventArgs e)
        {
            if (m_d3dBackground == null)
            {
                this.m_d3dBackground = new Direct3DBackground();

                this.m_d3dBackground.SetContinueNotifier(this.ContinueEmulation);
                this.m_d3dBackground.SnapshotAvailable = FileHandler.CaptureSnapshot;
                this.m_d3dBackground.SavestateCreated  = FileHandler.CreateSavestate;
                this.m_d3dBackground.SavestateSelected = this.savestateSelected;
                Direct3DBackground.WrongCheatVersion   = this.wrongCheatVersion;
                Direct3DBackground.ToggleTurboMode     = this.ToggleTurboMode;

                this.InitAppBar();

                // Set window bounds in dips
                m_d3dBackground.WindowBounds = new Windows.Foundation.Size(
                    (float)Application.Current.Host.Content.ActualWidth,
                    (float)Application.Current.Host.Content.ActualHeight
                    );

                // Set native resolution in pixels
                m_d3dBackground.NativeResolution = new Windows.Foundation.Size(
                    (float)Math.Floor(Application.Current.Host.Content.ActualWidth * Application.Current.Host.Content.ScaleFactor / 100.0f + 0.5f),
                    (float)Math.Floor(Application.Current.Host.Content.ActualHeight * Application.Current.Host.Content.ScaleFactor / 100.0f + 0.5f)
                    );

                // Set render resolution to the full native resolution
                m_d3dBackground.RenderResolution = m_d3dBackground.NativeResolution;

                // Hook-up native component to DrawingSurfaceBackgroundGrid
                DrawingSurfaceBackground.SetBackgroundContentProvider(m_d3dBackground.CreateContentProvider());
                DrawingSurfaceBackground.SetBackgroundManipulationHandler(m_d3dBackground);
            }

            //this.initialized = true;

            ROMDatabase db = ROMDatabase.Current;

            //if (ROMLoaded && this.cache == null)  //this never happens so just get rid of it
            //{
            //    var entry = db.GetROM(this.m_d3dBackground.LoadadROMFile.Name);
            //    var cheats = await FileHandler.LoadCheatCodes(entry);
            //    this.m_d3dBackground.LoadCheats(cheats);

            //    this.m_d3dBackground.UnpauseEmulation();
            //}


            if (EmulatorPage.cache != null && EmulatorPage.cache.file != null && EmulatorPage.cache.folder != null) // a safeguard to make sure we have enough info to load ROM
                                                                                                                    //this is all null if returned from tombstone
            {
                if (ROMLoaded && this.m_d3dBackground.LoadadROMFile.Name.Equals(EmulatorPage.cache.file.Name))      //name match, we are resuming to current game
                {
                    var entry  = db.GetROM(this.m_d3dBackground.LoadadROMFile.Name);
                    var cheats = await FileHandler.LoadCheatCodes(entry);

                    this.m_d3dBackground.LoadCheats(cheats);

                    //this.m_d3dBackground.UnpauseEmulation();
                }
                else  //name does not match or ROM is not loaded, we are loading a new rom
                {
                    var entry  = db.GetROM(EmulatorPage.cache.file.Name);
                    var cheats = await FileHandler.LoadCheatCodes(entry);

                    this.m_d3dBackground.LoadCheatsOnROMLoad(cheats);

                    // Load new ROM

                    await this.m_d3dBackground.LoadROMAsync(EmulatorPage.cache.file, EmulatorPage.cache.folder);

                    //if (EmulatorSettings.Current.SelectLastState)
                    {
                        RestoreLastSavestate(EmulatorPage.cache.file.Name);
                    }

                    ROMLoaded = true;
                }


                int orientation = 0;
                switch (this.Orientation)
                {
                case PageOrientation.LandscapeLeft:
                case PageOrientation.Landscape:
                    orientation = 0;
                    break;

                case PageOrientation.LandscapeRight:
                    orientation = 1;
                    break;

                case PageOrientation.PortraitUp:
                case PageOrientation.Portrait:
                    orientation = 2;
                    break;
                }
                this.m_d3dBackground.ChangeOrientation(orientation);
            }

            //set app bar color in case returning from setting page
            if (ApplicationBar != null)
            {
                ApplicationBar.BackgroundColor = (Color)App.Current.Resources["CustomChromeColor"];
                ApplicationBar.ForegroundColor = (Color)App.Current.Resources["CustomForegroundColor"];
            }
        }