コード例 #1
0
ファイル: FreeLook.cs プロジェクト: aerosolswe/WaterWorld
        public FreeLook(float sensitivity)
        {
            this.sensitivity = sensitivity;

            CoreEngine.input.AddButtonMap("UnlockMouse", MouseButton.Middle);
            unlockMapping = CoreEngine.input.Mapping("UnlockMouse");
        }
コード例 #2
0
ファイル: FreeMove.cs プロジェクト: aerosolswe/WaterWorld
        public FreeMove(float speed)
        {
            this.speed = speed;

            CoreEngine.input.AddKeyMap("forward", Key.W);
            CoreEngine.input.AddKeyMap("backward", Key.S);
            CoreEngine.input.AddKeyMap("left", Key.A);
            CoreEngine.input.AddKeyMap("right", Key.D);
            CoreEngine.input.AddKeyMap("up", Key.Space);
            CoreEngine.input.AddKeyMap("down", Key.LControl);
            forwardMap = CoreEngine.input.Mapping("forward");
            backwardMap = CoreEngine.input.Mapping("backward");
            leftMap = CoreEngine.input.Mapping("left");
            rightMap = CoreEngine.input.Mapping("right");
            upMap = CoreEngine.input.Mapping("up");
            downMap = CoreEngine.input.Mapping("down");
        }
コード例 #3
0
ファイル: GameInput.cs プロジェクト: aerosolswe/WaterWorld
        public void AddButtonMap(string name, MouseButton button)
        {
            Mapping mapping = null;

            foreach(KeyValuePair<int, Mapping> entry in mappings) {
                mapping = entry.Value;

                if(mapping.Name.Equals(name)) {
                    mapping.AddButton(button);
                } else {
                    mapping = null;
                }

            }

            if(mapping == null) {
                mapping = new Mapping(name, button);
                mappings.Add((int)button, mapping);
            }
        }
コード例 #4
0
ファイル: MyGame.cs プロジェクト: aerosolswe/WaterWorld
        public override void Awake()
        {
            base.Awake();

            CoreEngine.input.AddKeyMap("Quit", Key.Escape);
            quitMap = CoreEngine.input.Mapping("Quit");

            MeshRenderer mr = new MeshRenderer(ModelLoader.LoadModel("Content/Models/duck.dae"), new Material(TextureLoader.LoadTexture("Content/Models/duckCM.bmp")));

            duckObject = new GameObject();
            duckObject.AddComponent(new MeshRenderer(ModelLoader.LoadModel("Content/Models/duck.dae"), new Material(TextureLoader.LoadTexture("Content/Models/duckCM.bmp"))));
            duckObject.Transform.Scale = new Vector3(0.015f);
            duckObject.Transform.Position = new Vector3(0, 0, 0);

            Root.AddChild(duckObject);

            cameraObject = new GameObject();
            cameraObject.AddComponent(new Camera(Matrix4.CreatePerspectiveFieldOfView((float)MathHelper.DegreesToRadians(90), (float)CoreEngine.Width / (float)CoreEngine.Height, 0.3f, 1000f)));
            cameraObject.AddComponent(new FreeMove(10));
            cameraObject.AddComponent(new FreeLook(1));
            Root.AddChild(cameraObject);
            cameraObject.Transform.Position = new Vector3(0, 0, -15);
        }
コード例 #5
0
ファイル: GameInput.cs プロジェクト: aerosolswe/WaterWorld
        public void AddKeyMap(string name, Key key)
        {
            Mapping mapping = null;

            foreach(KeyValuePair<int, Mapping> entry in mappings) {
                mapping = entry.Value;

                if(mapping.Name.Equals(name)) {
                    mapping.AddKey(key);
                } else {
                    mapping = null;
                }

            }

            if(mapping == null) {
                mapping = new Mapping(name, key);
                mappings.Add((int)key, mapping);
            }
        }