123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- #include "base/CCEventMouse.h"
- #include "base/CCDirector.h"
- NS_CC_BEGIN
- EventMouse::EventMouse(MouseEventType mouseEventCode)
- : Event(Type::MOUSE)
- , _mouseEventType(mouseEventCode)
- , _mouseButton(MouseButton::BUTTON_UNSET)
- , _x(0.0f)
- , _y(0.0f)
- , _scrollX(0.0f)
- , _scrollY(0.0f)
- , _startPointCaptured(false)
- {
- };
- Vec2 EventMouse::getLocationInView() const
- {
- return _point;
- }
- Vec2 EventMouse::getPreviousLocationInView() const
- {
- return _prevPoint;
- }
- Vec2 EventMouse::getStartLocationInView() const
- {
- return _startPoint;
- }
- Vec2 EventMouse::getLocation() const
- {
- return Director::getInstance()->convertToGL(_point);
- }
- Vec2 EventMouse::getPreviousLocation() const
- {
- return Director::getInstance()->convertToGL(_prevPoint);
- }
- Vec2 EventMouse::getStartLocation() const
- {
- return Director::getInstance()->convertToGL(_startPoint);
- }
- Vec2 EventMouse::getDelta() const
- {
- return getLocation() - getPreviousLocation();
- }
- NS_CC_END
|