當前位置: 首頁>>代碼示例>>C#>>正文


C# Framework.GameWindow類代碼示例

本文整理匯總了C#中Microsoft.Xna.Framework.GameWindow的典型用法代碼示例。如果您正苦於以下問題:C# GameWindow類的具體用法?C# GameWindow怎麽用?C# GameWindow使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


GameWindow類屬於Microsoft.Xna.Framework命名空間,在下文中一共展示了GameWindow類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: PersonnageJouable

        public PersonnageJouable(GameWindow window, Sexe sexe)
            : base(40, 0, 1, new Arme(Arme.typearme.Poing), new Rectangle(window.ClientBounds.Width / 2 - 10, window.ClientBounds.Height / 2 - 40, 20, 10))
        {
            rectangle = new Rectangle(window.ClientBounds.Width / 2 - 10, window.ClientBounds.Height / 2 - 25, 40, 100);
            collisionhaut = new Rectangle(rectangle.X, rectangle.Y + 60, rectangle.Width, 40);
            collisionbas = new Rectangle(rectangle.X, rectangle.Y + rectangle.Height, rectangle.Width, 10);
            collisiongauche = new Rectangle(rectangle.X - 10, rectangle.Y + 60, 10, 40);
            collisiondroite = new Rectangle(rectangle.X + rectangle.Width, rectangle.Y + 60, 10, 40);
            this.window = window;
            this.sexe = sexe;

            #region Initialisation des booleens de deplacement
            dplcmthaut = false;
            dplcmtbas = false;
            dplcmtgauche = false;
            dplcmtdroite = false;
            versbas = false;
            versdroite = false;
            versgauche = false;
            vershaut = false;
            blocbas = false;
            blocdroit = false;
            blocgauche = false;
            blochaut = false;
            #endregion

            #region Initialisation des textures(Vers le bas)
            haut = false;
            bas = true;
            gauche = false;
            droite = false;
            compteurtext = 0;
            #endregion
        }
開發者ID:Darkrely,項目名稱:Dragon-Tears,代碼行數:34,代碼來源:PersonnageJouable.cs

示例2: Menu

        public Menu(GameWindow window)
        {
            hauteur = window.ClientBounds.Height;
            largeur = window.ClientBounds.Width;

            #region Booleen clavier
            clavierhaut = false;
            clavierbas = false;
            clavierentrer = false;
            changement = false;
            flechegauche = false;
            flechedroite = false;
            #endregion

            choix = 1;
            numerocarte = 0;
            rectselecteur = new Rectangle(10, 60, 40, 30);
            langue = Langue.Francais;
            mode = Mode.Menu;
            sound = Son.On;
            pauseactive = false;
            carte_hauteur = 5;
            carte_largeur = 5;
            clavierType = ClavierType.AZERTY;
            message = new Message(largeur, hauteur);
        }
開發者ID:HunterB06,項目名稱:Dragon-Tears,代碼行數:26,代碼來源:Menu.cs

示例3: GamePlay

 public GamePlay(MapMaker mapMaker, GameWindow window)
 {
     this.MapMaker = mapMaker;
     this.LevelObjects = new List<GameObject>();
     this.Window = window;
     LevelCreators.Peek()();
 }
開發者ID:josiah1888,項目名稱:game-dev,代碼行數:7,代碼來源:GamePlay.cs

示例4: SetScreenSize

        public static void SetScreenSize(GameWindow window)
        {
            Microsoft.Xna.Framework.Rectangle game;
            System.Drawing.Rectangle screen;

            if (window != null)
            {
                game = window.ClientBounds;
                screen = Screen.GetWorkingArea(new System.Drawing.Rectangle(game.X, game.Y, game.Width, game.Height));
            }
            else
            {
                screen = Screen.GetWorkingArea(new System.Drawing.Point(0, 0));
            }

            foreach (DisplayMode mode in GraphicsAdapter.DefaultAdapter.SupportedDisplayModes)
            {
                if (mode.Format != SurfaceFormat.Color)
                    continue;
                ResolutionConfig res = new ResolutionConfig(mode.Width, mode.Height);
                if (!FullScreenResolutionsList.Contains(res))
                {
                    FullScreenResolutionsList.Add(res);
                }
            }

            foreach (ResolutionConfig res in FullScreenResolutionsList)
            {
                if (!PlayWindowResolutionsList.Contains(res) && res.Width <= screen.Width && res.Height <= screen.Height)
                {
                    PlayWindowResolutionsList.Add(res);
                }
            }
        }
開發者ID:azmanomer,項目名稱:UltimaXNA,代碼行數:34,代碼來源:Resolutions.cs

示例5: PNJ

 public PNJ(int x, int y, string[] textes, string nom, Item item, GameWindow window)
 {
     this.nom = nom;
     dialogue = new Dialogue(textes, nom, window);
     this.item = item;
     pnj = new Rectangle(x, y, 40, 100);
 }
開發者ID:HunterB06,項目名稱:Dragon-Tears,代碼行數:7,代碼來源:PNJ.cs

示例6: Core

        public Core(ContentManager content, GraphicsDevice graphicsDevice, GameWindow window)
            : base(window)
        {
            this.content = content;

            Initialiaze();
        }
開發者ID:vitormartins1,項目名稱:the-evolution-of-revolution,代碼行數:7,代碼來源:Core.cs

示例7: EcranChargement

 public EcranChargement(GameWindow window)
 {
     coord_ecran = new Rectangle(0, 0, window.ClientBounds.Width, window.ClientBounds.Height);
     transition = false;
     compteur = 0;
     opacite = 400;
 }
開發者ID:Darkrely,項目名稱:Seconde_soutenance,代碼行數:7,代碼來源:EcranChargement.cs

示例8: HookWindowClosingShouldSavePosition

        private void HookWindowClosingShouldSavePosition(GameWindow gameWindow)
        {
            var field = typeof(OpenTKGameWindow).GetField("window", BindingFlags.NonPublic | BindingFlags.Instance);
            var window = (OpenTK.GameWindow)field.GetValue(gameWindow);

            window.Closing += (sender, args) => this.service.PersistGameWindowPosition(window.X, window.Y);
        }
開發者ID:plaurin,項目名稱:MonoGameEngine2D,代碼行數:7,代碼來源:GameNavigatorGateway.cs

示例9: Rato

        public Rato(Texture2D textura, GameWindow window, SoundEffect efeitoSonoro)
            : base(textura)
        {
            this.textura = textura;
            this.window = window;
            this.efeitoSonoro = efeitoSonoro;

            andando_direita_esquerda = new animacao();
            andando_direita_esquerda.qtd_quadros = 4;
            andando_direita_esquerda.quadros_seg = 2;
            andando_direita_esquerda.Y = 0;
            andando_direita_esquerda.quadro_X = textura.Width / andando_direita_esquerda.qtd_quadros;
            andando_direita_esquerda.quadro_Y = textura.Height / 3;
            andando_direita_esquerda.nome = "horizontal";

            andando_cima_baixo = new animacao();
            andando_cima_baixo.qtd_quadros = 4;
            andando_cima_baixo.quadros_seg = 2;
            andando_cima_baixo.Y = textura.Height/3;
            andando_cima_baixo.quadro_X = textura.Width / andando_direita_esquerda.qtd_quadros;
            andando_cima_baixo.quadro_Y = textura.Height / 3;
            andando_cima_baixo.nome = "vertical";

            parado = new animacao();
            parado.qtd_quadros = 1;
            parado.quadros_seg = 2;
            parado.Y = textura.Height/3*2;
            parado.quadro_X = textura.Width / andando_direita_esquerda.qtd_quadros;
            parado.quadro_Y = textura.Height / 3;
            parado.nome = "parado";

            animacao_atual = andando_direita_esquerda;

            destino = new Rectangle(0, 0, andando_direita_esquerda.quadro_X, andando_direita_esquerda.quadro_Y);
        }
開發者ID:striketm,項目名稱:seven-dev3517b,代碼行數:35,代碼來源:Rato.cs

示例10: Moto

        public Moto(ContentManager Content, GameWindow Window)
            : base(Content.Load<Texture2D>("moto"))
        {
            this.Window = Window;

            textura = Content.Load<Texture2D>("moto");

            posicao = new Vector2(200, 300);

            ronco = Content.Load<SoundEffect>("Sounds/SoundEffects/sound_effect");

            andando = new animacao();
            andando.quadro_X = 67;
            andando.quadro_Y = 47;
            andando.qtd_quadros = 3;
            andando.quadros_seg = 3;
            andando.Y = 0;

            correndo = new animacao();
            correndo.quadro_X = 67;
            correndo.quadro_Y = 47;
            correndo.qtd_quadros = 3;
            correndo.quadros_seg = 9;
            correndo.Y = 47;

            animacao_atual = correndo;
        }
開發者ID:clewerton,項目名稱:motocroxxx,代碼行數:27,代碼來源:Moto.cs

示例11: MoveGameWindow

 private static void MoveGameWindow(GameWindow gameWindow, int x, int y)
 {
     var field = typeof(OpenTKGameWindow).GetField("window", BindingFlags.NonPublic | BindingFlags.Instance);
     var window = (OpenTK.GameWindow)field.GetValue(gameWindow);
     window.X = x;
     window.Y = y;
 }
開發者ID:plaurin,項目名稱:MonoGameEngine2D,代碼行數:7,代碼來源:GameNavigatorGateway.cs

示例12: Ball_Bounce

 public Ball_Bounce(Texture2D tex, Vector2 pos, GameWindow window)
     : base(tex,pos,tex.Width/2,hitBox)
 {
     this.bX = window.ClientBounds.Width;
     this.bY = window.ClientBounds.Height;
     this.speed = new Vector2(2, 0);
 }
開發者ID:Nerminkrus,項目名稱:Spel,代碼行數:7,代碼來源:Ball_Bounce.cs

示例13: Update

        public int Update(GameWindow window, GameTime gameTime)
        {
            closestLength = 100000;
            closestEnemy = null;
            foreach (Enemy enemy in Enemies.ToArray())
            {
                if ((enemy.Center - player.Center).Length() < closestLength && enemy.Y < player.Y && !enemy.IsDying)
                {
                    closestLength = (enemy.Position - player.Position).Length();
                    closestEnemy = enemy;
                }
                foreach (Projectile bullet in player.Bullets)
                    if (enemy.IsColliding(bullet) && bullet.Y > 0 && enemy.IsAlive && bullet.IsAlive)
                    {
                        enemy.Health--;
                        bullet.Health--;
                    }

                if (enemy.IsAlive && enemy.IsColliding(player))
                {
                    player.Health--;
                    enemy.Health--;
                }
                enemy.Update(window);
            }
            return !player.IsAlive
                ? (int) Level.LevelState.GameOver
                : (player.Pause ? (int) Level.LevelState.Pause : (int) Level.LevelState.Active);
        }
開發者ID:EmilGedda,項目名稱:Storm-Pounder---First-Contact,代碼行數:29,代碼來源:Phase.cs

示例14: Background

        public Background(ContentManager Content, GameWindow window)
        {
            this.tex = new Texture2D[3];
            this.window = window;

            tex[0] = Content.Load<Texture2D>("Ground");
            tex[1] = Content.Load<Texture2D>("Cloud");
            tex[2] = Content.Load<Texture2D>("Cloud");

            foreground = new List<Vector2>();
            fgSpacing = tex[0].Width;
            fgSpeed = 0.75f;
            for (int i = 0; i < (window.ClientBounds.Width/fgSpacing)+2; i++)
            {
                foreground.Add(new Vector2(i * fgSpacing, window.ClientBounds.Height - tex[0].Height));
            }

            middleground = new List<Vector2>();
            mgSpacing = window.ClientBounds.Width / 5;
            mgSpeed = 0.5f;
            for (int i = 0; i < (window.ClientBounds.Width/mgSpacing); i++)
            {
                middleground.Add(new Vector2(i * mgSpacing, window.ClientBounds.Height - tex[0].Height - tex[1].Height));
            }

            background = new List<Vector2>();
            bgSpacing = window.ClientBounds.Width / 3;
            bgSpeed = 0.25f;
            for (int i = 0; i < (window.ClientBounds.Width/bgSpacing)+2; i++)
            {
                background.Add(new Vector2(i*bgSpacing,window.ClientBounds.Height - tex[0].Height -(int)(tex[1].Height*1.5)));
            }
        }
開發者ID:Nerminkrus,項目名稱:Spel,代碼行數:33,代碼來源:Background.cs

示例15: AddItem

        public void AddItem(Texture2D itemTexture, int state, GameWindow window)
        {
            Vector2 pos = items.Count > 0 ? items[items.Count - 1].Position : new Vector2(window.ClientBounds.Width / 2 - itemTexture.Width / 2, itemTexture.Height * 2 + Margin + Margin/2);
            pos.Y += itemTexture.Height + Margin;

            items.Add(new MenuItem(itemTexture, pos, state));
        }
開發者ID:EmilGedda,項目名稱:Storm-Pounder---First-Contact,代碼行數:7,代碼來源:Menu.cs


注:本文中的Microsoft.Xna.Framework.GameWindow類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。