当前位置: 首页>>代码示例>>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;未经允许,请勿转载。