コード例 #1
0
ファイル: 08curves2dmain.cpp プロジェクト: renc/PhoenixCore
// slot/callback to update the control point of the curve,
// and refresh the polyline which used to view the curve.
void onKeyboardEvent(const WindowEvent &e)
{
	if (e.type() != WET_KEY)
		return;

	switch (e.int_data)
	{					  
	case phoenix::Key_0: g_iSelectedCP = 0; break;
	case phoenix::Key_1: g_iSelectedCP = 1; break;
	case phoenix::Key_2: g_iSelectedCP = 2; break;
	case phoenix::Key_3: g_iSelectedCP = 3; break;
	case phoenix::Key_UP: 
		{
			if (g_iSelectedCP < aCPs.size() && -1 < g_iSelectedCP) {
				aCPs[g_iSelectedCP].setY( aCPs[g_iSelectedCP].getY() + 1 ); 
				calculatePolylineFromCP(aCPs);
			}
		} break; 
	case phoenix::Key_DOWN: 
		{
			if (g_iSelectedCP < aCPs.size() && -1 < g_iSelectedCP) {
				aCPs[g_iSelectedCP].setY( aCPs[g_iSelectedCP].getY() - 1 );
				calculatePolylineFromCP(aCPs);
			}
		} break; 
	case phoenix::Key_LEFT: 
		{
			if (g_iSelectedCP < aCPs.size() && -1 < g_iSelectedCP) {
				aCPs[g_iSelectedCP].setX( aCPs[g_iSelectedCP].getX() - 1 );
				calculatePolylineFromCP(aCPs);
			}
		} break; 
	case phoenix::Key_RIGHT: 
		{
			if (g_iSelectedCP < aCPs.size() && -1 < g_iSelectedCP) {
				aCPs[g_iSelectedCP].setX( aCPs[g_iSelectedCP].getX() + 1 );
				calculatePolylineFromCP(aCPs);
			}
		} break; 
	default:
		{
			int a = 0;
			int b = a;
			++b;
		}
		break;
	} 
} 
コード例 #2
0
ファイル: Window.cpp プロジェクト: SebSchmech/gloperate
void Window::postprocessEvent(WindowEvent & event)
{
    switch (event.type())
    {
    case WindowEvent::Type::Paint:
        swap();
        break;

    case WindowEvent::Type::Close:
        if (!event.isAccepted())
            destroy();
        break;

    default:
        break;
    }
}
コード例 #3
0
void WindowEventHandler::handleEvent(WindowEvent & event)
{
    if (!event.window())
        return;

    switch (event.type())
    {
        case WindowEvent::Resize:
            resizeEvent(static_cast<ResizeEvent&>(event));
            break;

        case WindowEvent::FrameBufferResize:
            framebufferResizeEvent(static_cast<ResizeEvent&>(event));
            break;

        case WindowEvent::Move:
            moveEvent(static_cast<MoveEvent&>(event));
            break;

        case WindowEvent::Paint:
            paintEvent(static_cast<PaintEvent&>(event));
            break;

        case WindowEvent::KeyPress:
            keyPressEvent(static_cast<KeyEvent&>(event));
            break;

        case WindowEvent::KeyRelease:
            keyReleaseEvent(static_cast<KeyEvent&>(event));
            break;

        case WindowEvent::MousePress:
            mousePressEvent(static_cast<MouseEvent&>(event));
            break;

        case WindowEvent::MouseRelease:
            mouseReleaseEvent(static_cast<MouseEvent&>(event));
            break;

        case WindowEvent::MouseMove:
            mouseMoveEvent(static_cast<MouseEvent&>(event));
            break;

        case WindowEvent::MouseEnter:

            break;

        case WindowEvent::MouseLeave:

            break;

        case WindowEvent::Scroll:
            scrollEvent(static_cast<ScrollEvent&>(event));
            break;

        case WindowEvent::Focus:
            focusEvent(static_cast<FocusEvent&>(event));
            break;

        case WindowEvent::Iconify:
            iconifyEvent(static_cast<IconifyEvent&>(event));
            break;

        case WindowEvent::Timer:
            timerEvent(static_cast<TimerEvent&>(event));
            break;

        default:
            break;
    }
}