public GamePlay(MapMaker mapMaker, GameWindow window) { this.MapMaker = mapMaker; this.LevelObjects = new List<GameObject>(); this.Window = window; LevelCreators.Peek()(); }
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); }
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); }
public GameWindowViewSizeService(Xna.GameWindow window) { this.window = window; this.window.ClientSizeChanged += this.OnClientSizeChanged; this.RefreshCache(); }
public Core(ContentManager content, GraphicsDevice graphicsDevice, GameWindow window) : base(window) { this.content = content; Initialiaze(); }
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); } } }
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); }
public XnaInputManager(Game game, Core.IO.IGameDescriptor gameDesc) { _game = game; _width = gameDesc.Width; _height = gameDesc.Height; _window = game.Window; _mousePosition = new Core.Graphics.Point(); TouchPanel.EnableMouseGestures = true; TouchPanel.EnabledGestures = GestureType.Hold | GestureType.Tap; TouchPanel.EnableMouseTouchPoint = true; #if WINDOWS_UWP var view = SystemNavigationManager.GetForCurrentView(); view.BackRequested += HardwareButtons_BackPressed; bool isHardwareButtonsApiPresent = Windows.Foundation.Metadata.ApiInformation.IsTypePresent (typeof(Windows.Phone.UI.Input.HardwareButtons).FullName); if (isHardwareButtonsApiPresent) { Windows.Phone.UI.Input.HardwareButtons.CameraPressed += HardwareButtons_CameraPressed; } _inputPane = InputPane.GetForCurrentView(); _currentWindow = CoreWindow.GetForCurrentThread(); _currentWindow.KeyDown += XnaInputManager_KeyDown; _currentWindow.KeyUp += XnaInputManager_KeyUp; #endif }
public cVideo(GameWindow gw) { vid = new Video(@"Resources/Video/helloworldintro.avi"); vid.Owner = Form.FromHandle(gw.Handle); vid.Ending += new EventHandler(vid_Ending); playstate = true; }
public PersonnageJouable(int vie, int mana, int force, Arme arme, Sexe sexe, GameWindow window) : base(vie, mana, force, arme) { #region Rectangles de collision 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 + 80, 10, 20); collisiondroite = new Rectangle(rectangle.X + rectangle.Width, rectangle.Y + 80, 10, 20); #endregion this.sexe = sexe; this.window = window; vieMax = 40; manaMax = 0; #region Initialisation des booleens de deplacement dplcmthaut = false; dplcmtbas = false; dplcmtgauche = false; dplcmtdroite = false; versbas = false; versdroite = false; versgauche = false; vershaut = false; #endregion #region Initialisation des textures(Vers le bas) haut = false; bas = true; gauche = false; droite = false; compteurtext = 0; #endregion }
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); }
public void Draw(SpriteBatch batch, GameWindow window) { batch.Draw(_evilOMeter, new Vector2(360, 20), Color.White); batch.Draw(_goodOMeter, new Vector2(360, 20), new Rectangle(0, 0, 93 + HOW_EVIL, _evilOMeter.Height), Color.White); if (_heldObject != null) { if (_heldObject.Disposed) { _heldObject = null; } else if(_heldObject.CapturedSprite != null) { batch.Draw(_heldObject.CapturedSprite.Texture, new Vector2((float)window.ClientBounds.Width - 165, (float)window.ClientBounds.Height - 190), Color.White); } else if (_heldObject.Sprite.Animation != null) { _heldObject.Sprite.Animation.Draw(batch, new Vector2((float)window.ClientBounds.Width / 2, (float)window.ClientBounds.Height - 50), 0f, false); } else { batch.Draw(_heldObject.Sprite.Texture, new Vector2((float)window.ClientBounds.Width / 2, (float)window.ClientBounds.Height - 50), Color.White); } } }
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); }
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))); } }
public FpsGameComponent(Game game, GraphicsDeviceManager manager) : base(game) { this.Window = game.Window; manager.SynchronizeWithVerticalRetrace = false; game.IsFixedTimeStep = true; }
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)); }
public EcranChargement(GameWindow window) { coord_ecran = new Rectangle(0, 0, window.ClientBounds.Width, window.ClientBounds.Height); transition = false; compteur = 0; opacite = 400; }
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; }
/// <summary> /// コンストラクタ /// </summary> /// <param name="window">GameWindowオブジェクト</param> /// <param name="graphics">GraphicsDevice</param> public ScreenManager(GameWindow window, GraphicsDevice graphics) { UpdateRenderTarget(window, graphics); this.window = window; this.graphics = graphics; window.ClientSizeChanged += new EventHandler<EventArgs>(ClientSizeChanged); }
public GameplayManager(GameWindow window) { world = new World(Vector2.Zero); ConvertUnits.SetDisplayUnitToSimUnitRatio(20.0f); //Not sure what a good number is here? vfx = new VisualEffectsManager(); this.window = window; grid = new Grid(world); armyController = new PlayerController(this, 0); SpawnUnit(new Vector2(150, 150), 0, UnitTypes.Ranged); SpawnUnit(new Vector2(250, 150), 1, UnitTypes.Ranged); SpawnUnit(new Vector2(252, 150), 1, UnitTypes.Melee); SpawnUnit(new Vector2(290, 150), 0, UnitTypes.Melee); SpawnUnit(new Vector2(150, 170), 0, UnitTypes.Melee); SpawnUnit(new Vector2(250, 170), 1, UnitTypes.Melee); SpawnUnit(new Vector2(252, 170), 1, UnitTypes.Ranged); SpawnUnit(new Vector2(290, 170), 0, UnitTypes.Ranged); SpawnUnit(new Vector2(150, 190), 0, UnitTypes.Ranged); SpawnUnit(new Vector2(250, 190), 1, UnitTypes.Ranged); SpawnUnit(new Vector2(252, 190), 1, UnitTypes.Ranged); SpawnUnit(new Vector2(290, 190), 0, UnitTypes.Ranged); SpawnBase(10,3, 0); SpawnBarracks(14, 6, 0); SpawnBarracks(18, 8, 1); }
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; }
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); }
public Joueur(GameWindow fenetre, Sexe sexe) { largeur_ecran = fenetre.ClientBounds.Width; hauteur_ecran = fenetre.ClientBounds.Height; centre_joueur = new Vector2(200, hauteur_ecran / 2 ); courseactive = false; haut = false; bas = true; gauche = false; droite = false; blocage_haut = false; blocage_bas = false; blocage_gauche = false; blocage_droit = false; fleche_bas = false; fleche_droite = false; fleche_gauche = false; fleche_haut = false; this.sexe = sexe; vieMax = 100; manaMax = 100; vie = 100; mana = 0; }
public Dialogue(string[] textes, string interlocuteur, GameWindow window) { this.interlocuteur = interlocuteur; this.textes = textes; largeur = window.ClientBounds.Width; hauteur = window.ClientBounds.Height; rect_bulle = new Rectangle(40, 11 * hauteur / 15, largeur - 80, 2 * hauteur / 15); }
public void Teleportation(PersonnageJouable joueur, MapManager map, GameWindow window) { if (Coordonnees.Intersects(joueur._rectangle)) { map.ChargementMap(Destination); map.Position(xdestination, ydestination, joueur, window); } }
public Camera(GameWindow fenetre, int x, int y) { this.x = x; this.y = y; largeur_ecran = fenetre.ClientBounds.Width; hauteur_ecran = fenetre.ClientBounds.Height; animationactive = false; }
public MouseService(CoroutineService coroutineService) { coroutineService.StartCoroutine(Update()); _lastState = Mouse.GetState(); _position = _lastState.Position; _window = ServiceLocator.Instance.GetService<GameWindow>(); _graphics = ServiceLocator.Instance.GetService<GraphicsDevice>(); }
/// <summary> /// Default constructor. Assumes the camera should be oriented up. /// </summary> /// <param name="pos"></param> /// <param name="lookAt"></param> public Camera(GameWindow window, Vector3 pos, Vector3 lookAt) { _position = pos; _lookatPosition = lookAt; UpdateProjection(window); Update(); }
public static void DrawGame(GameTime gameTime, SpriteBatch spriteBatch, GameWindow window) { human.Draw(spriteBatch, gameTime); computer.Draw(spriteBatch, gameTime); ball.Draw(spriteBatch,gameTime); foreach (PhysicalObject wall in Walls) wall.Draw(spriteBatch, gameTime); }
public Camera(GameWindow fenetre) { x = 0; y = 0; largeur_ecran = fenetre.ClientBounds.Width; hauteur_ecran = fenetre.ClientBounds.Height; animationactive = false; }
static Jypeli.JypeliWindow UglyHackToInstantiateJypeliWindow(XNA_Window gwin, XNA_GDM gdm) { ConstructorInfo jpwCtr = typeof(Jypeli.JypeliWindow).GetConstructor( BindingFlags.NonPublic | BindingFlags.Instance, null, new Type[] { typeof(XNA_Window), typeof(XNA_GDM) }, null); Jypeli.JypeliWindow jpw = (Jypeli.JypeliWindow)(jpwCtr.Invoke(new object[] { gwin, gdm })); return(jpw); }
protected override void Initialize() { // TODO: Add your initialization logic here FontManager = new FontManager(); // Manages text draws InputManager = new InputManager(); // Manages player's input (mouse and keyboard) GameWindow = Window; TextureManager = new TextureManager(GraphicsDevice); // Mananges textures such that no duplicates are made SongManager = new SongManager(); // Manages background music WindowManager = new WindowManager(); // Manages displayed windows NetworkClient.Setup(); base.Initialize(); }
private static void TryToSwitchAntialiasingOn() { // The GDM creates the graphicsdevices for windows to draw. Gain access to it. XNA_GDM gdm = UglyHackToGetGraphicsDeviceManagerWithReflection(); gdm.PreferMultiSampling = true; gdm.ApplyChanges(); // Ok, now lets switch the Jypeli.Game.Window before anyone noitices! XNA_Window gwin = UglyHackToGetXNAGAmeWindowWithReflection(VRPGame.Window); Jypeli.JypeliWindow antialiasedWindow = UglyHackToInstantiateJypeliWindow(gwin, gdm); UglyHackToSwitchJypeliWindowWithReflection(antialiasedWindow); // TODO: If everything else works do this e.g. with more reflection // http://stackoverflow.com/questions/660480/determine-list-of-event-handlers-bound-to-event //Window.Resizing += new JypeliWindow.ResizeEvent( WindowResized ); //Window.Resized += new JypeliWindow.ResizeEvent( WindowResized ); }
public KeyboardDispatcher(Microsoft.Xna.Framework.GameWindow window) { InputEventSystem.EventInput.Initialize(window); InputEventSystem.EventInput.CharEntered += new InputEventSystem.CharEnteredHandler(EventInput_CharEntered); InputEventSystem.EventInput.KeyDown += new InputEventSystem.KeyEventHandler(EventInput_KeyDown); }
public Game() { // Initialize collections _services = new GameServiceContainer(); _gameComponentCollection = new GameComponentCollection(); _gameComponentCollection.ComponentAdded += Handle_gameComponentCollectionComponentAdded; // The default for Windows is 480 x 800 //RectangleF frame = NSScreen.MainScreen.Frame; RectangleF frame = new RectangleF(0, 0, Microsoft.Xna.Framework.Graphics.PresentationParameters._defaultBackBufferWidth, Microsoft.Xna.Framework.Graphics.PresentationParameters._defaultBackBufferHeight); //Create a window _mainWindow = new MacGameNSWindow(frame, NSWindowStyle.Titled | NSWindowStyle.Closable, NSBackingStore.Buffered, true); // Perform any other window configuration you desire _mainWindow.IsOpaque = true; _mainWindow.EnableCursorRects(); _gameWindow = new GameWindow(frame); _gameWindow.game = this; _mainWindow.ContentView.AddSubview(_gameWindow); _mainWindow.AcceptsMouseMovedEvents = false; _mainWindow.Center(); // Initialize GameTime _updateGameTime = new GameTime(); _drawGameTime = new GameTime(); //Set the current directory. // We set the current directory to the ResourcePath on Mac Directory.SetCurrentDirectory(NSBundle.MainBundle.ResourcePath); //Tao.Sdl.Sdl.SDL_Init(Tao.Sdl.Sdl.SDL_INIT_JOYSTICK); // Leave these here for when we implement the Activate and Deactivated _mainWindow.DidBecomeKey += delegate(object sender, EventArgs e) { //if (!IsMouseVisible) // _gameWindow.HideCursor(); //Console.WriteLine("BecomeKey"); IsActive = true; }; _mainWindow.DidResignKey += delegate(object sender, EventArgs e) { //if (!IsMouseVisible) // _gameWindow.UnHideCursor(); //Console.WriteLine("ResignKey"); IsActive = false; }; _mainWindow.DidBecomeMain += delegate(object sender, EventArgs e) { //if (!IsMouseVisible) //_gameWindow.HideCursor(); ////Console.WriteLine("BecomeMain"); }; _mainWindow.DidResignMain += delegate(object sender, EventArgs e) { //if (!IsMouseVisible) // _gameWindow.UnHideCursor(); //Console.WriteLine("ResignMain"); }; }
// // DisposeWindow // private static void DisposeWindowImpl(GameWindow window) { }
public Game() { Content = new ContentManager(); Window = new GameWindow(); }
/// <summary> ///Initialize / Apply The Window /// </summary> /// <param name="window">XNA GameWindow Reference</param> public static void ApplyGameWindow(Microsoft.Xna.Framework.GameWindow window) { win = window; }
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 }