Esempio n. 1
0
        public Controller(OgreForm ogreForm, int windowHnd)
        {
            this.mOgreForm = ogreForm;
            InputManager inputMgr;

            this.mKeyDown     = new bool[256];
            this.mKeyPressed  = new bool[256];
            this.mKeyReleased = new bool[256];

            ParamList pl = new ParamList();

            pl.Insert("WINDOW", windowHnd.ToString());
            inputMgr = InputManager.CreateInputSystem(pl);
            if (inputMgr == null)
            {
                return;
            }

            // initialize keyboard
            this.mKeyBoard = (Keyboard)inputMgr.CreateInputObject(MOIS.Type.OISKeyboard, true);
            if (this.mKeyBoard == null)
            {
                return;
            }
            this.mKeyBoard.KeyPressed  += OnKeyPressed;
            this.mKeyBoard.KeyReleased += OnKeyReleased;

            this.mMouseDown     = new Dictionary <MouseButtons, bool>();
            this.mMousePressed  = new Dictionary <MouseButtons, bool>();
            this.mMouseReleased = new Dictionary <MouseButtons, bool>();
            foreach (MouseButtons button in Enum.GetValues(typeof(MouseButtons)))
            {
                this.mMouseDown.Add(button, false);
                this.mMousePressed.Add(button, false);
                this.mMouseReleased.Add(button, false);
            }

            this.mMousePos         = new Mogre.Vector3();
            this.BlockMouse        = false;
            this.mCursorVisibility = true;

            this.mCommands = new XmlDocument();
            this.LoadCommands();

            this.mUserActions        = new bool[Enum.GetValues(typeof(UserAction)).Length];
            this.mUserActionsOccured = new bool[this.mUserActions.Length];
            this.mUserActionsEnded   = new bool[this.mUserActions.Length];
            this.MovementFactor      = new Mogre.Vector3();

            this.mOgreForm.MouseMove  += OnMouseMoved;
            this.mOgreForm.MouseWheel += OnMouseWheel;
            this.mOgreForm.MouseDown  += OnMousePressed;
            this.mOgreForm.MouseUp    += OnMouseReleased;
            this.mOgreForm.MouseLeave += OnMouseLeave;
        }
Esempio n. 2
0
 /// <summary>
 /// Call Ogre constructer / init. Tell Ogre what WinForms panel to render to.
 /// </summary>
 /// <param name="startingMesh"></param>
 void InitializeOgre()
 {
     _ogre = new OgreForm(_fileSystemPaths);
     System.Windows.Forms.Panel pan = OgreWinFormsHost.Child as System.Windows.Forms.Panel;
     _ogre.Init(pan.Handle.ToString());
 }