Beispiel #1
0
void Mouse(int button, int state, int x, int y)
{
	if (button == GLUT_LEFT_BUTTON)
	{
		if (state == GLUT_DOWN)
		{
			ConvertScreenToWorld(x, y, lastp);
			lMouseDown = true;
			if(g_pApp) g_pApp->OnMouseDown(lastp);
		}

		if (state == GLUT_UP)
		{
			lMouseDown = false;
			if(g_pApp) g_pApp->OnMouseUp();
		}
	}
	else if (button == GLUT_RIGHT_BUTTON)
	{
		if (state == GLUT_DOWN)
		{	
			ConvertScreenToWorld(x, y, lastp);
			rMouseDown = true;
		}

		if (state == GLUT_UP)
		{
			rMouseDown = false;
		}
	}
}
Beispiel #2
0
void Mouse(int32 button, int32 state, int32 x, int32 y)
{
	// Use the mouse to move things around.
	if (button == GLUT_LEFT_BUTTON)
	{
		if (state == GLUT_DOWN)
		{
			b2Vec2 p = ConvertScreenToWorld(x, y);
			test->MouseDown(p);
		}
		
		if (state == GLUT_UP)
		{
			test->MouseUp();
		}
	} else if (button == GLUT_RIGHT_BUTTON)
	{
		if (state == GLUT_DOWN)
		{	
			lastp = ConvertScreenToWorld(x, y);
			rMouseDown = true;
		}

		if (state == GLUT_UP)
		{
			rMouseDown = false;
		}
	}
}
Beispiel #3
0
static void Mouse(int32 button, int32 state, int32 x, int32 y)
{
	// Use the mouse to move things around.
	if (button == GLUT_LEFT_BUTTON)
	{
		int mod = glutGetModifiers();
		b2Vec2 p = ConvertScreenToWorld(x, y);

		switch (fullscreenUI.Mouse(button, state, previousMouseState, p))
		{
		case FullscreenUI::e_SelectionTestPrevious:
			testSelection = std::max(0, testSelection - 1);
			break;
		case FullscreenUI::e_SelectionTestNext:
			if (g_testEntries[testSelection + 1].name) testSelection++;
			break;
		case FullscreenUI::e_SelectionParameterPrevious:
			particleParameter.Decrement();
			break;
		case FullscreenUI::e_SelectionParameterNext:
			particleParameter.Increment();
			break;
		default:
			break;
		}

		if (state == GLUT_DOWN)
		{
			b2Vec2 p = ConvertScreenToWorld(x, y);
			if (mod == GLUT_ACTIVE_SHIFT)
			{
				test->ShiftMouseDown(p);
			}
			else
			{
				test->MouseDown(p);
			}
		}

		if (state == GLUT_UP)
		{
			test->MouseUp(p);
		}
	}
	else if (button == GLUT_RIGHT_BUTTON)
	{
		if (state == GLUT_DOWN)
		{
			lastp = ConvertScreenToWorld(x, y);
			rMouseDown = true;
		}

		if (state == GLUT_UP)
		{
			rMouseDown = false;
		}
	}
	previousMouseState = state;
}
Beispiel #4
0
void handleScreenEvent(bps_event_t *event)
{
    screen_event_t screen_event = screen_event_get_event(event);
	mtouch_event_t mtouch_event;
    int screen_val;
    int position[2];
    int rc;

    screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_TYPE, &screen_val);

    switch (screen_val)
    {
		case SCREEN_EVENT_MTOUCH_TOUCH:
		case SCREEN_EVENT_MTOUCH_MOVE:
		case SCREEN_EVENT_MTOUCH_RELEASE:
            rc = screen_get_mtouch_event(screen_event, &mtouch_event, 0);
            if (rc)
                fprintf(stderr, "Error: failed to get mtouch event\n");

            rc = gestures_set_process_event(set, &mtouch_event, NULL);

            // No gesture detected, pass through
            if (!rc)
            {
            	if (screen_val == SCREEN_EVENT_MTOUCH_TOUCH)
            		MouseDown(mtouch_event.x, mtouch_event.y);
            	else if (screen_val == SCREEN_EVENT_MTOUCH_MOVE)
            		test->MouseMove(ConvertScreenToWorld(mtouch_event.x, mtouch_event.y));
            	else
            		test->MouseUp(ConvertScreenToWorld(mtouch_event.x, mtouch_event.y));
            }

			break;

		case SCREEN_EVENT_KEYBOARD:
			screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_KEY_FLAGS, &screen_val);

			if (screen_val & KEY_DOWN)
			{
				screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_KEY_SYM, &screen_val);

				if (screen_val >= ' ' && screen_val < '~')
				{
					Keyboard(screen_val, 0, 0);
				}
				else
				{
					screen_val = screen_val - 0xf000;
					Keyboard(screen_val, 0, 0);
				}
			}

			break;
    }
}
void MouseMotion(int32 x, int32 y){
	b2Vec2 p = ConvertScreenToWorld(x, y);
	simulatorPage->MouseMove(p);

	if (rMouseDown)
	{
		b2Vec2 diff = p - lastp;
		settings.viewCenter.x -= diff.x;
		settings.viewCenter.y -= diff.y;
		Resize(width, height);
		lastp = ConvertScreenToWorld(x, y);
	}
}
Beispiel #6
0
void MouseMotion(int32 x, int32 y)
{
	b2Vec2 p = ConvertScreenToWorld(x, y);
	test->MouseMove(p);
	
	if (rMouseDown){
		b2Vec2 diff = p - lastp;
		viewCenter.x -= diff.x;
		viewCenter.y -= diff.y;
		Resize(width, height);
		lastp = ConvertScreenToWorld(x, y);
	}
}
Beispiel #7
0
void MouseMotion(int x, int y)
{
	FvVector2 p;
	ConvertScreenToWorld(x, y, p);
	if(lMouseDown && g_pApp)
		g_pApp->OnMouseMove(p);

	if (rMouseDown)
	{
		FvVector2 diff = p - lastp;
		viewCenter -= diff;
		Resize(width, height);
		ConvertScreenToWorld(x, y, lastp);
	}
}
Beispiel #8
0
static void MouseDown(int32 x, int32 y)
{
	if (x < centerPrev.x + radius &&
		x > centerPrev.x - radius &&
		y < centerPrev.y + radius &&
		y > centerPrev.y - radius)
	{
		testSelection--;
		if (testSelection < 0)
		{
			testSelection = testCount - 1;
		}
	}
	else if (x < centerNext.x + radius &&
			 x > centerNext.x - radius &&
			 y < centerNext.y + radius &&
			 y > centerNext.y - radius)
	{
		testSelection++;
		if (testSelection == testCount)
		{
			testSelection = 0;
		}
	}
	else
	{
		b2Vec2 p = ConvertScreenToWorld(x, y);
		test->MouseDown(p);
	}
}
Beispiel #9
0
static void MouseMotion(int32 x, int32 y)
{
	b2Vec2 p = ConvertScreenToWorld(x, y);

	if (fullscreenUI.GetSelection() == FullscreenUI::e_SelectionNone)
	{
		test->MouseMove(p);
	}

	if (rMouseDown)
	{
		b2Vec2 diff = p - lastp;
		settings.viewCenter.x -= diff.x;
		settings.viewCenter.y -= diff.y;
		Resize(width, height);
		lastp = ConvertScreenToWorld(x, y);
	}
}
Beispiel #10
0
Datei: Main.cpp Projekt: 4ian/GD
void Mouse(int32 button, int32 state, int32 x, int32 y)
{
	// Use the mouse to move things around.
	if (button == GLUT_LEFT_BUTTON)
	{
		int mod = glutGetModifiers();
		b2Vec2 p = ConvertScreenToWorld(x, y);
		if (state == GLUT_DOWN)
		{
			b2Vec2 p = ConvertScreenToWorld(x, y);
			if (mod == GLUT_ACTIVE_SHIFT)
			{
				test->ShiftMouseDown(p);
			}
			else
			{
				test->MouseDown(p);
			}
		}
		
		if (state == GLUT_UP)
		{
			test->MouseUp(p);
		}
	}
	else if (button == GLUT_RIGHT_BUTTON)
	{
		if (state == GLUT_DOWN)
		{	
			lastp = ConvertScreenToWorld(x, y);
			rMouseDown = true;
		}

		if (state == GLUT_UP)
		{
			rMouseDown = false;
		}
	}
}