Exemplo n.º 1
0
        internal static unsafe void Render()
        {
            if (disabled)
            {
                return;
            }

            try
            {
                m_SetupPixelCorrectCoordinates(false);

                UIStyleValues.Background.Render();
                UIStyleValues.LogoImage.Render();
                UIStyleValues.LoadingImage.Render();
                UIStyleValues.ProgressBar.Render();
                UIStyleValues.VersionText.Render();

                GfxDevice.PresentFrame();
                if (shouldCallWFLPAGT != 0)
                {
                    GfxDevice.WaitForLastPresentationAndGetTimestamp(shouldCallWFLPAGT);
                }
            }
            catch (Exception e)
            {
                MelonLogger.Error("Exception while rendering: " + e);
                disabled = true;
            }
        }
Exemplo n.º 2
0
        internal static unsafe void Render()
        {
            if (disabled)
            {
                return;
            }

            try
            {
                m_SetupPixelCorrectCoordinates(false);

                UIStyleValues.Background.Render();
                UIStyleValues.LogoImage.Render();
                UIStyleValues.LoadingImage.Render();
                UIStyleValues.ProgressBar.Render();
                UIStyleValues.VersionText.Render();

                /*
                 * if (melonloaderversionTextmesh != null)
                 * {
                 *  if (UIConfig.VersionText.AutoAlign)
                 *      Graphics.DrawMeshNow(melonloaderversionTextmesh, new Vector3(sw / 2, sh - (sh / 2 + (logoHeight / 2) - 35), 0), Quaternion.identity);
                 *  else
                 *      Graphics.DrawMeshNow(melonloaderversionTextmesh, new Vector3(UIConfig.VersionText.CustomPosition.Item1, sh - UIConfig.VersionText.CustomPosition.Item2, 0), Quaternion.identity);
                 * }
                 *
                 * if (progressBar != null)
                 * {
                 *  int x, y, width, height = 0;
                 *  width = 540;
                 *  height = 36;
                 *
                 *  if (UIConfig.ProgressBar.AutoAlign)
                 *  {
                 *      x = (sw - width) / 2;
                 *      y = sh - ((sh - height) / 2 + (logoHeight / 2) + 50);
                 *  }
                 *  else
                 *  {
                 *      x = UIConfig.ProgressBar.CustomPosition.Item1;
                 *      y = UIConfig.ProgressBar.CustomPosition.Item2;
                 *  }
                 * }
                 */

                GfxDevice.PresentFrame();
                if (shouldCallWFLPAGT != 0)
                {
                    GfxDevice.WaitForLastPresentationAndGetTimestamp(shouldCallWFLPAGT);
                }
            }
            catch (Exception e)
            {
                MelonLogger.Error("Exception while rendering: " + e);
                disabled = true;
            }
        }
Exemplo n.º 3
0
        internal static unsafe void Render()
        {
            if (disabled)
            {
                return;
            }

            try
            {
                m_SetupPixelCorrectCoordinates(false);

                int sw = Screen.width;
                int sh = Screen.height;

                int logoHeight = (int)(sh * 0.4f);
                int logoWidth  = (int)(logoHeight * logoRatio);

                if (UIStyleValues.BackgroundImage != null)
                {
                    UIStyleValues.BackgroundImage.Render(0, sh, sw, -sh);
                }
                else
                {
                    Graphics.DrawTexture(new Rect(0, 0, sw, sh), UIStyleValues.BackgroundTexture);
                }

                UIStyleValues.LogoImage?.Render((sw - logoWidth) / 2, sh - ((sh - logoHeight) / 2 - 46), logoWidth, -logoHeight);

                UIStyleValues.LoadingImage?.Render(sw - 200, 200, 132);

                UIStyleValues.TextFont.material.SetPass(0);

                if (melonloaderversionTextmesh != null)
                {
                    Graphics.DrawMeshNow(melonloaderversionTextmesh, new Vector3(sw / 2, sh - (sh / 2 + (logoHeight / 2) - 35), 0), Quaternion.identity);
                }

                if (progressBar != null)
                {
                    progressBar.SetPosition(
                        (sw - 540) / 2,
                        sh - ((sh - 36) / 2 + (logoHeight / 2) + 50));
                    progressBar.Render();
                }

                GfxDevice.PresentFrame();
                if (shouldCallWFLPAGT != 0)
                {
                    GfxDevice.WaitForLastPresentationAndGetTimestamp(shouldCallWFLPAGT);
                }
            }
            catch (Exception e)
            {
                MelonLogger.Error("Exception while rendering: " + e);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Scene Drawing and Updating.
        /// </summary>
        public void UpdateAndDraw()
        {
            this.ThrottleIfInactive();
            App.BeginProfiling();
            try
            {
                float elapsedSecs   = this.mStopWatch.GetElapsedMilliSecs() / 1000f;
                float deltaRealTime = elapsedSecs - this.mTimeAtLastFrame;
                float deltaGameTime = 0f;
                if (!this.mPauseGameTime)
                {
                    deltaGameTime = deltaRealTime * this.mGameTimeMultiplier;
                }
                this.mTotalRealTime += deltaRealTime;
                this.mTotalGameTime += deltaGameTime;
                EngineTime engineTime = new EngineTime(deltaRealTime, deltaGameTime,
                                                       this.mTotalRealTime, this.mTotalGameTime);
                this.mTimeAtLastFrame = elapsedSecs;

                App.PauseGameClock(this.mPauseGameTime);
                App.SetGameTimeScale(this.mGameTimeMultiplier);
                App.Update(deltaRealTime, deltaGameTime);
                Sims3.CSHost.Animation.Manager.UpdateRenderer(deltaGameTime);
                this.UpdateExtra(engineTime);
                if (GfxDevice.BeginScene())
                {
                    this.mScene.BeginFrame();
                    this.mScene.DrawScene();
                    this.DrawExtra(engineTime);
                    if (!this.mHideUI)
                    {
                        GfxDevice.RectInt viewport = GfxDevice.GetViewport();
                        App.RenderUI(viewport.left, viewport.top, viewport.right, viewport.bottom);
                    }
                    GfxDevice.EndScene();
                }
                GfxDevice.Present();
            }
            finally
            {
                App.EndProfiling();
            }
        }
Exemplo n.º 5
0
        private void UpdateNativeCanvasSize()
        {
            Size clientSize = base.ClientSize;

            if (!clientSize.IsEmpty && this.mNativeCanvas != IntPtr.Zero && clientSize != GfxDevice.Resolution)
            {
                GfxDevice.Resolution = clientSize;
                GfxDevice.SetWindow(this.mNativeCanvas);
                GfxDevice.Reinit();
                // Fail Safe in case SetWindowPos and SetResolution
                // both fail to update the rendering canvas

                /*GfxDevice.RectInt viewport = new GfxDevice.RectInt();
                 * viewport.left = base.ClientRectangle.Left;
                 * viewport.top = base.ClientRectangle.Top;
                 * viewport.right = base.ClientRectangle.Right;
                 * viewport.bottom = base.ClientRectangle.Bottom;
                 * GfxDevice.SetViewport(viewport);/**/
            }
        }