public static void Initialize()
        {
            if (GameSettings.MusicOn)
            {
                MediaPlayer.IsRepeating = true;
                MediaPlayer.Volume = GameSettings.MusicVolume;
                MediaPlayer.Play(MenuSong);
            }

            buttonRecs = new fRectangle[4];
            fRectangle reference = new fRectangle(Gl.graphics.Viewport.Width / 2f, Gl.graphics.Viewport.Height / 3f * 2f, btStart.Width * 4, btStart.Height * 2);
            buttonRecs[0] = reference + new Vector2(-100, -50);
            buttonRecs[1] = reference + new Vector2(100, -50);
            buttonRecs[2] = reference + new Vector2(-100, 50);
            buttonRecs[3] = reference + new Vector2(100, 50);

            hoveringCurrent = 0;
        }
        public static void Draw()
        {
            Gl.graphics.Clear(Color.Black);

            Gl.sB.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, RasterizerState.CullNone);
            if (Gl.game.isLoading)
            {
                Gl.sB.DrawString(font, "Loading...", Vector2.Zero, Color.White);
            }

            #region Intro Sequence
            //Logo
            float alpha = 1;
            if (time >= 30 && time < 125)
                alpha = (time - 30) / 95f;
            else if (time >= 170)
                alpha = 0;
            Gl.sB.Draw(logoTexture, new Vector2(Gl.graphics.Viewport.Width / 2f, Gl.graphics.Viewport.Height / 2f), null, Color.White * alpha, 0f,
                new Vector2(logoTexture.Width / 2f, logoTexture.Height / 2f), 1f, SpriteEffects.None, 0f);

            //Banner
            if (time > 230)
            {
                Gl.sB.Draw(banner, new Rectangle(0, 0, Gl.graphics.Viewport.Width, banner.Height * (Gl.graphics.Viewport.Width / banner.Width)), Color.White);
            }
            //Buttons
            if (time > 280)
            {
                fRectangle reference = new fRectangle(Gl.graphics.Viewport.Width / 2f, Gl.graphics.Viewport.Height / 3f * 2f, btStart.Width * 4, btStart.Height * 2);
                Gl.sB.Draw(btStart, (reference + new Vector2(-100, -50)).Convert(), new Rectangle(0, 0, btStart.Width, btStart.Height / 2), Color.White);
                Gl.sB.Draw(btSettings, (reference + new Vector2(100, -50)).Convert(), new Rectangle(0, 0, btSettings.Width, btSettings.Height / 2), Color.White);
                Gl.sB.Draw(btEditor, (reference + new Vector2(-100, 50)).Convert(), new Rectangle(0, 0, btEditor.Width, btEditor.Height / 2), Color.White);
                Gl.sB.Draw(btExit, (reference + new Vector2(100, 50)).Convert(), new Rectangle(0, 0, btExit.Width, btExit.Height / 2), Color.White);
            }
            #endregion

            Gl.sB.End();
        }
Exemplo n.º 3
0
 public static void DrawRectangle(fRectangle rec, Color color, Color borderColor, float borderThickness = 1f, float depth = 0f)
 {
     sB.Draw(dot,  rec.Position, null, color, 0f, Vector2.Zero, rec.Size, SpriteEffects.None, depth);
     if (borderThickness != 0f)
     {
         DrawRectangle(new fRectangle(rec.X, rec.Y, rec.Width, borderThickness), borderColor, depth);
         DrawRectangle(new fRectangle(rec.X, rec.Y, borderThickness, rec.Height), borderColor, depth);
         DrawRectangle(new fRectangle(rec.X, rec.Bottom - borderThickness, rec.Width, borderThickness), borderColor, depth);
         DrawRectangle(new fRectangle(rec.Right - borderThickness, rec.Y, borderThickness, rec.Height), borderColor, depth);
     }
 }
Exemplo n.º 4
0
 public static void DrawRectangle(fRectangle rec, Color color, float depth = 0f)
 {
     sB.Draw(dot, rec.Position, null, color, 0f, Vector2.Zero, rec.Size, SpriteEffects.None, depth);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Returns a bool indicating whether the two rectangles overlap (inclusive)
 /// </summary>
 public bool Intersects(fRectangle rec)
 {
     return (Math.Abs(Center.X - rec.Center.X) * 2 <= (Width + rec.Width)) &&
         (Math.Abs(Center.Y - rec.Center.Y) * 2 <= (Height + rec.Height));
 }
Exemplo n.º 6
0
 public static bool Intersects(Rectangle recA, fRectangle recB)
 {
     return (Math.Abs(recA.Center.X - recB.Center.X) <= (recA.Width + recB.Width)) &&
         (Math.Abs(recA.Center.Y - recA.Center.Y) <= (recA.Height + recB.Height));
 }
Exemplo n.º 7
0
 public static bool Contains(fRectangle rec, Point point)
 {
     return (point.X >= rec.Left && point.X <= rec.Right && point.Y >= rec.Top && point.Y <= rec.Bottom);
 }