예제 #1
0
	CTrackBall() {
		radius = 106;
		saferadius = radius -1;
		reset();
        touch1.clear();
        touch2.clear();
        nFingers = 0;
	}
예제 #2
0
	inline void processTouches(int command, int x, int y) {
	
		switch (command) {
            case CMD_TOUCH_END2:
                touch2.clear();
                nFingers--;
                break;
			case CMD_TOUCH_START2:
                touch2.x = x; touch2.y = y;
                oldlen = touch2.subtract(touch2, touch1).length();
                m_spinning = false;
                nFingers++;
                break;
            case CMD_TOUCHMOVE2:
                touch2.x = x; touch2.y = y;
                m_spinning = false;
                break;
            case CMD_TOUCHMOVE:
            {
                if (m_spinning && !isPinching()) {
                    start = MapToSphere(m_fingerStart);
                    end   = MapToSphere(vec2(x,y));
                    delta = CQuaternion::CreateFromVectors(start, end);
                    m_orientation = delta.Rotated(m_prevOrientation);
                }
                
            }
            break;

			case CMD_TOUCH_START:
                touch1.x = x; touch1.y = y;
                onTouchDown(x,y);
                nFingers++;
                break;
			case CMD_TOUCH_END:
                touch1.x = x; touch1.y = y;
				onTouchUp(x,y);
                touch1.clear();
                touch2.clear();
                m_spinning = false;
                nFingers--;
                break;
            case CMD_SCREENSIZE:
                touch1.x = x; touch1.y = y;
				onScreenSize(x,y); 
    			break;
		}
	}
예제 #3
0
	void reset() {
		m_orientation.clear();
		m_prevOrientation.clear();
        touch1.clear();
        touch2.clear();
	}