• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ screen_get_event_property_iv函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: event

static void event(bps_event_t *event, int domain, int code, void *data)
{
  if(domain == screen_get_domain())
  {
    screen_event_t screenEvent = screen_event_get_event(event);

    int eventType;
    screen_get_event_property_iv(screenEvent, SCREEN_PROPERTY_TYPE, &eventType);

    if(eventType == SCREEN_EVENT_MTOUCH_TOUCH/* || eventType == SCREEN_EVENT_MTOUCH_MOVE*/)
    {
      int pair[2];
      screen_get_event_property_iv(screenEvent, SCREEN_PROPERTY_SOURCE_POSITION, pair);

      Game::OnScreenTouch(pair[0], pair[1]);
    }
  }
}
开发者ID:Lisoph,项目名称:FlappyQuendrim,代码行数:18,代码来源:main.cpp


示例17: handleKeyboardEvent

static void handleKeyboardEvent(screen_event_t event)
{
	static const int KEYBOARD_TYPE_MASK = 0x20;
    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);

	int shifted = 0;
	SDL_keysym keysym;
    if (flags & KEYBOARD_TYPE_MASK) {
    	if (!TranslateBluetoothKeyboard(sym, modifiers, flags, scan, cap, &keysym))
    	{
    		return; // No translation
    	}
    } else {
		shifted = TranslateVKB(sym, modifiers, flags, scan, cap, &keysym);
    }

    if (shifted) {
		SDL_keysym temp;
		temp.scancode = 42;
		temp.sym = SDLK_LSHIFT;
		SDL_PrivateKeyboard(SDL_PRESSED, &temp);
    }

    SDL_PrivateKeyboard((flags & 0x1)?SDL_PRESSED:SDL_RELEASED, &keysym);

    if (shifted) {
		SDL_keysym temp;
		temp.scancode = 42;
		temp.sym = SDLK_LSHIFT;
		SDL_PrivateKeyboard(SDL_RELEASED, &temp);
    }
}
开发者ID:Thib1090,项目名称:SDL,代码行数:41,代码来源:SDL_playbookevents.c


示例18: handle_screen_event

static void
handle_screen_event(bps_event_t *event)
{
    int screen_val;

    screen_event_t screen_event = screen_event_get_event(event);
    screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_TYPE, &screen_val);

    switch (screen_val) {
    case SCREEN_EVENT_MTOUCH_TOUCH:
        fprintf(stderr,"Touch event\n");
        touch = true;
        break;
    case SCREEN_EVENT_MTOUCH_MOVE:
        fprintf(stderr,"Move event\n");
        break;
    case SCREEN_EVENT_MTOUCH_RELEASE:
        fprintf(stderr,"Release event\n");
        break;
    case SCREEN_EVENT_CREATE:
        // in a more involved application, it may be wise to actually check the window name to ensure
        // that we are processing the viewfinder window here, and not some other window
        if (screen_get_event_property_pv(screen_event, SCREEN_PROPERTY_WINDOW, (void **)&vf_win) == -1) {
            perror("screen_get_event_property_pv(SCREEN_PROPERTY_WINDOW)");
        } else {
            fprintf(stderr,"viewfinder window found!\n");
            // mirror viewfinder if this is the front-facing camera
            int i = (shouldmirror?1:0);
            screen_set_window_property_iv(vf_win, SCREEN_PROPERTY_MIRROR, &i);
            // place viewfinder in front of the black application background window.
            // note that a child window's ZORDER is relative to it's parent.
            // if we wanted to draw a UI on the application window, we could place the
            // viewfinder behind it and rely on transparency.  or alternately, another
            // child window could be overlaid on top of the viewfinder.
            i = +1;
            screen_set_window_property_iv(vf_win, SCREEN_PROPERTY_ZORDER, &i);
            // make viewfinder window visible
            i = 1;
            screen_set_window_property_iv(vf_win, SCREEN_PROPERTY_VISIBLE, &i);
            screen_flush_context(screen_ctx, 0);
            // we should now have a visible viewfinder
            // other things we could do here include rotating the viewfinder window (screen rotation),
            // or adjusting the size & position of the window.
            // some properties are immutable for security reasons since the window was actually created
            // in another process.  anything related to presentation should be modifiable.
            touch = false;
            state = STATE_VIEWFINDER;
        }
        break;
    default:
        break;
    }
}
开发者ID:BBDevGroupNL,项目名称:Presentations,代码行数:53,代码来源:takeburst.c


示例19: screen_get_event_property_iv

bool QQnxScreenEventHandler::handleEvent(screen_event_t event)
{
    // get the event type
    errno = 0;
    int qnxType;
    int result = screen_get_event_property_iv(event, SCREEN_PROPERTY_TYPE, &qnxType);
    if (result) {
        qFatal("QQNX: failed to query event type, errno=%d", errno);
    }

    return handleEvent(event, qnxType);
}
开发者ID:crobertd,项目名称:qtbase,代码行数:12,代码来源:qqnxscreeneventhandler.cpp


示例20: 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_MTOUCH_TOUCH:
    case SCREEN_EVENT_MTOUCH_MOVE:
    case SCREEN_EVENT_MTOUCH_RELEASE:
        break;
    }
}
开发者ID:lanixXx,项目名称:scratch,代码行数:13,代码来源:main.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ screen_init函数代码示例发布时间:2022-05-30
下一篇:
C++ screen_area函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap