Beispiel #1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            //NeoAxis initialization
            if (!WinFormsAppWorld.Init(new ExampleEngineApp(EngineApp.ApplicationTypes.Simulation), this,
                                       "user:Logs/WinFormsAppExample.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
            WinFormsAppWorld.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;
                }
            }
        }
Beispiel #2
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            //NeoAxis initialization
            if (!WinFormsAppWorld.Init(this, "user:Logs/WinFormsAppExample.log"))
            {
                Close();
                return;
            }

            UpdateVolume();

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

            renderTargetUserControl1.AutomaticUpdateFPS = 60;
            renderTargetUserControl1.Render            += renderTargetUserControl1_Render;
            renderTargetUserControl1.RenderUI          += renderTargetUserControl1_RenderUI;
        }
Beispiel #3
0
        private void buttonLoadMap_Click(object sender, EventArgs 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.

                WinFormsAppWorld.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;
                    }
                }
            }
        }
Beispiel #4
0
        bool MapLoad(string virtualFileName)
        {
            if (!WinFormsAppWorld.MapLoad(virtualFileName, true))
            {
                return(false);
            }

            //set camera position
            MapCamera mapCamera = FindFirstMapCamera();

            if (mapCamera != null)
            {
                freeCameraPosition  = mapCamera.Position;
                freeCameraDirection = SphereDir.FromVector(mapCamera.Rotation.GetForward());
            }
            else
            {
                freeCameraPosition  = Map.Instance.EditorCameraPosition;
                freeCameraDirection = Map.Instance.EditorCameraDirection;
            }

            return(true);
        }