Defines the event arguments for KeyPress events. Instances of this class are cached: KeyPressEventArgs should only be used inside the relevant event, unless manually cloned.
Inheritance: System.EventArgs
Ejemplo n.º 1
0
 public void OnKeyPress(OpenTK.KeyPressEventArgs e)
 {
     if (typingfield != -1)
     {
         var widget = currentForm.Widgets[typingfield];
         if (e.KeyChar == 8 && widget.Text.Length > 0)//backspace
         {
             widget.Text = widget.Text.Substring(0, widget.Text.Length - 1);
         }
         else
         {
             if (e.KeyChar == 8)
             {
                 return;
             }
             if (widget.IsNumeric && !char.IsDigit(e.KeyChar))
             {
                 return;
             }
             if (e.KeyChar == 22)
             {
                 if (Clipboard.ContainsText())
                 {
                     widget.Text += Clipboard.GetText();
                 }
                 return;
             }
             widget.Text += e.KeyChar;
         }
         if (widget.OnText != null)
         {
             widget.OnText();
         }
     }
 }
Ejemplo n.º 2
0
        void gw_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!CaptureText)
                return;

            CapturedText += e.KeyChar;
        }
Ejemplo n.º 3
0
 protected override void OnKeyPress(OpenTK.KeyPressEventArgs e)
 {
     if (this.Keyboard[OpenTK.Input.Key.Escape])
     {
         this.Exit();
     }
 }
 protected override void OnKeyPress(OpenTK.KeyPressEventArgs e)
 {
     if (e.KeyChar == 'q')
     {
         Exit();
     }
 }
Ejemplo n.º 5
0
        //-----------------------------------------------------------------------------------------
        protected override void OnKeyPress(OpenTK.KeyPressEventArgs e)
        {
            switch (e.KeyChar)
            {
            case 'P':
            case 'p':
                _pausedFlag = !_pausedFlag;
                break;

            case 'V':
            case 'v':
                _vsyncFlag = !_vsyncFlag;
                this.VSync = _vsyncFlag ? VSyncMode.On : VSyncMode.Off;
                break;

            case 'D':
            case 'd':
                switch (_drawMode)
                {
                case Mode.Multidraw:     _drawMode = Mode.SeparateDraws; break;

                case Mode.SeparateDraws: _drawMode = Mode.Multidraw; break;
                }
                break;
            }
        }
Ejemplo n.º 6
0
        protected override void OnKeyPress(KeyPressEventArgs e)
        {
            if (e.KeyChar == ' ')
                DisplayNormals = !DisplayNormals;

            base.OnKeyPress(e);
        }
Ejemplo n.º 7
0
        private void OnInternalKeyPress(object sender, OpenTK.KeyPressEventArgs e)
        {
            var args = new KeyboardPressEventArgs(e.KeyChar);

            OnKeyPress(this, args);
            KeyPress?.Invoke(this, args);
        }
Ejemplo n.º 8
0
 static public void InvokeOnKeyPress(OpenTK.KeyPressEventArgs e)
 {
     if (OnKeyPress != null)
     {
         OnKeyPress.Invoke(null, e);
     }
 }
Ejemplo n.º 9
0
 protected override void OnKeyPress(OpenTK.KeyPressEventArgs e)
 {
     if (e.KeyChar == 'a')
     {
         MyApplication.moveX += 0.5f;
     }
     else if (e.KeyChar == 'd')
     {
         MyApplication.moveX -= 0.5f;
     }
     else if (e.KeyChar == 'w')
     {
         MyApplication.moveY += 0.5f;
     }
     else if (e.KeyChar == 's')
     {
         MyApplication.moveY -= 0.5f;
     }
     else if (e.KeyChar == 'q')
     {
         MyApplication.rotate += 0.04f;
     }
     else if (e.KeyChar == 'e')
     {
         MyApplication.rotate -= 0.04f;
     }
     else if (e.KeyChar == 'r')
     {
         MyApplication.moveZ += 0.3f;
     }
     else if (e.KeyChar == 'f')
     {
         MyApplication.moveZ -= 0.3f;
     }
 }
Ejemplo n.º 10
0
        protected override void OnKeyPress(KeyPressEventArgs e)
        {
            base.OnKeyPress(e);

            if (e.KeyChar == 27)
            {
                Exit();
            }

            switch (e.KeyChar)
            {
                case 'w':
                    cam.Move(0f, 0.1f, 0f);
                    break;
                case 'a':
                    cam.Move(-0.1f, 0f, 0f);
                    break;
                case 's':
                    cam.Move(0f, -0.1f, 0f);
                    break;
                case 'd':
                    cam.Move(0.1f, 0f, 0f);
                    break;
                case 'q':
                    cam.Move(0f, 0f, 0.1f);
                    break;
                case 'e':
                    cam.Move(0f, 0f, -0.1f);
                    break;
            }
        }
Ejemplo n.º 11
0
        private void KeyPressHandler(object sender, KeyPressEventArgs e)
        {
            if (TypedText.Length > 32)
                TypedText.Remove(0, 1);

            TypedText.Append(e.KeyChar);
        }
Ejemplo n.º 12
0
 private void WindowOnKeyboardEvent(object sender, KeyPressEventArgs e)
 {
     if (_kuat.WindowOnKeyboardEvent(sender, e))
     {
         return;
     }
 }
Ejemplo n.º 13
0
        protected override void OnKeyPress(KeyPressEventArgs e)
        {
            base.OnKeyPress(e);

            switch (e.KeyChar)
            {
            // Move main camera
            case 'w':
                mainCamera.Move(0f, 0.1f, 0f);
                break;

            case 'a':
                mainCamera.Move(-0.1f, 0f, 0f);
                break;

            case 's':
                mainCamera.Move(0f, -0.1f, 0f);
                break;

            case 'd':
                mainCamera.Move(0.1f, 0f, 0f);
                break;

            case 'q':
                mainCamera.Move(0f, 0f, 0.1f);
                break;

            case 'e':
                mainCamera.Move(0f, 0f, -0.1f);
                break;

            // Move screen camera
            case 'u':
                screenCamera.Move(0f, 0f, 0.1f);
                break;

            case 'j':
                screenCamera.Move(0f, 0f, -0.1f);
                break;

            case 'h':
                screenCamera.Move(-0.1f, 0f, 0f);
                break;

            case 'k':
                screenCamera.Move(0.1f, 0f, 0f);
                break;

            // Change shader of screen
            case 'v':
                tvScreen.Shader = (tvScreen.Shader == "screen") ? "lit_advanced" : "screen";
                break;

            // Switch between camera view and depth
            case 'c':
                tvScreen.TextureID = (tvScreen.TextureID == textures["screendepth"]) ? textures["screen"] : (int)textures["screendepth"];
                break;
            }
        }
Ejemplo n.º 14
0
 private void OnKeyPress(object sender, KeyPressEventArgs e)
 {
     if (TextBoxHandler.TextBox == null)
     {
         return;
     }
     TextBoxHandler.TextBox.OnCharacter(e.KeyChar);
 }
Ejemplo n.º 15
0
 protected override void OnKeyPress(OpenTK.KeyPressEventArgs e)
 {
     if (_Present.Game != null && _Present.Game.CurrentState is IDirectKeyboardInputState)
     {
         var Casted = (IDirectKeyboardInputState)_Present.Game.CurrentState;
         Casted.KeyPressed(this, (Keys)e.KeyChar);
     }
 }
Ejemplo n.º 16
0
        protected override void OnKeyPress(OpenTK.KeyPressEventArgs e)
        {
            base.OnKeyPress(e);

            if (Keyboard[OpenTK.Input.Key.V])
            {
                cameraMode = !cameraMode;
            }
        }
Ejemplo n.º 17
0
        protected override void OnKeyPress(KeyPressEventArgs e)
        {
            base.OnKeyPress(e);
            if (e.KeyChar == 'w' || e.KeyChar == 'W')
            {
                wireframe = !wireframe;

                GL.PolygonMode(MaterialFace.FrontAndBack, wireframe ? PolygonMode.Line : PolygonMode.Fill);
            }
        }
Ejemplo n.º 18
0
    protected override void OnKeyPress(OpenTK.KeyPressEventArgs e)
    {
        switch (e.KeyChar)
        {
        case 'y':
            if (clickFlag == 2)
            {
                game.Manager.MoveArmy(selectedArmy, selectedPos);
                Console.WriteLine("Army has moved.");
                clickFlag    = 0;
                selectedArmy = null;
            }

            break;

        case 'u':
            if (clickFlag == 2)
            {
                Console.WriteLine("Army has been moved back to its previous position");
                clickFlag = 0;
            }

            break;

        case '+':
            scale *= 1.1f;
            break;

        case '-':
            scale /= 1.1f;
            break;

        case 'w':
            centerY += 1;
            break;

        case 'a':
            centerX -= 1;
            break;

        case 'd':
            centerX += 1;
            break;

        case 's':
            centerY -= 1;
            break;

        case 'n':
            Console.WriteLine("Turn Ended");
            game.EndTurn();
            clickFlag = 0;
            break;
        }
    }
Ejemplo n.º 19
0
 //-----------------------------------------------------------------------------------------
 protected override void OnKeyPress(OpenTK.KeyPressEventArgs e)
 {
     if (e.KeyChar == 't' || e.KeyChar == 'T')
     {
         _textureIndex++;
         if (_textureIndex > 1)
         {
             _textureIndex = 0;
         }
     }
 }
Ejemplo n.º 20
0
 protected virtual void OpenTKGameWindow_KeyPress(object sender, OpenTK.KeyPressEventArgs e)
 {
     if (focusedIdx >= 0)
     {
         if (ifaceControl [focusedIdx].ProcessKeyPress(e.KeyChar))
         {
             return;
         }
     }
     //TODO:create keyboardkeypress evt
 }
Ejemplo n.º 21
0
    protected override void OnKeyPress(OpenTK.KeyPressEventArgs e)
    {
        if (e.KeyChar == 'y' && clickFlag == 2)
        {
            game.Manager.MoveArmy(army, pos);
            Console.WriteLine("Army has moved.");
            clickFlag = 0;
        }

        if (e.KeyChar == 'u' && clickFlag == 2)
        {
            Console.WriteLine("Army has been moved back to its previous position");
            clickFlag = 0;
        }

        if (e.KeyChar == '+')
        {
            scale *= 1.1f;
        }

        if (e.KeyChar == '-')
        {
            scale /= 1.1f;
        }

        if (e.KeyChar == 'w')
        {
            centerY += 1;
        }

        if (e.KeyChar == 'a')
        {
            centerX -= 1;
        }

        if (e.KeyChar == 'd')
        {
            centerX += 1;
        }

        if (e.KeyChar == 's')
        {
            centerY -= 1;
        }

        if (e.KeyChar == 'n')
        {
            game.EndTurn();
            Console.WriteLine("Ended turn");
        }
    }
Ejemplo n.º 22
0
 void KeyPressed(object sender, OpenTK.KeyPressEventArgs e)
 {
     if (e.KeyChar == 'l')
     {
         if (GL.IsEnabled(EnableCap.Lighting))
         {
             GL.Disable(EnableCap.Lighting);
         }
         else
         {
             GL.Enable(EnableCap.Lighting);
         }
     }
 }
Ejemplo n.º 23
0
 public override void OnKeyPress( KeyPressEventArgs e )
 {
     switch ( e.KeyChar )
     {
         case (char) 0x1b:
             myCaptureMouse = !myCaptureMouse;
             CursorVisible = !myCaptureMouse;
             break;
         case 'f':
         case 'F':
             GameWindow.Fullscreen = !GameWindow.Fullscreen;
             break;
     }
 }
Ejemplo n.º 24
0
        protected override void OnKeyPress(KeyPressEventArgs e)
        {
            base.OnKeyPress(e);

            if(e.KeyChar == 'b')
            {
                bold = !bold;

                if (bold)
                    largeText.Weight = 2.0f;
                else
                    largeText.Weight = 1.0f;
            }
        }
Ejemplo n.º 25
0
 protected override void OnKeyPress(KeyPressEventArgs e)
 {
     base.OnKeyPress(e);
     if (e.KeyChar == 27)
     {
         if (GameMenu != null)
         {
             if (State == WindowState.Game)
                 GameMenu.Show();
             else if (State == WindowState.InGameMenu)
             {
                 GameMenu.Hide();
                 State = WindowState.Game;
             }
         }
     }
 }
Ejemplo n.º 26
0
        protected override void OnKeyPress(KeyPressEventArgs e)
        {
            base.OnKeyPress(e);

            switch (e.KeyChar)
            {
            // Change shader of screen
            case 'v':
                tvScreen.Shader = (tvScreen.Shader == "screen") ? "lit_advanced" : "screen";
                break;

            // Switch between camera view and depth
            case 'c':
                tvScreen.TextureID = (tvScreen.TextureID == textures["screendepth"]) ? textures["screen"] : (int)textures["screendepth"];
                break;
            }
        }
Ejemplo n.º 27
0
 public void AddChatKey(KeyPressEventArgs e)
 {
     var key = (int)e.KeyChar;
     if (key > Constants.HIGHEST_ASCII_CHAR || (key < Constants.LOWEST_ASCII_CHAR && key != 8)) return; //ignore all strange characters except for 8=backspace
     switch (key)
     {
         case 47: //forward slash
             if (CurrentChatText == "/") return; //dont allow more slashes when theres only one slash for a slash command (key repeat on some comps seems to make them too quick)
             CurrentChatText += e.KeyChar;
             break;
         case 8: //backspace
             if (CurrentChatText.Length == 0) return;
             CurrentChatText = CurrentChatText.Substring(0, CurrentChatText.Length - 1);
             break;
         default:
             CurrentChatText += e.KeyChar;
             break;
     }
 }
Ejemplo n.º 28
0
 private static void Window_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (KeyPress != null)
         KeyPress(sender, e);
 }
Ejemplo n.º 29
0
 private static void Window_KeyPress(object sender, OpenTK.KeyPressEventArgs e)
 {
     key = e.KeyChar;
     mainFunctions.keyPressed();
 }
Ejemplo n.º 30
0
 private void Game_KeyPress(object sender, KeyPressEventArgs e)
 {
     switch (e.KeyChar)
     {
         case (char)Key.W:
             //Camera.Move(0f, 0.1f, 0f);
             break;
     }
 }
Ejemplo n.º 31
0
 protected override void OnKeyPress(OpenTK.KeyPressEventArgs e)
 {
     input.handleKeypress(e);
     base.OnKeyPress(e);
 }
Ejemplo n.º 32
0
 protected override void OnKeyPress(OpenTK.KeyPressEventArgs e)
 {
     base.OnKeyPress(e);
     mywindow.OnKeyPress(e);
 }
Ejemplo n.º 33
0
 private void VEngineWindowAdapter_KeyPress(object sender, KeyPressEventArgs e)
 {
     GLThread.InvokeOnKeyPress(e);
 }
Ejemplo n.º 34
0
 void KeyPressHandler( object sender, KeyPressEventArgs e )
 {
     char key = e.KeyChar;
     if( game.activeScreen == null || !game.activeScreen.HandlesKeyPress( key ) ) {
     }
 }
Ejemplo n.º 35
0
 private void OnKeyPress(object sender, KeyPressEventArgs e)
 {
     var func = KeyPress;
     if (func != null)
         func(this, new KeyCharEventArgs(e.KeyChar));
 }
Ejemplo n.º 36
0
 private void window_KeyPress(object sender, OpenTK.KeyPressEventArgs e)
 {
     this.charInputBuffer.Append(e.KeyChar);
 }
Ejemplo n.º 37
0
 private void GOnKeyPress(object sender, KeyPressEventArgs e)
 {
     /*
      * //if (event.key.keysym.sym == SDLK_p && event.key.keysym.mod & KMOD_LALT) {	//	if (orthoCam) {	//		projection = perspective;	//	}	//	else {	//		projection = ortho;	//	}	//	//	orthoCam = !orthoCam;	//}
      * const var state = event.type == SDL_KEYDOWN;
      *
      * switch (event.
      *
      * key.keysym.sym) {
      *     case SDLK_ESCAPE:
      *     return 0;
      *
      *     case SDLK_w:
      *     b_W = state;
      *     break;
      *
      *     case SDLK_a:
      *     b_A = state;
      *     break;
      *
      *     case SDLK_s:
      *     b_S = state;
      *     break;
      *
      *     case SDLK_d:
      *     b_D = state;
      *     break;
      *
      *     case SDLK_q:
      *     b_Q = state;
      *     break;
      *
      *     case SDLK_e:
      *     b_E = state;
      *     break;
      *
      *     case SDLK_F1:
      *     if ( state ) camera.SetFreeCam( !camera.GetFreeCam() );
      *     break;
      *
      *     case SDLK_F2:
      *     if ( state ) SDL_SetRelativeMouseMode( SDL_FALSE );
      *     break;
      *
      *     case SDLK_f:
      *     if ( state ) b_F = !b_F;
      *     break;
      *
      *     default: ;
      * }
      * if (event.key.keysym.mod & KMOD_LSHIFT) {
      *     camaraSpeed = 140.0;
      * } else if (event.key.keysym.mod & KMOD_LCTRL) {
      *     camaraSpeed = 2.0;
      * } else {
      *     camaraSpeed = 60.0;
      * }
      *
      * //if (event.key.keysym.sym == SDLK_p && event.key.keysym.mod & KMOD_LALT) { }
      * } else if (event.type == SDL_MOUSEMOTION) {
      * if ( SDL_GetRelativeMouseMode() ) camera.onMouseMoved(  event.
      * motion.xrel, event.motion.yrel);
      * } else if (event.type == SDL_MOUSEBUTTONDOWN) {
      * if (event.button.button == SDL_BUTTON_LEFT) {
      *     SDL_SetRelativeMouseMode( SDL_TRUE );
      * }
      * } else if (event.type == SDL_WINDOWEVENT) {
      * int w, h;
      * SDL_GetWindowSize( window, &w, &h );
      * GL.Viewport( 0, 0, w, h );
      * }
      * //else if (event.type == SDL_WINDOWEVENT_FOCUS_LOST) {
      * //	SDL_SetRelativeMouseMode(SDL_FALSE);
      * //}  */
 }
Ejemplo n.º 38
0
 private void Window_KeyPress(object sender, OpenTK.KeyPressEventArgs e)
 {
     KeyPress(sender, new KeyPressEventArgs(e.KeyChar));
 }
Ejemplo n.º 39
0
 public override void HandleKeyPress(KeyPressEventArgs e)
 {
     if (handler.textboxfilter != null)
         Text += handler.textboxfilter(this, e.KeyChar.ToString());
     else
         Text += e.KeyChar.ToString();
     HandleTextChanged();
     time = 0;
     textAppearence.AppendText = "|";
     base.HandleKeyPress(e);
 }
Ejemplo n.º 40
0
 void OpenTKGameWindow_KeyPress(object sender, OpenTK.KeyPressEventArgs e)
 {
     CrowInterface.ProcessKeyPress(e.KeyChar);
 }
Ejemplo n.º 41
0
 private void HandleKeyPress(object sender, KeyPressEventArgs e)
 {
     if(enabled)
     {
         byte key = (byte)e.KeyChar;
         if(key == 8) //BACKSPACE
         {
         }
         else if(key == 13) //ENTER
         {
         }
         else
         {
             input += e.KeyChar;
         }
     }
 }
Ejemplo n.º 42
0
 private void OnKeyPress(object sender, KeyPressEventArgs e)
 {
     OnTextInput(sender, new TextInputEventArgs(e.KeyChar));
 }
Ejemplo n.º 43
0
 /// <summary>
 /// This method is fired when a key is pressed over the element
 /// </summary>
 /// <param name="e">The <see cref="KeyPressEventArgs"/> associated with the KeyPress event</param>
 internal void OnKeyPressed(KeyPressEventArgs e)
 {
     if(this.KeyPressed != null)
     {
         this.KeyPressed(this, e);
     }
 }
Ejemplo n.º 44
0
 public override void OnKeyPress(KeyPressEventArgs e)
 {
     hud.OnKeyPress(e);
 }
Ejemplo n.º 45
0
 protected override void OnKeyPress(KeyPressEventArgs e)
 {
 }
Ejemplo n.º 46
0
        void window_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == '\t' || e.KeyChar == '\r' || char.IsControl(e.KeyChar))
                return;

            if (root.Focused)
            {
                root.OnCharEvent(new CharEventArgs(e.KeyChar));
            }
        }
Ejemplo n.º 47
0
 void KeyPressHandler( object sender, KeyPressEventArgs e )
 {
     char key = e.KeyChar;
     if( !game.GetActiveScreen.HandlesKeyPress( key ) ) {
     }
 }
Ejemplo n.º 48
0
 private void OnKeyPress(KeyPressEventArgs keyPressArgs)
 {
   this.KeyPress((object) this, keyPressArgs);
 }
Ejemplo n.º 49
0
 public void KeyPress(object sender, KeyPressEventArgs e)
 {
     m_Canvas.Input_Character(e.KeyChar);
 }
Ejemplo n.º 50
0
 private void OnKeyPressInternal(object sender, KeyPressEventArgs e) { OnKeyPress(e); }
Ejemplo n.º 51
0
 /// <summary>
 /// Called when a character is typed.
 /// </summary>
 /// <param name="e">The <see cref="OpenTK.KeyPressEventArgs"/> for this event.</param>
 protected virtual void OnKeyPress(KeyPressEventArgs e)
 {
     KeyPress(this, e);
 }
Ejemplo n.º 52
0
 private void WindowOnKeyPress(object sender, KeyPressEventArgs e)
 {
     this.sg.ClientKeyPress(sender, e);
 }
Ejemplo n.º 53
0
 /// <summary>
 /// Called when a character is typed.
 /// </summary>
 /// <param name="e">The <see cref="OpenTK.KeyPressEventArgs"/> for this event.</param>
 protected virtual void OnKeyPress(KeyPressEventArgs e)
 {
     if (KeyPress != null) KeyPress(this, e);
 }
Ejemplo n.º 54
0
 // For text input
 public void KeyPress(object sender, KeyPressEventArgs e)
 {
 }
Ejemplo n.º 55
0
        protected override void OnKeyPress(OpenTK.KeyPressEventArgs e)
        {
            if (e.KeyChar == 'C' || e.KeyChar == 'c')
            {
                ((VrRenderer)mRenderer).ovrvision_controller.getMatrixHeadtoCamera(0);
                mScene.popInteraction();
                mScene.pushInteraction(new Interaction.CalibrationAR(ref mScene, ref mRenderer.ovrvision_controller));
            }

            if (e.KeyChar == 'D' || e.KeyChar == 'd')
            {
                mRenderer.ovrvision_controller.setDefaultMatrixHC();
            }


            if (e.KeyChar == 'J' || e.KeyChar == 'j')
            {
                //mScene.popInteraction();
                //mScene.pushInteraction(new Interaction.EditPlane(ref mScene, ref xyPlane, ref xzPlane, ref yzPlane));
                //mScene.pushInteraction(new Interaction.RotatePlane(ref mScene, ref xyPlane2, ref xzPlane2, ref yzPlane2));

                //clear the stroke
                foreach (SceneNode sn in mScene.tableGeometry.children)
                {
                    if (sn.name == "PrintStroke")
                    {
                        mScene.tableGeometry.children.Remove(sn);
                        break;
                    }
                }
            }

            if (e.KeyChar == 'M' || e.KeyChar == 'm')
            {
                mScene.popInteraction();
                mScene.pushInteraction(new Interaction.Stroke(ref mScene));
            }

            if (e.KeyChar == 'V' || e.KeyChar == 'v')
            {
                calibrationVRtoRobot();
            }

            if (e.KeyChar == 'P' || e.KeyChar == 'p')
            {
                /*
                 * mScene.popInteraction();
                 * controllerP = new List<Vector3>();
                 * mScene.pushInteraction(new Interaction.PickPoint(ref mScene, ref controllerP));
                 */
                Rhino.DocObjects.ObjectEnumeratorSettings settings = new Rhino.DocObjects.ObjectEnumeratorSettings();
                settings.ObjectTypeFilter = Rhino.DocObjects.ObjectType.Brep;
                Brep teapotBody   = new Brep();
                Brep teapotSprout = new Brep();
                Brep teapotHandle = new Brep();
                foreach (Rhino.DocObjects.RhinoObject rhObj in mScene.rhinoDoc.Objects.GetObjectList(settings))
                {
                    if (rhObj.Attributes.Name == "aprinteGZx3Sz91Ag")
                    {
                        teapotBody = ((Brep)rhObj.Geometry).DuplicateBrep();
                        mScene.rhinoDoc.Objects.Delete(rhObj.Id, true);
                    }
                    else if (rhObj.Attributes.Name == "aprintS8FyJC391Ag")
                    {
                        teapotSprout = ((Brep)rhObj.Geometry).DuplicateBrep();
                        mScene.rhinoDoc.Objects.Delete(rhObj.Id, true);
                    }
                    else if (rhObj.Attributes.Name == "aprintVBE2eS391Ag")
                    {
                        teapotHandle = ((Brep)rhObj.Geometry).DuplicateBrep();
                        mScene.rhinoDoc.Objects.Delete(rhObj.Id, true);
                    }
                }

                Material.Material mesh_m    = new Material.LambertianMaterial(.7f, .7f, .7f, .3f);
                string            modelName = "aprint";
                SceneNode         teapotBodySN;
                UtilOld.addRhinoObjectSceneNode(ref mScene, ref teapotBody, ref mesh_m, modelName, out teapotBodySN);
                SceneNode teapotSproutSN;
                UtilOld.addRhinoObjectSceneNode(ref mScene, ref teapotSprout, ref mesh_m, modelName, out teapotSproutSN);
                SceneNode teapotHandleSN;
                UtilOld.addRhinoObjectSceneNode(ref mScene, ref teapotHandle, ref mesh_m, modelName, out teapotHandleSN);
            }

            if (e.KeyChar == 'A' || e.KeyChar == 'a')
            {
                //mScene.popInteraction();
                //mScene.pushInteraction(new Interaction.Align(ref mScene));

                //for rhino object
                OpenTK.Matrix4 currentRotation = mScene.platformRotation;

                float theta = (float)(90.0f / 360f * 2 * Math.PI);
                Rhino.RhinoApp.WriteLine("Theta = " + theta);
                Matrix4.CreateRotationZ(theta, out mScene.platformRotation);
                mScene.platformRotation.Transpose();

                //rotate Rhino objects
                OpenTK.Matrix4 rotMRhino = mScene.platformRotation * currentRotation.Inverted();
                Rhino.DocObjects.ObjectEnumeratorSettings settings = new Rhino.DocObjects.ObjectEnumeratorSettings();
                mScene.transM = new Transform();
                for (int row = 0; row < 4; row++)
                {
                    for (int col = 0; col < 4; col++)
                    {
                        mScene.transM[row, col] = rotMRhino[row, col];
                    }
                }
                settings.ObjectTypeFilter = Rhino.DocObjects.ObjectType.Brep;
                foreach (Rhino.DocObjects.RhinoObject rhObj in mScene.rhinoDoc.Objects.GetObjectList(settings))
                {
                    SceneNode sn;
                    if (mScene.BiDictionaryRhinoVR.TryGetByFirst(rhObj.Id, out sn) && !rhObj.Attributes.Name.Contains("planeXY") && !rhObj.Attributes.Name.Contains("planeXZ") &&
                        !rhObj.Attributes.Name.Contains("planeYZ"))
                    {
                        //SceneNode sn = mScene.brepToSceneNodeDic[rhObj.Id];
                        //mScene.brepToSceneNodeDic.Remove(rhObj.Id);
                        Guid newGuid = mScene.rhinoDoc.Objects.Transform(rhObj.Id, mScene.transM, true);
                        Rhino.RhinoApp.WriteLine("transM " + mScene.transM.ToString());
                        mScene.rhinoDoc.Views.Redraw();

                        //mScene.brepToSceneNodeDic.Add(newGuid, sn);
                        //mScene.SceneNodeToBrepDic[sn.guid] = mScene.rhinoDoc.Objects.Find(newGuid);
                    }
                }
            }

            if (e.KeyChar == 'O' || e.KeyChar == 'o')
            {
                mScene.popInteraction();
                UtilOld.clearAllModel(ref mScene);
            }

            if (e.KeyChar == 'Q' || e.KeyChar == 'q')
            {
                //print out debug info
                foreach (var item in mScene.selectionDic)
                {
                    Rhino.RhinoApp.WriteLine(item.Key.ToString() + ": " + item.Value.ToString());
                }
            }

            if (e.KeyChar == 'Z' || e.KeyChar == 'z')
            {
                while (!mScene.interactionStackEmpty())
                {
                    mScene.popInteraction();
                }
            }

            if (e.KeyChar == 'X' || e.KeyChar == 'x')
            {
                mScene.popInteraction();
                mScene.pushInteraction(new Interaction.CreatePatch(ref mScene));
            }

            if (e.KeyChar == '[' || e.KeyChar == '{')
            {
                mScene.popInteraction();
                mScene.pushInteraction(new Interaction.PickPoint(ref mScene, ref mLeftControllerPoses));
                current_i = null;
            }

            if (e.KeyChar == ']' || e.KeyChar == '}')
            {
                mScene.popInteraction();
                mScene.pushInteraction(new Interaction.PickPoint(ref mScene, ref mRightControllerPoses));
                current_i = null;
            }
        }
 protected void KeyPress( object sender, KeyPressEventArgs e )
 {
     if( lastInput != null && lastInput.AppendChar( e.KeyChar ) ) {
         RedrawLastInput();
         OnAddedChar();
     }
 }
Ejemplo n.º 57
0
        protected override void OnKeyPress( KeyPressEventArgs e )
        {
            switch( e.KeyChar )
            {
                case (char) 0x1B:
                    myCaptureMouse = !myCaptureMouse;
                    break;
                case 'l':
                case 'L':
                    /*
                    myGeoShader.LineMode = !myGeoShader.LineMode;
                    */
                    break;
            }

            if( !myCaptureMouse )
            {
                myUIRoot.SendKeyPressEvent( e );
            }
        }
Ejemplo n.º 58
0
 private void OnKeyPress(object sender, OpenTK.KeyPressEventArgs e)
 {
     this.OnTextInput(sender, new TextInputEventArgs(e.KeyChar));
 }