Exemplo n.º 1
0
        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();
            }
        }
Exemplo n.º 2
0
 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);
 }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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;
        }
Exemplo n.º 5
0
        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;
        }
Exemplo n.º 6
0
 public Player(HostileSpace Game)
     : base(Game)
 {
 }
Exemplo n.º 7
0
 public Input(HostileSpace Game)
     : base(Game)
 {
     keyboard = new GameKeyboard(Game);
     mouse    = new GameMouse(Game);
 }
Exemplo n.º 8
0
 public GameComponent(HostileSpace Game)
 {
     game = Game;
 }
Exemplo n.º 9
0
 public GameMouse(HostileSpace Game)
     : base(Game)
 {
     pointer         = new RectangleShape(new Vector2f(20, 20));
     pointer.Texture = Game.ContentManager.GetTexture("Mouse");
 }
Exemplo n.º 10
0
 public GameKeyboard(HostileSpace Game)
     : base(Game)
 {
     Game.Window.TextEntered += RenderWindow_TextEntered;
 }
Exemplo n.º 11
0
 public AI(HostileSpace Game, SpaceShip Ship)
     : base(Game)
 {
     ship = Ship;
 }