|
@@ -47,15 +47,22 @@ void SlopStartDrag::onEnter( SlopMemory& memory ) {
|
47
|
47
|
}
|
48
|
48
|
|
49
|
49
|
void SlopStartDrag::update( SlopMemory& memory, double dt ) {
|
50
|
|
- memory.rectangle->setPoints(startPoint, mouse->getMousePos());
|
51
|
50
|
char a = startPoint.y > mouse->getMousePos().y;
|
52
|
51
|
char b = startPoint.x > mouse->getMousePos().x;
|
53
|
52
|
char c = (a << 1) | b;
|
54
|
53
|
switch ( c ) {
|
55
|
|
- case 0: mouse->setCursor( XC_lr_angle ); break;
|
56
|
|
- case 1: mouse->setCursor( XC_ll_angle ); break;
|
57
|
|
- case 2: mouse->setCursor( XC_ur_angle ); break;
|
58
|
|
- case 3: mouse->setCursor( XC_ul_angle ); break;
|
|
54
|
+ case 0: mouse->setCursor( XC_lr_angle );
|
|
55
|
+ memory.rectangle->setPoints(startPoint+glm::vec2(0,0), mouse->getMousePos()+glm::vec2(1,1));
|
|
56
|
+ break;
|
|
57
|
+ case 1: mouse->setCursor( XC_ll_angle );
|
|
58
|
+ memory.rectangle->setPoints(startPoint+glm::vec2(0,0), mouse->getMousePos()+glm::vec2(1,1));
|
|
59
|
+ break;
|
|
60
|
+ case 2: mouse->setCursor( XC_ur_angle );
|
|
61
|
+ memory.rectangle->setPoints(startPoint+glm::vec2(0,1), mouse->getMousePos()+glm::vec2(1,0));
|
|
62
|
+ break;
|
|
63
|
+ case 3: mouse->setCursor( XC_ul_angle );
|
|
64
|
+ memory.rectangle->setPoints(startPoint+glm::vec2(1,1), mouse->getMousePos()+glm::vec2(0,0));
|
|
65
|
+ break;
|
59
|
66
|
}
|
60
|
67
|
if ( !mouse->getButton( 1 ) ) {
|
61
|
68
|
memory.setState( (SlopState*)new SlopEndDrag() );
|