예제 #1
0
파일: Game.cs 프로젝트: JIy3AHKO/PubloG
 public Game()
     : base(800, 600, GraphicsMode.Default, "OpenTK Quick Start Sample")
 {
     VSync = VSyncMode.On;
     core = new GameCore();
     controlState = new ControlState();
     stack = new MatrixStack();
     modelDrawer = new ModelDrawer(stack);
 }
예제 #2
0
파일: GameCore.cs 프로젝트: JIy3AHKO/PubloG
        public void UpdateState(ControlState controlState)
        {
            if (controlState.KeyboardState[Key.W])
            {
                Player.X += Player.MoveVector.X;
                Player.Y += Player.MoveVector.Y;
            }
            if (controlState.KeyboardState[Key.D])
            {
                Player.X += Player.MoveVector.Transform(Matrix4.CreateRotationZ((float)(90 * Math.PI / 180))).X;
                Player.Y += Player.MoveVector.Transform(Matrix4.CreateRotationZ((float)(90 * Math.PI / 180))).Y;
            }
            if (controlState.KeyboardState[Key.S])
            {
                Player.X -= Player.MoveVector.X;
                Player.Y -= Player.MoveVector.Y;
            }
            if (controlState.KeyboardState[Key.A])
            {
                Player.X -= Player.MoveVector.Transform(Matrix4.CreateRotationZ((float)(90 * Math.PI / 180))).X;
                Player.Y -= Player.MoveVector.Transform(Matrix4.CreateRotationZ((float)(90 * Math.PI / 180))).Y;
            }

            if (controlState.KeyboardState[Key.E])
            {
                Player.Angle += 0.007f;
            }

            if (controlState.KeyboardState[Key.Q])
            {
                Player.Angle -= 0.007f;
            }

            int i = 0;

            controlState.MouseState.Move += (sender, args) =>
            {

            };
            controlState.MouseState.ButtonUp += async (sender, args) =>
            {
                StaticModels[1].TranslationMatrix = Matrix4.CreateTranslation(controlState.MousePosition.X,controlState.MousePosition.Y,0);

            };
        }