コード例 #1
0
 public SplashScreen(GameCore gamecore)
     : base(gamecore)
 {
     int width = gamecore.Window.ClientBounds.Right - gamecore.Window.ClientBounds.Left;
     int height = gamecore.Window.ClientBounds.Bottom - gamecore.Window.ClientBounds.Top;
     bt1 = new Button(gamecore, mygame.Content.Load<Texture2D>("Button"), mygame.Content.Load<Texture2D>("labelStart"), mygame.Content.Load<Texture2D>("ButtonS2"), 23, new Vector3(width / 3 - 50, height * 4 / 5, 0), new ScriptBt1(mygame), 1.4f);
     bt2 = new Button(gamecore, mygame.Content.Load<Texture2D>("Button"), mygame.Content.Load<Texture2D>("labelEject"), mygame.Content.Load<Texture2D>("ButtonS2"), 23, new Vector3(width * 2 / 3 - 50, height * 4 / 5, 0), new ScriptBt2(mygame), 1.4f);
     addComponent(bt1);
     addComponent(bt2);
     bt1.setSelected(true);
     bg = mygame.Content.Load<Texture2D>("bg");
     title = mygame.Content.Load<Texture2D>("labelTitle");
     titlepos = new Vector2((width - title.Width) / 2, height / 5);
     while (width > 0)
     {
         width -= 200;
         int htemp = height;
         while (htemp > -200)
         {
             htemp -= 200;
             bgpos.Add(new Vector2(width, htemp));
         }
     }
     szbg = bgpos.Count;
 }
コード例 #2
0
        public ScreenTitle(GameCore gamecore, Vector2 animacao)
            : base(gamecore)
        {
            this.animacao = animacao;
            int width = wwidth = gamecore.Window.ClientBounds.Right - gamecore.Window.ClientBounds.Left;
            int height = wheight = gamecore.Window.ClientBounds.Bottom - gamecore.Window.ClientBounds.Top;
            bt1 = new Button(gamecore, mygame.Content.Load<Texture2D>("Button"), mygame.Content.Load<Texture2D>("labelStart"), mygame.Content.Load<Texture2D>("ButtonS2"), 23, new Vector3(width / 3 - 150, height * 15 / 20, 0),new ScriptBt1(mygame),1.4f);
            bt2 = new Button(gamecore, mygame.Content.Load<Texture2D>("Button"), mygame.Content.Load<Texture2D>("labelEject"), mygame.Content.Load<Texture2D>("ButtonS2"), 23, new Vector3(width * 2 / 3 + 50, height * 17 / 20, 0), new ScriptBt2(mygame), 1.4f);
            bt3 = new Button(gamecore, mygame.Content.Load<Texture2D>("Button"), mygame.Content.Load<Texture2D>("labelRecords"), mygame.Content.Load<Texture2D>("ButtonS2"), 23, new Vector3((width/2 - 50), height * 16 / 20, 0), new ScriptBt3(mygame,ref animacao), 1.4f);
            for (int i = 0; i < 3; i++) {
                Sprite nave = new Sprite(mygame, mygame.Content.Load<Texture2D>("naveP"),  4, new Vector3(rnd.Next(wwidth), height + height + rnd.Next(600 + height), 0), (float)((rnd.NextDouble() + 1) / 2));
                addComponent(nave);
                naves.Add(nave);
            }
            for (int i = 0; i < 30; i++) {
                Sprite nave = new Sprite(mygame, mygame.Content.Load<Texture2D>("mosca2"),  3, new Vector3(rnd.Next(wwidth), -rnd.Next(600), 0), (float)((rnd.NextDouble() + 1) / 2));
                addComponent(nave);
                navesInimigas.Add(nave);
            }

            addComponent(bt1);
            addComponent(bt2);
            addComponent(bt3);
            bt1.setSelected(true);
            bg = mygame.Content.Load<Texture2D>("bg");
            title = mygame.Content.Load<Texture2D>("labelTitle");
            titlepos = new Vector2((width - title.Width) / 2, height / 5);
            while (width > 0) {
                width -= 200;
                int htemp = height;
                while (htemp > -200) {
                    htemp -= 200;
                    bgpos.Add(new Vector2(width, htemp));
                }
            }
            szbg = bgpos.Count;
            mygame.sons.playSong(1);
        }