Exemplo n.º 1
0
 public static void Main()
 {
     Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
     Game game = new Game();
     game.Run();
     game.Dispose();
 }
Exemplo n.º 2
0
        public static Airplane Create(World world, Game game, Renderer renderer, bool isPlayer = false, Airplane playerPlane = null)
        {
            if(random == null)
                random = new Random();

            State state;
            if (isPlayer)
                state = new State(510, 200);
            else
                state = new State(200 + random.Next(-1000,2000), random.Next(-1500,1500), 500 + random.Next(0, 1000), 200+ random.Next(0,100), random.Next(-15,15));
            Airplane plane = new Airplane(world, state, game, renderer, isPlayer, playerPlane, "F-14", "Plane " + i++);
            plane.PhysicalModel.Tanks.Add(new Tank(100, 500));
            plane.PhysicalModel.Tanks.Add(new Tank(100, 500));
            plane.PhysicalModel.Thrusters.Add(new Thruster());
            plane.CurrentState.Position = new Vector3D(plane.CurrentState.Position.X - 2500,
                plane.CurrentState.Position.Y, plane.CurrentState.Position.Z);
            return plane;
        }
Exemplo n.º 3
0
        public Input(Game game, IntPtr handle)
            : base(game, -10000)
        {
            _directInput = new DirectInput();
            _keyboard = new Keyboard(_directInput);
            _keyboard.Properties.BufferSize = 256;
            _keyboard.SetCooperativeLevel(handle, CooperativeLevel.Background | CooperativeLevel.NonExclusive);
            _mouse = new Mouse(_directInput);
            _mouse.Properties.AxisMode = DeviceAxisMode.Relative;
            _mouse.SetCooperativeLevel(handle, CooperativeLevel.Background | CooperativeLevel.NonExclusive);

            var devices  = _directInput.GetDevices(DeviceType.Gamepad, DeviceEnumerationFlags.AllDevices);
            if (devices.Count > 0)
            {
                _joystick = new Joystick(_directInput, devices[0].InstanceGuid);
                _joystick.SetCooperativeLevel(handle, CooperativeLevel.Background | CooperativeLevel.NonExclusive);
            }
        }
Exemplo n.º 4
0
 public AirplaneOverlay(Game game, Renderer renderer, Airplane airplane, Airplane playerAirplane)
     : base(game, renderer, airplane.UpdateOrder+1, false, true)
 {
     _airplane = airplane;
     _playerAirplane = playerAirplane;
     _shader = Renderer.FontShader;
     _overlay = new Bitmap(Renderer.DirectX.Device, Renderer.TextureManager.Create("Circle.png").TextureResource, Renderer.ScreenSize, new Vector2I(100, 100))
     {
         Position = new Vector2I(0,0),
         Size = new Vector2I(40, 40)
     };
     _color = new Vector4(0.2f, 0, 0, 0.4f);
     _distanceText = Renderer.TextManager.Create("Courrier", 14, 8, _color);
     _distanceText.Position = new Vector2I(0,0);
     _nameText = Renderer.TextManager.Create("Courrier", 14, 20, _color);
     _nameText.Position = new Vector2I(0,0);
     _nameText.Content = airplane.Name;
     _modelNameText = Renderer.TextManager.Create("Courrier", 14, 20, _color);
     _modelNameText.Position = new Vector2I(0, 0);
     _modelNameText.Content = airplane.ModelName;
 }
Exemplo n.º 5
0
 public World(Game game, Renderer renderer)
     : base(game, renderer, 0)
 {
     _terrain = new Terrain(renderer.DirectX.Device, "Heightmap.png", 100, Renderer);
 }
Exemplo n.º 6
0
 public FlightRecorder(Game game, params ICsvLoggable[] items)
     : base(game, 10000)
 {
     _logger = new CsvLogger(@"Logs\FlightRecording_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".csv", 1, ';');
     _logger.Register(items);
 }