예제 #1
0
        }   // end of ToastManager Update()

        public static void Render()
        {
            if (alpha > 0.0f)
            {
                ScreenSpaceQuad ssquad = ScreenSpaceQuad.GetInstance();

                // Animate in from the bottom as well as fade in/out.
                Vector4 color = new Vector4(1, 1, 1, alpha);
                curPosition = targetPosition;
                float t = 1.0f - alpha;
                t              = TwitchCurve.Apply(t, TwitchCurve.Shape.EaseInOut);
                curPosition.Y += t * size.Y;
                ssquad.Render(texture, color, curPosition, size, "TexturedRegularAlphaNoZ");
            }
        }   // end of ToastManager Render()
예제 #2
0
            }   // end of RenderObj c'tor

            public override void Render(Camera camera)
            {
                GraphicsDevice device = BokuGame.bokuGame.GraphicsDevice;

                // Animate the dots...
                double tic = Time.WallClockTotalSeconds;

                tic *= 2.0;     // Speed up time?
                for (int i = 0; i < 4; i++)
                {
                    float t = (float)tic + 5.0f - 0.5f * i;
                    t %= 6.0f;
                    if (t > 4.0f)
                    {
                        dots[i].radius = 0.0f;
                        dots[i].alpha  = 0.0f;
                    }
                    else
                    {
                        t *= 0.5f;
                        if (t > 1.0f)
                        {
                            t = 2.0f - t;
                        }
                        t = TwitchCurve.Apply(t, TwitchCurve.Shape.EaseOut);

                        dots[i].radius = t * kMaxRadius;
                        dots[i].alpha  = t;
                    }
                }

                Vector2 screenSize = BokuGame.ScreenSize;

#if NETFX_CORE
                // For some reason, right at the start, this shows up as 0, 0.
                if (screenSize == Vector2.Zero)
                {
                    screenSize = new Vector2(device.Viewport.Width, device.Viewport.Height);
                }
#endif

                Vector2 backgroundSize = new Vector2(backgroundTexture.Width, backgroundTexture.Height);
                Vector2 position       = (screenSize - backgroundSize) / 2.0f;
                // Clamp to pixels.
                position.X = (int)position.X;
                position.Y = (int)position.Y;

                // Clear the screen & z-buffer.
                InGame.Clear(Color.Black);

                SpriteBatch batch = UI2D.Shared.SpriteBatch;

                batch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied);
                {
                    // Apply the background.
                    batch.Draw(backgroundTexture, position, Color.White);

                    // Render dots.
                    for (int i = 0; i < 4; i++)
                    {
                        Vector2 size = new Vector2(dots[i].radius);
                        Vector2 pos  = position + dots[i].position - size;
                        size *= 2;
                        Color color = new Color(1, 1, 1, dots[i].alpha);
                        batch.Draw(dotTexture, new Rectangle((int)pos.X, (int)pos.Y, (int)size.X, (int)size.Y), color);
                        // Reflection
                        color = new Color(1, 1, 1, dots[i].alpha * 0.15f);
                        batch.Draw(dotTexture, new Rectangle((int)pos.X, (int)pos.Y + 150, (int)size.X, (int)size.Y), color);
                    }

                    // If in wait mode, show texture.
                    if (shared.waitMode)
                    {
                        Vector2 size = new Vector2(waitTexture.Width, waitTexture.Height);
                        Vector2 pos  = screenSize * 0.5f - size * 0.5f;
                        pos.Y -= 50;
                        batch.Draw(waitTexture, new Rectangle((int)pos.X, (int)pos.Y, (int)size.X, (int)size.Y), Color.White);
                    }
                }
                batch.End();
            }   // end of Render()