当前位置: 首页>>代码示例>>C++>>正文


C++ screen_get_event_property_iv函数代码示例

本文整理汇总了C++中screen_get_event_property_iv函数的典型用法代码示例。如果您正苦于以下问题:C++ screen_get_event_property_iv函数的具体用法?C++ screen_get_event_property_iv怎么用?C++ screen_get_event_property_iv使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了screen_get_event_property_iv函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: handleScreenEvent

static void handleScreenEvent(bps_event_t *event) {
	int screen_val, buttons;
	int pair[2];

	static bool mouse_pressed = false;

	screen_event_t screen_event = screen_event_get_event(event);

	//Query type of screen event and its location on the screen
	screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_TYPE,
			&screen_val);
	screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_SOURCE_POSITION,
			pair);

	//There is a difference between touch screen events and mouse events
	if (screen_val == SCREEN_EVENT_MTOUCH_RELEASE) {
		//This is touch screen event.
		add_cube((float) pair[0], (float) pair[1]);
	} else if (screen_val == SCREEN_EVENT_POINTER) {
		//This is a mouse move event, it is applicable to a device with a usb mouse or simulator
		screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_BUTTONS,
				&buttons);

		if (buttons == SCREEN_LEFT_MOUSE_BUTTON) {
			//Left mouse button is pressed
			mouse_pressed = true;
		} else {
			if (mouse_pressed) {
				//Left mouse button was released, add a cube
				add_cube((float) pair[0], (float) pair[1]);
				mouse_pressed = false;
			}
		}
	}
}
开发者ID:PamC,项目名称:VSPlugin,代码行数:35,代码来源:main.c

示例2: process_gamepad_event

static void process_gamepad_event(screen_event_t screen_event, int type)
{
   screen_device_t device;
   screen_get_event_property_pv(screen_event, SCREEN_PROPERTY_DEVICE, (void**)&device);

   input_device_t* controller = NULL;
   int i;
   for (i = 0; i < MAX_PADS; ++i)
   {
      if (device == devices[i].handle)
      {
         controller = &devices[i];
         break;
      }
   }

   if (!controller)
      return;

   // Store the controller's new state.
   screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_BUTTONS, &controller->buttons);

   if (controller->analogCount > 0)
      screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_ANALOG0, controller->analog0);

   if (controller->analogCount == 2)
      screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_ANALOG1, controller->analog1);

   //Only player 1
   //TODO: Am I missing something? Is there a better way?
   if((controller->port == 0) && (controller->buttons & g_settings.input.binds[0][RARCH_MENU_TOGGLE].joykey))
      g_extern.lifecycle_state ^= (1ULL << RARCH_MENU_TOGGLE);
}
开发者ID:DonelBueno,项目名称:iOS,代码行数:33,代码来源:qnx_input.c

示例3: qnx_process_keyboard_event

static void qnx_process_keyboard_event(
      qnx_input_t *qnx,
      screen_event_t event, int type)
{
    // Get key properties from screen event
    int flags = 0;
    screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_FLAGS, &flags);

    int cap = 0;
    screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_CAP, &cap);

    int mod = 0;
    screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_MODIFIERS, &mod);

    // Calculate state
    unsigned keycode = input_keymaps_translate_keysym_to_rk(cap);
    bool keydown = flags & KEY_DOWN;
    bool keyrepeat = flags & KEY_REPEAT;

    // Fire keyboard event
    if(!keyrepeat)
    {
        input_keyboard_event(keydown, keycode, 0, mod, RETRO_DEVICE_KEYBOARD);
    }

    // Apply keyboard state
    if(keydown && !keyrepeat)
    {
       BIT_SET(qnx->keyboard_state, cap);
    }
    else if(!keydown && !keyrepeat)
    {
       BIT_CLEAR(qnx->keyboard_state, cap);
    }
}
开发者ID:arakerlu,项目名称:RetroArch,代码行数:35,代码来源:qnx_input.c

示例4: PLAYBOOK_PumpEvents

void
PLAYBOOK_PumpEvents(_THIS)
{
	while (1)
	{
		int rc = screen_get_event(this->hidden->screenContext, this->hidden->screenEvent, 0 /*timeout*/);
		if (rc)
			break;

		int type;
		rc = screen_get_event_property_iv(this->hidden->screenEvent, SCREEN_PROPERTY_TYPE, &type);
		if (rc || type == SCREEN_EVENT_NONE)
			break;

		screen_window_t window;
		screen_get_event_property_pv(this->hidden->screenEvent, SCREEN_PROPERTY_WINDOW, (void **)&window);
		if (!window && type != SCREEN_EVENT_KEYBOARD)
			break;

		switch (type)
		{
		case SCREEN_EVENT_CLOSE:
			SDL_PrivateQuit(); // We can't stop it from closing anyway
			break;
		case SCREEN_EVENT_PROPERTY:
			{
				int val;
				screen_get_event_property_iv(this->hidden->screenEvent, SCREEN_PROPERTY_NAME, &val);

				//fprintf(stderr, "Property change (property val=%d)\n", val);
			}
			break;
		case SCREEN_EVENT_POINTER:
			handlePointerEvent(this->hidden->screenEvent, window);
			break;
		case SCREEN_EVENT_KEYBOARD:
			handleKeyboardEvent(this->hidden->screenEvent);
			break;
		case SCREEN_EVENT_MTOUCH_TOUCH:
		case SCREEN_EVENT_MTOUCH_MOVE:
		case SCREEN_EVENT_MTOUCH_RELEASE:
			handleMtouchEvent(this->hidden->screenEvent, window, type);
			break;
		}
	}

#ifdef TOUCHPAD_SIMULATE
	if (state.pending[0] || state.pending[1]) {
		SDL_PrivateMouseMotion(state.mask, 1, state.pending[0], state.pending[1]);
		state.pending[0] = 0;
		state.pending[1] = 0;
	}
#endif
	if (moveEvent.pending) {
		SDL_PrivateMouseMotion((moveEvent.touching?SDL_BUTTON_LEFT:0), 0, moveEvent.pos[0], moveEvent.pos[1]);
		moveEvent.pending = 0;
	}
}
开发者ID:Thib1090,项目名称:SDL,代码行数:58,代码来源:SDL_playbookevents.c

示例5: process_keyboard_event

static void process_keyboard_event(screen_event_t event, int type)
{
   input_device_t* controller = NULL;
   int i = 0;

   //Get Keyboard state
   int sym = 0;
   screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_SYM, &sym);
   int modifiers = 0;
   screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_MODIFIERS, &modifiers);
   int flags = 0;
   screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_FLAGS, &flags);
   int scan = 0;
   screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_SCAN, &scan);
   int cap = 0;
   screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_CAP, &cap);

#ifdef HAVE_BB10
   //Find device that pressed the key
   screen_device_t device;
   screen_get_event_property_pv(event, SCREEN_PROPERTY_DEVICE, (void**)&device);

   for (i = 0; i < MAX_PADS; ++i)
   {
      if (device == devices[i].handle)
      {
         controller = &devices[i];
         break;
      }
   }

   if (!controller)
      return;
#else
   controller = &devices[0];
#endif

   if(controller->port == -1)
      return;

   int b;
   for (b = 0; b < RARCH_FIRST_CUSTOM_BIND; ++b)
   {
      if ((unsigned int)g_settings.input.binds[controller->port][b].joykey == (unsigned int)(sym&0xFF))
      {
         if (flags & KEY_DOWN)
            controller->buttons |= 1 << b;
         else
            controller->buttons &= ~(1<<b);
      }

   }

   //TODO: Am I missing something? Is there a better way?
   if((controller->port == 0) && ((unsigned int)g_settings.input.binds[0][RARCH_MENU_TOGGLE].joykey == (unsigned int)(sym&0xFF)))
      if (flags & KEY_DOWN)
         g_extern.lifecycle_state ^= (1ULL << RARCH_MENU_TOGGLE);
}
开发者ID:DonelBueno,项目名称:iOS,代码行数:58,代码来源:qnx_input.c

示例6: handleScreenEvent

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;
    }
}
开发者ID:jwalkoski,项目名称:Box2D,代码行数:55,代码来源:bbmain.cpp

示例7: qnx_process_gamepad_event

static void qnx_process_gamepad_event(
      qnx_input_t *qnx,
      screen_event_t screen_event, int type)
{
   int i;
   screen_device_t device;
   qnx_input_device_t* controller = NULL;
   settings_t *settings = config_get_ptr();
   global_t   *global   = global_get_ptr();
   uint64_t *state_cur  = NULL;

   (void)type;

   screen_get_event_property_pv(screen_event,
         SCREEN_PROPERTY_DEVICE, (void**)&device);

   for (i = 0; i < MAX_PADS; ++i)
   {
      if (device == qnx->devices[i].handle)
      {
         controller = (qnx_input_device_t*)&qnx->devices[i];
         break;
      }
   }

   if (!controller)
      return;

   /* Store the controller's new state. */
   screen_get_event_property_iv(screen_event,
         SCREEN_PROPERTY_BUTTONS, &controller->buttons);

   state_cur  = (uint64_t*)&qnx->pad_state[controller->port];
   *state_cur = 0;

   for (i = 0; i < 20; i++)
      *state_cur |= (controller->buttons & (1 << i) ? (1 << i) : 0);

   if (controller->analogCount > 0)
      screen_get_event_property_iv(screen_event,
            SCREEN_PROPERTY_ANALOG0, controller->analog0);

   if (controller->analogCount == 2)
      screen_get_event_property_iv(screen_event,
            SCREEN_PROPERTY_ANALOG1, controller->analog1);

   /* Only user 1
    * TODO: Am I missing something? Is there a better way? */
   if((controller->port == 0) && 
         (controller->buttons & 
          settings->input.binds[0][RARCH_MENU_TOGGLE].joykey))
      global->lifecycle_state ^= (1ULL << RARCH_MENU_TOGGLE);
}
开发者ID:lordixi,项目名称:RetroArch,代码行数:53,代码来源:qnx_input.c

示例8: handleScreenEvent

void handleScreenEvent(bps_event_t *event)
{
	screen_event_t screen_event = screen_event_get_event(event);

	int screen_val;
	screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_TYPE, &screen_val);

	switch (screen_val) {
	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);

			printf("The '%c' key was pressed\n", (char)screen_val);
			fflush(stdout);

			switch (screen_val) {
			case KEYCODE_I:
				// Display the email layout with "Send" enter key
				virtualkeyboard_change_options(VIRTUALKEYBOARD_LAYOUT_EMAIL, VIRTUALKEYBOARD_ENTER_SEND);
				break;
			case KEYCODE_O:
				// Display the phone layout with "Connect" enter key
				virtualkeyboard_change_options(VIRTUALKEYBOARD_LAYOUT_PHONE, VIRTUALKEYBOARD_ENTER_CONNECT);
				break;
			case KEYCODE_P:
				// Display the default layout with default enter key
				virtualkeyboard_change_options(VIRTUALKEYBOARD_LAYOUT_DEFAULT, VIRTUALKEYBOARD_ENTER_DEFAULT);
				break;
			case KEYCODE_H:
				// Hide the keyboard
				virtualkeyboard_hide();
				break;
			case KEYCODE_A:
				// Increment rotation angle
				angle = fmod(angle + ANGLE_INCREMENT, CIRCLE_DEGREES );
				break;
			case KEYCODE_Z:
				// Decrement rotation angle
				angle = fmod(angle - ANGLE_INCREMENT, CIRCLE_DEGREES );
				break;
			default:
				break;
			}
		}
		break;
	}
}
开发者ID:dtomilovskiy,项目名称:NDK-Samples,代码行数:49,代码来源:main.c

示例9: qnx_process_gamepad_event

static void qnx_process_gamepad_event(
      qnx_input_t *qnx,
      screen_event_t screen_event, int type)
{
   int i;
   screen_device_t device;
   qnx_input_device_t* controller = NULL;
   uint64_t *state_cur            = NULL;

   (void)type;

   screen_get_event_property_pv(screen_event,
         SCREEN_PROPERTY_DEVICE, (void**)&device);

   for (i = 0; i < MAX_PADS; ++i)
   {
      if (device == qnx->devices[i].handle)
      {
         controller = (qnx_input_device_t*)&qnx->devices[i];
         break;
      }
   }

   if (!controller)
      return;

   /* Store the controller's new state. */
   screen_get_event_property_iv(screen_event,
         SCREEN_PROPERTY_BUTTONS, &controller->buttons);

   if (controller->analogCount > 0)
   {
      screen_get_event_property_iv(screen_event,
            SCREEN_PROPERTY_ANALOG0, controller->analog0);

      controller->analog0[0] *= 256;
      controller->analog0[1] *= 256;

       if (controller->analogCount == 2)
       {
          screen_get_event_property_iv(screen_event,
                SCREEN_PROPERTY_ANALOG1, controller->analog1);

          controller->analog1[0] *= 256;
          controller->analog1[1] *= 256;
       }
   }
}
开发者ID:arakerlu,项目名称:RetroArch,代码行数:48,代码来源:qnx_input.c

示例10: bps_get_event

bool ScreenWindow::pollEvent(WinEvent *event)
{
	bps_event_t *bpsEvent;
	bps_get_event(&bpsEvent, 0);
	if (bpsEvent) {
		int domain = bps_event_get_domain(bpsEvent);
		if (domain == navigator_get_domain()) {
			if (bps_event_get_code(bpsEvent) == NAVIGATOR_EXIT) {
				event->type = QUIT;
				return true;
			}
		} else if (domain == screen_get_domain()) {
			screen_event_t se = screen_event_get_event(bpsEvent);
			int type;
			screen_get_event_property_iv(se, SCREEN_PROPERTY_TYPE, &type);
			if (type == SCREEN_EVENT_CLOSE) {
				event->type = QUIT;
				return true;
			} else if (type == SCREEN_EVENT_MTOUCH_TOUCH) {
				event->type = MOUSEBUTTONDOWN;
				return true;
			}
		}
	}
	return false;
}
开发者ID:asimonov-im,项目名称:reztest,代码行数:26,代码来源:ScreenWindow.cpp

示例11: handleScreenEvent

bool WindowGrabber::handleScreenEvent(screen_event_t screen_event)
{

    int eventType;
    if (screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_TYPE, &eventType) != 0) {
        qWarning() << "WindowGrabber: Failed to query screen event type";
        return false;
    }

    if (eventType != SCREEN_EVENT_CREATE)
        return false;

    screen_window_t window = 0;
    if (screen_get_event_property_pv(screen_event, SCREEN_PROPERTY_WINDOW, (void**)&window) != 0) {
        qWarning() << "WindowGrabber: Failed to query window property";
        return false;
    }

    const int maxIdStrLength = 128;
    char idString[maxIdStrLength];
    if (screen_get_window_property_cv(window, SCREEN_PROPERTY_ID_STRING, maxIdStrLength, idString) != 0) {
        qWarning() << "WindowGrabber: Failed to query window ID string";
        return false;
    }

    if (m_windowId == idString) {
        m_window = window;
        start();
    }

    return false;
}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:32,代码来源:windowgrabber.cpp

示例12: handleScreenEvent

void handleScreenEvent(bps_event_t *event) {
	screen_event_t screen_event = screen_event_get_event(event);

	int screen_val;
	screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_TYPE,
			&screen_val);

	mtouch_event_t mtouch_event;
	int rc = screen_get_mtouch_event(screen_event, &mtouch_event, 0);
	if (rc) {
		//fprintf(stderr, "Error: failed to get mtouch event\n");
	}

	p = points.begin();
	bool found;
	found = false;

	while (p != points.end()) {
		if (p->id == mtouch_event.contact_id) {
			found = true;
			break;
		}
		p++;
	}

	switch (screen_val) {
	case SCREEN_EVENT_MTOUCH_TOUCH:

		if (!found) {

			Touchpoint *tp = new Touchpoint(mtouch_event.x, mtouch_event.y,
					mtouch_event.contact_id);
			if(mtouch_event.contact_id<4){
				tp->setColor(colors[mtouch_event.contact_id][0],colors[mtouch_event.contact_id][1],colors[mtouch_event.contact_id][2]);
			}
			points.push_back(*tp);
			fprintf(stderr,"neuer touchpoint: %i Orientation: %i \n",mtouch_event.contact_id,tp->startRotation);
		} else {
			p->updatePosition(mtouch_event.x, mtouch_event.y);
		}

		break;
	case SCREEN_EVENT_MTOUCH_MOVE:

		if (found) {
			p->updatePosition(mtouch_event.x, mtouch_event.y);
		} else {
			fprintf(stderr, "ERROR: TOUCH POINT NOT FOUND\n");
		}
		break;
	case SCREEN_EVENT_MTOUCH_RELEASE:
		if (found) {
			p->setInvisible();
		} else {
			fprintf(stderr, "ERROR: TOUCH POINT NOT FOUND\n");
		}
		break;
	}
}
开发者ID:andrepura,项目名称:Multitouch,代码行数:59,代码来源:EventHandler.cpp

示例13: screen_event_get_event

int NativeWindow::screenDisplayAttached(bps_event_t *event, int *size)
{
    screen_display_t eventDisplay;
    int type;
    int attached = -1;

    screen_event_t screen_event = screen_event_get_event(event);

    //Query type of screen event and its location on the screen
    screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_TYPE,
            &type);

    _displaysMutex.lock();

    if (_screenDisplays) {
    	free (_screenDisplays);
    }

	// try this first as it will fail if an HDMI display is not attached
	screen_get_context_property_iv(_screenContext, SCREEN_PROPERTY_DISPLAY_COUNT, &_numberDisplays);

	_screenDisplays = (screen_display_t *)calloc(_numberDisplays, sizeof(screen_display_t));
	screen_get_context_property_pv(_screenContext, SCREEN_PROPERTY_DISPLAYS, (void **)_screenDisplays);

	switch (type) {
		case SCREEN_EVENT_DISPLAY:
			screen_get_event_property_pv(screen_event, SCREEN_PROPERTY_DISPLAY, (void **)&eventDisplay);
			for (int index = 0; index < _numberDisplays; index++) {
				if (eventDisplay == _screenDisplays[index]) {
					screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_ATTACHED, &attached);

					if (attached) {
						screen_get_display_property_iv(_screenDisplays[index], SCREEN_PROPERTY_SIZE, size);
						if (size[0] == 0 || size[1] == 0) {
							attached = 0;
						}
					}
				}
			}
			break;
	}

    _displaysMutex.unlock();

	return attached;
}
开发者ID:rsperanza,项目名称:libviews,代码行数:46,代码来源:NativeWindow.cpp

示例14: qnx_process_joystick_event

static void qnx_process_joystick_event(qnx_input_t *qnx, screen_event_t screen_event, int type)
{
    int displacement[2];
    screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_DISPLACEMENT, displacement);

    if(displacement != 0)
    {
        qnx->trackpad_acc[0] += displacement[0];
        if(abs(qnx->trackpad_acc[0]) > TRACKPAD_THRESHOLD)
        {
            if(qnx->trackpad_acc < 0)
            {
                input_keyboard_event(true, RETROK_LEFT, 0, 0, RETRO_DEVICE_KEYBOARD);
                input_keyboard_event(false, RETROK_LEFT, 0, 0, RETRO_DEVICE_KEYBOARD);
            }
            else if(qnx->trackpad_acc > 0)
            {
                input_keyboard_event(true, RETROK_RIGHT, 0, 0, RETRO_DEVICE_KEYBOARD);
                input_keyboard_event(false, RETROK_RIGHT, 0, 0, RETRO_DEVICE_KEYBOARD);
            }

            qnx->trackpad_acc[0] = 0;
        }

        qnx->trackpad_acc[1] += displacement[1];
        if(abs(qnx->trackpad_acc[1]) > TRACKPAD_THRESHOLD)
        {
            if(qnx->trackpad_acc < 0)
            {
                input_keyboard_event(true, RETROK_UP, 0, 0, RETRO_DEVICE_KEYBOARD);
                input_keyboard_event(false, RETROK_UP, 0, 0, RETRO_DEVICE_KEYBOARD);
            }
            else if(qnx->trackpad_acc > 0)
            {
                input_keyboard_event(true, RETROK_DOWN, 0, 0, RETRO_DEVICE_KEYBOARD);
                input_keyboard_event(false, RETROK_DOWN, 0, 0, RETRO_DEVICE_KEYBOARD);
            }

            qnx->trackpad_acc[1] = 0;
        }
    }

    int buttons = 0;
    screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_BUTTONS, &buttons);
    input_keyboard_event(buttons != 0, RETROK_RETURN, 0, 0, RETRO_DEVICE_KEYBOARD);
}
开发者ID:arakerlu,项目名称:RetroArch,代码行数:46,代码来源:qnx_input.c

示例15: handlePointerEvent

static void handlePointerEvent(screen_event_t event, screen_window_t window)
{
	int buttonState = 0;
	screen_get_event_property_iv(event, SCREEN_PROPERTY_BUTTONS, &buttonState);

	int coords[2];
	screen_get_event_property_iv(event, SCREEN_PROPERTY_SOURCE_POSITION, coords);

	int screen_coords[2];
	screen_get_event_property_iv(event, SCREEN_PROPERTY_POSITION, screen_coords);

	int wheel_delta;
	screen_get_event_property_iv(event, SCREEN_PROPERTY_MOUSE_WHEEL, &wheel_delta);

	if (coords[1] < 0) {
		fprintf(stderr, "Detected pointer swipe event: %d,%d\n", coords[0], coords[1]);
		return;
	}
	//fprintf(stderr, "Pointer: %d,(%d,%d),(%d,%d),%d\n", buttonState, coords[0], coords[1], screen_coords[0], screen_coords[1], wheel_delta);
	if (wheel_delta != 0) {
		int button;
		if ( wheel_delta > 0 )
			button = SDL_BUTTON_WHEELDOWN;
		else if ( wheel_delta < 0 )
			button = SDL_BUTTON_WHEELUP;
		SDL_PrivateMouseButton(
			SDL_PRESSED, button, 0, 0);
		SDL_PrivateMouseButton(
			SDL_RELEASED, button, 0, 0);
	}

	// FIXME: Pointer events have never been tested.
	static int lastButtonState = 0;
	if (lastButtonState == buttonState) {
		moveEvent.touching = buttonState;
		moveEvent.pos[0] = coords[0];
		moveEvent.pos[1] = coords[1];
		moveEvent.pending = 1;
		return;
	}
	lastButtonState = buttonState;

	SDL_PrivateMouseButton(buttonState ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_LEFT, coords[0], coords[1]); // FIXME: window
	moveEvent.pending = 0;
}
开发者ID:Thib1090,项目名称:SDL,代码行数:45,代码来源:SDL_playbookevents.c


注:本文中的screen_get_event_property_iv函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。