Пример #1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //NeoAxis initialization
            if (!WPFAppWorld.Init(new ExampleEngineApp(EngineApp.ApplicationTypes.Simulation), this,
                                  "user:Logs/WPFAppExample.log", true, null, null, null, null))
            {
                Close();
                return;
            }

            UpdateVolume();

            renderTargetUserControl1.AutomaticUpdateFPS = 60;
            renderTargetUserControl1.KeyDown           += renderTargetUserControl1_KeyDown;
            renderTargetUserControl1.KeyUp     += renderTargetUserControl1_KeyUp;
            renderTargetUserControl1.MouseDown += renderTargetUserControl1_MouseDown;
            renderTargetUserControl1.MouseUp   += renderTargetUserControl1_MouseUp;
            renderTargetUserControl1.MouseMove += renderTargetUserControl1_MouseMove;
            renderTargetUserControl1.Tick      += renderTargetUserControl1_Tick;
            renderTargetUserControl1.Render    += renderTargetUserControl1_Render;
            renderTargetUserControl1.RenderUI  += renderTargetUserControl1_RenderUI;

            const string startMapName = "Maps\\MainMenu\\Map.map";

            //generate map list
            {
                string[] mapList = VirtualDirectory.GetFiles("", "*.map", SearchOption.AllDirectories);
                foreach (string mapName in mapList)
                {
                    comboBoxMaps.Items.Add(mapName);
                    if (mapName == startMapName)
                    {
                        comboBoxMaps.SelectedIndex = comboBoxMaps.Items.Count - 1;
                    }
                }
            }

            //load map
            WPFAppWorld.MapLoad(startMapName, true);

            //set camera position
            if (Map.Instance != null)
            {
                MapCamera mapCamera = FindFirstMapCamera();
                if (mapCamera != null)
                {
                    freeCameraPosition  = mapCamera.Position;
                    freeCameraDirection = SphereDir.FromVector(mapCamera.Rotation.GetForward());
                }
                else
                {
                    freeCameraPosition  = Map.Instance.EditorCameraPosition;
                    freeCameraDirection = Map.Instance.EditorCameraDirection;
                }
            }
        }
Пример #2
0
        private void buttonLoadMap_Click(object sender, RoutedEventArgs e)
        {
            if (comboBoxMaps.SelectedIndex == -1)
            {
                return;
            }
            string mapName = (string)comboBoxMaps.SelectedItem;

            WPFAppWorld.MapLoad(mapName, true);
        }
Пример #3
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //NeoAxis initialization
            if (!WPFAppWorld.Init(this, "user:Logs/WPFAppExample.log"))
            {
                Close();
                return;
            }

            UpdateVolume();

            //load map
            WPFAppWorld.MapLoad("Maps\\WindowsAppExample\\Map.map", true);

            renderTargetUserControl1.AutomaticUpdateFPS = 60;
            renderTargetUserControl1.Render            += renderTargetUserControl1_Render;
            renderTargetUserControl1.RenderUI          += renderTargetUserControl1_RenderUI;
        }
Пример #4
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //NeoAxis initialization
            if (!WPFAppWorld.Init(new WPFAppEngineApp(EngineApp.ApplicationTypes.Simulation), this,
                                  "user:Logs/WPFSimpleExample.log", true, null, null, null, null))
            {
                Close();
                return;
            }

            renderTargetUserControl1.AutomaticUpdateFPS = 60;
            renderTargetUserControl1.KeyDown           += renderTargetUserControl1_KeyDown;
            renderTargetUserControl1.KeyUp     += renderTargetUserControl1_KeyUp;
            renderTargetUserControl1.MouseDown += renderTargetUserControl1_MouseDown;
            renderTargetUserControl1.MouseUp   += renderTargetUserControl1_MouseUp;
            renderTargetUserControl1.MouseMove += renderTargetUserControl1_MouseMove;
            renderTargetUserControl1.Tick      += renderTargetUserControl1_Tick;
            renderTargetUserControl1.Render    += renderTargetUserControl1_Render;
            renderTargetUserControl1.RenderUI  += renderTargetUserControl1_RenderUI;

            const string startMapName = "Maps\\MainMenu\\Map.map";

            //generate map list
            {
                string[] mapList = VirtualDirectory.GetFiles("", "*.map", SearchOption.AllDirectories);
                foreach (string mapName in mapList)
                {
                    comboBoxMaps.Items.Add(mapName);
                    if (mapName == startMapName)
                    {
                        comboBoxMaps.SelectedIndex = comboBoxMaps.Items.Count - 1;
                    }
                }
            }

            //load map
            WPFAppWorld.MapLoad(startMapName, true);
        }
Пример #5
0
        private void buttonLoadMap_Click(object sender, RoutedEventArgs e)
        {
            if (comboBoxMaps.SelectedIndex == -1)
            {
                return;
            }

            string mapName = (string)comboBoxMaps.SelectedItem;

            if (GameNetworkClient.Instance != null)
            {
                //network mode.
                //send request message "Example_MapLoad" to the server.
                GameNetworkClient.Instance.CustomMessagesService.SendToServer("Example_MapLoad", mapName);
            }
            else
            {
                //load map in single mode.
                WPFAppWorld.MapLoad(mapName, true);

                //set camera position
                if (Map.Instance != null)
                {
                    MapCamera mapCamera = FindFirstMapCamera();
                    if (mapCamera != null)
                    {
                        freeCameraPosition  = mapCamera.Position;
                        freeCameraDirection = SphereDir.FromVector(mapCamera.Rotation.GetForward());
                    }
                    else
                    {
                        freeCameraPosition  = Map.Instance.EditorCameraPosition;
                        freeCameraDirection = Map.Instance.EditorCameraDirection;
                    }
                }
            }
        }
Пример #6
0
 public static bool Init(Window mainWindow, WorldViewModel worldViewModel)
 {
     WorldViewModel = worldViewModel;
     return(WPFAppWorld.Init(mainWindow, "user:Logs/Strive.log") &&
            WPFAppWorld.MapLoad("Maps/Gr1d/Map.map", true));
 }
Пример #7
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //D3DImage support
            //D3DImage feature is a new level of interoperability between WPF and DirectX by allowing a custom Direct3D (D3D)
            //surface to be blended with WPF's native D3D surface.
            {
                string[] args = Environment.GetCommandLineArgs();
                for (int n = 1; n < args.Length; n++)
                {
                    string arg = args[n];

                    if (arg.ToLower() == "/d3dimage")
                    {
                        RendererWorld.InitializationOptions.AllowDirectX9Ex = true;
                    }
                }
            }

            //NeoAxis initialization
            if (!WPFAppWorld.Init(new ExampleEngineApp(EngineApp.ApplicationTypes.Simulation), this,
                                  "user:Logs/WPFAppExample.log", true, null, null, null, null))
            {
                Close();
                return;
            }

            UpdateVolume();

            renderTargetUserControl1.AutomaticUpdateFPS = 60;
            renderTargetUserControl1.KeyDown           += renderTargetUserControl1_KeyDown;
            renderTargetUserControl1.KeyUp     += renderTargetUserControl1_KeyUp;
            renderTargetUserControl1.MouseDown += renderTargetUserControl1_MouseDown;
            renderTargetUserControl1.MouseUp   += renderTargetUserControl1_MouseUp;
            renderTargetUserControl1.MouseMove += renderTargetUserControl1_MouseMove;
            renderTargetUserControl1.Tick      += renderTargetUserControl1_Tick;
            renderTargetUserControl1.Render    += renderTargetUserControl1_Render;
            renderTargetUserControl1.RenderUI  += renderTargetUserControl1_RenderUI;

            const string startMapName = "Maps\\MainMenu\\Map.map";

            //generate map list
            {
                string[] mapList = VirtualDirectory.GetFiles("", "*.map", SearchOption.AllDirectories);
                foreach (string mapName in mapList)
                {
                    comboBoxMaps.Items.Add(mapName);
                    if (mapName == startMapName)
                    {
                        comboBoxMaps.SelectedIndex = comboBoxMaps.Items.Count - 1;
                    }
                }
            }

            //load map
            WPFAppWorld.MapLoad(startMapName, true);

            //set camera position
            if (Map.Instance != null)
            {
                MapCamera mapCamera = FindFirstMapCamera();
                if (mapCamera != null)
                {
                    freeCameraPosition  = mapCamera.Position;
                    freeCameraDirection = SphereDir.FromVector(mapCamera.Rotation.GetForward());
                }
                else
                {
                    freeCameraPosition  = Map.Instance.EditorCameraPosition;
                    freeCameraDirection = Map.Instance.EditorCameraDirection;
                }
            }

            if (!RendererWorld.InitializationOptions.AllowDirectX9Ex)
            {
                //checkBoxUseD3DImage.IsEnabled = false;
                checkBoxUseD3DImage.IsChecked = false;
            }

            initialized = true;
        }