Пример #1
0
		void flascc_event_mouseMoved(int x, int y) {
			GameContainer* container = ARK2D::getContainer();

			float thisx = (float) x;
			float thisy = (float) y;
			
			thisx -= container->getTranslateX();
			thisy -= container->getTranslateY();

			thisx /= container->getScale();
			thisy /= container->getScale();

			Input* i = ARK2D::getInput();
			ARK2D::getLog()->mouseMoved((int) thisx, (int) thisy, i->mouse_x, i->mouse_y);
			ARK2D::getGame()->mouseMoved((int) thisx, (int) thisy, i->mouse_x, i->mouse_y);
			i->mouse_x = (int) thisx;
			i->mouse_y = (int) thisy;
		}
Пример #2
0
		void flascc_event_mouseUp(int button, int x, int y) {
			GameContainer* container = ARK2D::getContainer();

			float thisx = (float) x;
			float thisy = (float) y;
			thisx -= container->getTranslateX();
			thisy -= container->getTranslateY();

			thisx /= container->getScale();
			thisy /= container->getScale();

			unsigned int key = Input::MOUSE_BUTTON_LEFT;
			if (button == 0) {
				key = Input::MOUSE_BUTTON_LEFT;
			} else if (button == 1) {
				key = Input::MOUSE_BUTTON_RIGHT;
			}

			Input* i = ARK2D::getInput();
			i->mouse_x = (int) thisx;
			i->mouse_y = (int) thisy;
			i->releaseKey(key);
		}