Beispiel #1
0
        /** 更新。
         *
         *      a_eceleration		: 加速度
         *
         */
        public void Main(bool a_is_onover, float a_eceleration, float a_delta)
        {
            if ((this.flag == false) && (Fee.Input.Input.GetInstance().mouse.left.down == true) && (a_is_onover == true))
            {
                Fee.Geometry.Pos2D <int> t_position = Fee.Input.Input.GetInstance().mouse.cursor.pos;
                if (this.callback.IsRectIn(in t_position) == true)
                {
                    //ドラッグ開始。
                    this.flag = true;
                    this.start_viewposition = this.callback.GetViewPosition();
                    this.start_pos          = this.callback.GetScrollDirectionValue(in t_position);
                    this.old_pos            = this.start_pos;

                    this.speed = 0.0f;
                }
            }
            else if ((this.flag == true) && (Fee.Input.Input.GetInstance().mouse.left.on == true))
            {
                //ドラッグ中。

                Fee.Geometry.Pos2D <int> t_position = Fee.Input.Input.GetInstance().mouse.cursor.pos;
                this.callback.SetViewPosition(this.start_viewposition + this.start_pos - this.callback.GetScrollDirectionValue(in t_position));

                //慣性。
                int t_drag_new_pos = this.callback.GetScrollDirectionValue(in t_position);

                float t_speed = (this.old_pos - t_drag_new_pos);
                if (a_delta > 0.0f)
                {
                    t_speed = t_speed / a_delta;
                }
                else
                {
                    t_speed = this.speed;
                }

                this.speed   = this.speed * 0.5f + t_speed * 0.5f;
                this.old_pos = t_drag_new_pos;
            }
            else if ((this.flag == true) && (Fee.Input.Input.GetInstance().mouse.left.on == false))
            {
                //ドラッグ終了。
                this.flag = false;
            }

            if ((this.flag == false) && (this.speed != 0.0f))
            {
                this.speed *= a_eceleration;
                if ((this.speed * this.speed) >= 0.01f)
                {
                    this.callback.SetViewPosition(this.callback.GetViewPosition() + this.speed * a_delta);
                }
                else
                {
                    this.speed = 0.0f;
                }
            }
        }
Beispiel #2
0
        /** 更新。
         */
        public void Main(bool a_is_onover)
        {
            if ((this.flag == false) && (Fee.Input.Mouse.GetInstance().left.down == true) && (a_is_onover == true))
            {
                Fee.Geometry.Pos2D <int> t_position = Fee.Input.Mouse.GetInstance().cursor.pos;
                if (this.callback.IsRectIn(in t_position) == true)
                {
                    //ドラッグ開始。
                    this.flag = true;
                    this.start_viewposition = this.callback.GetViewPosition();
                    this.start_pos          = this.callback.GetScrollDirectionValue(in t_position);
                    this.old_pos            = this.start_pos;

                    this.speed = 0.0f;
                }
            }
            else if ((this.flag == true) && (Fee.Input.Mouse.GetInstance().left.on == true))
            {
                //ドラッグ中。

                Fee.Geometry.Pos2D <int> t_position = Fee.Input.Mouse.GetInstance().cursor.pos;
                this.callback.SetViewPosition(this.start_viewposition + this.start_pos - this.callback.GetScrollDirectionValue(in t_position));

                //慣性。
                int t_drag_new_pos = this.callback.GetScrollDirectionValue(in t_position);
                this.speed   = this.speed * 0.3f + (this.old_pos - t_drag_new_pos) * 0.7f;
                this.old_pos = t_drag_new_pos;
            }
            else if ((this.flag == true) && (Fee.Input.Mouse.GetInstance().left.on == false))
            {
                //ドラッグ終了。
                this.flag = false;
            }

            if ((this.flag == false) && (this.speed != 0.0f))
            {
                int t_move = (int)this.speed;
                this.speed /= 1.08f;
                if (t_move != 0)
                {
                    this.callback.SetViewPosition(this.callback.GetViewPosition() + t_move);
                }
                else
                {
                    this.speed = 0.0f;
                }
            }
        }
Beispiel #3
0
 /** 設定。
  */
 public void Set(int a_x, int a_y)
 {
     this.pos_old = this.pos;
     this.pos.Set(a_x, a_y);
 }