static void Main(string[] args) { Clock clock = new Clock(); Time elapsed; Time timerPerFrame = Time.FromSeconds(1.0f / 60.0f); Time timeSinceLastUpdate = Time.Zero; HostileSpace game = new HostileSpace(); while (game.Window.IsOpen) { elapsed = clock.Restart(); timeSinceLastUpdate += elapsed; while (timeSinceLastUpdate > timerPerFrame) { timeSinceLastUpdate -= timerPerFrame; game.Window.DispatchEvents(); game.Update(timerPerFrame); } game.Window.Clear(Color.Black); game.Draw(); game.Window.Display(); } }
public SpaceShip(HostileSpace Game) : base(Game) { Ship = new RectangleShape(new Vector2f(291, 173)); Ship.Texture = Game.ContentManager.GetTexture("Ship01"); Ship.Origin = new Vector2f(Ship.Texture.Size.X / 2, Ship.Texture.Size.Y / 2); Ship.Scale = Ship.Scale / 4; Ship.Position = new Vector2f(Game.Window.Size.X / 2, Game.Window.Size.Y / 2); }
public AudioPlayer(HostileSpace Game) : base(Game) { SoundObject tmp; tmp = new SoundObject(); tmp.SoundBuffer = new SoundBuffer("files/audio/gui/buttonclick.wav"); tmp.Sound = new Sound(tmp.SoundBuffer); sounds.Add("GUI_CLICK", tmp); }
public MusicPlayer(HostileSpace Game) : base(Game) { paths.Add("DST-RailJet-LongSeamlessLoop"); music = new Music(directory + paths[index] + ".ogg"); music.Volume = 30; music.Loop = true; //music.Play(); //index = (index + 1) % paths.Count; }
public PlayerShip(HostileSpace Game) : base(Game) { Ship = new RectangleShape(new Vector2f(291, 173)); Ship.Texture = Game.ContentManager.GetTexture("Ship01"); Ship.Origin = new Vector2f(Ship.Texture.Size.X / 2, Ship.Texture.Size.Y / 2); Ship.Scale = Ship.Scale / 3; Ship.Position = new Vector2f(Game.Window.Size.X / 2, Game.Window.Size.Y / 2); destination = new RectangleShape(new Vector2f(64, 64)); destination.Texture = Game.ContentManager.GetTexture("DestinationMarker"); destination.Scale = new Vector2f(0.5f, 0.5f); destination.Origin = new Vector2f(32, 32); SetupShortRangeIndicator(); SetupLongRangeIndicator(); Game.Input.Mouse.RightClicked += Mouse_RightClicked; }
public Player(HostileSpace Game) : base(Game) { }
public Input(HostileSpace Game) : base(Game) { keyboard = new GameKeyboard(Game); mouse = new GameMouse(Game); }
public GameComponent(HostileSpace Game) { game = Game; }
public GameMouse(HostileSpace Game) : base(Game) { pointer = new RectangleShape(new Vector2f(20, 20)); pointer.Texture = Game.ContentManager.GetTexture("Mouse"); }
public GameKeyboard(HostileSpace Game) : base(Game) { Game.Window.TextEntered += RenderWindow_TextEntered; }
public AI(HostileSpace Game, SpaceShip Ship) : base(Game) { ship = Ship; }