Beispiel #1
0
        private void OnFileOpenClicked(object sender, EventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.DefaultExt = ".x";
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                scenery.LoadDefinition(dialog.FileName);
            }
        }
Beispiel #2
0
        /// <summary>
        /// This event will be fired immediately after the Direct3D device has been
        /// created, which will happen during application initialization and windowed/full screen
        /// toggles. This is the best location to create Pool.Managed resources since these
        /// resources need to be reloaded whenever the device is destroyed. Resources created
        /// here should be released in the Disposing event.
        /// </summary>
        private void OnCreateDevice(object sender, DeviceEventArgs e)
        {
            transparentObjectManager = new TransparentObjectManager();

            // Initialize the stats font
            //statsFont = ResourceCache.GetGlobalInstance().CreateFont(e.Device, 15, 0, FontWeight.Bold, 1, false, CharacterSet.Default,
            //    Precision.Default, FontQuality.Default, PitchAndFamily.FamilyDoNotCare | PitchAndFamily.DefaultPitch
            //    , "Arial");
            // Create the camera
            camera             = new FirstPersonCamera("FPCamera");
            camera.AspectRatio = (float)(e.BackBufferDescription.Width) / e.BackBufferDescription.Height;
            camera.MoveScaler  = 50.0f;

            weather = new Weather(this);

            // Create the ground
            scenery = new Scenery(this);
            scenery.LoadDefinition("data/scenery/default/default.par");
            //scenery.LoadDefinition(@"C:\Users\Gebruiker\Documents\RC Desk Pilot\Scenery\Aero Club Bad Oldesloe\Aero Club Bad Oldesloe.par");
            scenery.SetWaterCallback(this.OnFrameRenderWater);

            // Create birds
            birds        = new Birds(100);
            birds.Random = true;

            // Create the 3Dcursor
            cursor3d = new Cursor3D();

            selectedObject = new SelectedObject();
            RCSim.TerrainDefinition.ObjectTypeEnum objectType;
            selectedObject.SetSelectedObject(scenery.Definition.GetNearestObject(cursor3d.Position, out objectType));

            sun       = new DirectionalLight(new Vector3(0.5f, -0.707f, 0.5f));
            sun.Color = System.Drawing.Color.FromArgb(148, 148, 148);

            framework.CurrentCamera = camera;
        }