Example #1
0
    void Update()
    {
        ++m_frame_count;

        //m_ui_rescaler.onUpdate();
        if (m_last_screen_width != Screen.width ||
            m_last_screen_height != Screen.height)
        {
            onScreenResized();
        }

        if (Input.GetMouseButtonDown(0))
        {
            m_is_lmb_hold    = true;
            m_lmb_hold_start = Time.realtimeSinceStartup;
        }

        if (Input.GetMouseButtonUp(0))
        {
            m_is_lmb_hold = false;
        }



        if (Input.GetMouseButtonDown(0) |
            (m_is_lmb_hold & (Time.realtimeSinceStartup - m_lmb_hold_start) > 0.2f & (m_frame_count % 4 == 0))

            )
        {
            Vector2 pos = Input.mousePosition;

            int n_spoke  = 0;
            int sign     = 0;
            int n_button = m_wheel_model_drawer.getButtonClicked(pos);
            if (n_button != 0)
            {
                sign    = n_button / Math.Abs(n_button);
                n_spoke = Math.Abs(n_button - sign);
            }

            if (sign != 0)
            {
                m_wheel_model.rotate_nipple(n_spoke, (double)sign * 1.0 / 16.0);
                m_wheel_model.compute();
                updateModelDrawer();

                m_wheel_model.dump_log();
            }
        }


        /*if (Event.current.type == EventType.MouseDown)
         * {
         *      Vector2 pos = Event.current.mousePosition ;
         *      Debug.Log (pos.x);
         * }*/
    }