Exemplo n.º 1
0
        public unsafe EngineDisplayForm()
        {
            InitializeComponent();
            try
            {
                // This is how we get the instance handle for our C# app.
                System.IntPtr hInstance = System.Runtime.InteropServices.Marshal.GetHINSTANCE(this.GetType().Module);

                // This is how we get the window handle for the panel we'll be rendering into.
                IntPtr hwnd = this.DisplayPanel.Handle;

                // Call into our Dll main function, which will set up an instance of the EditorApp project.
                // Remember that we can't pass the pointer itself, so we'll pass the pointer value.
                // The int will be converted into a pointer value later.
                NativeMethods.EditorMain(hInstance, IntPtr.Zero, hwnd, 1, this.DisplayPanel.Width, this.DisplayPanel.Height);

                m_messageFilter = new MessageHandler(this.Handle, this.DisplayPanel.Handle, this);

                m_actorPropertiesForm = new ActorPropertiesForm(this);
                m_actorPropertiesForm.Show();
            }
            catch (Exception)
            {
                // If something goes wrong with the initialization, free the library
                // TODO QT: Why is this commented out???? Maybe Quoc knows...
                // NativeMethods.FreeLibrary(m_pDll);
            }
        }
Exemplo n.º 2
0
        public EditorForm()
        {

            var currentDirectory = Directory.GetCurrentDirectory();
            var parentDirectory = Directory.GetParent(currentDirectory);
            m_ProjectDirectory = parentDirectory.FullName;
            m_AssetsDirectory = m_ProjectDirectory + "\\Assets";

            InitializeComponent();
            try
            {
                // This is how we get the instance handle for our C# app.
                System.IntPtr hInstance = Marshal.GetHINSTANCE(this.GetType().Module);
                
                // This is how we get the window handle for the panel we'll be rendering into.
                IntPtr hwnd = this.DisplayPanel.Handle;

                // Call into our Dll main function, which will set up an instance of the EditorApp project.
                NativeMethods.EditorMain(hInstance, IntPtr.Zero, hwnd, 1, this.DisplayPanel.Width, this.DisplayPanel.Height);

                InitializeAssetTree();

                m_messageFilter = new MessageHandler(this.DisplayPanel, this);
                m_ActorComponentEditor = new ActorComponentEditor(Panel_ActorComponents, m_ProjectDirectory);
            }
            catch (Exception e)
            {
                MessageBox.Show("Error: " + e.ToString());
            }
        }