本文整理汇总了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
}
示例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);
}
示例3: GamePlay
public GamePlay(MapMaker mapMaker, GameWindow window)
{
this.MapMaker = mapMaker;
this.LevelObjects = new List<GameObject>();
this.Window = window;
LevelCreators.Peek()();
}
示例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);
}
}
}
示例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);
}
示例6: Core
public Core(ContentManager content, GraphicsDevice graphicsDevice, GameWindow window)
: base(window)
{
this.content = content;
Initialiaze();
}
示例7: EcranChargement
public EcranChargement(GameWindow window)
{
coord_ecran = new Rectangle(0, 0, window.ClientBounds.Width, window.ClientBounds.Height);
transition = false;
compteur = 0;
opacite = 400;
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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)));
}
}
示例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));
}