コード例 #1
0
ファイル: qnx_input.c プロジェクト: CautiousAlbino/RetroArch
static void *qnx_input_init(void)
{
   int i;
   qnx_input_t *qnx = (qnx_input_t*)calloc(1, sizeof(*qnx));
   if (!qnx)
      return NULL;

   for (i = 0; i < MAX_TOUCH; ++i)
   {
      qnx->pointer[i].contact_id = -1;
      qnx->touch_map[i] = -1;
   }

   qnx->joypad = input_joypad_init_driver(g_settings.input.joypad_driver);

   for (i = 0; i < MAX_PADS; ++i)
   {
      initController(qnx, &qnx->devices[i]);
      qnx->port_device[i] = 0;
   }

#ifdef HAVE_BB10
   /* Find currently connected gamepads. */
   discoverControllers(qnx);
#else
   /* Initialize Playbook keyboard. */
   strlcpy(qnx->devices[0].id, "0A5C-8502",
         sizeof(qnx->devices[0].id));
   qnx_input_autodetect_gamepad(qnx, &qnx->devices[0], 0);
   qnx->pads_connected = 1;
#endif

   return qnx;
}
コード例 #2
0
ファイル: qnx_input.c プロジェクト: DonelBueno/iOS
//External Functions
static void *qnx_input_init(void)
{
   int i;
   static int initialized = 0;

   //Get screen dimensions
   if(gfx_ctx_bbqnx.get_video_size)
      gfx_ctx_bbqnx.get_video_size(&screen_width, &screen_height);

   if(initialized)
      return (void*)-1;

   for (i = 0; i < MAX_TOUCH; ++i)
   {
      touch[i].contact_id = -1;
      touch_map[i] = -1;
   }

   for (i = 0; i < MAX_PADS; ++i)
   {
      initController(&devices[i]);
      port_device[i] = 0;
   }
#ifdef HAVE_BB10
   //Find currently connected gamepads
   discoverControllers();
#else
   init_playbook_keyboard();
#endif

   initialized = 1;

   return (void*)-1;
}
コード例 #3
0
ファイル: main.c プロジェクト: dejanberry/NDK-Samples
int main(int argc, char **argv)
{
    // Create a screen context that will be used to create an EGL surface to receive libscreen events.
    SCREEN_API(screen_create_context(&_screen_ctx, SCREEN_APPLICATION_CONTEXT), "create_context");

    // Initialize BPS library.
    bps_initialize();

    // Use utility code to initialize EGL for rendering with GL ES 1.1.
    if (EXIT_SUCCESS != bbutil_init_egl(_screen_ctx)) {
        fprintf(stderr, "Unable to initialize EGL.\n");
        screen_destroy_context(_screen_ctx);
        return 0;
    }

    // Initialize app data.
    if (EXIT_SUCCESS != init()) {
        fprintf(stderr, "Unable to initialize app logic.\n");
        bbutil_terminate();
        screen_destroy_context(_screen_ctx);
        return 0;
    }

    // Signal BPS library that navigator and screen events will be requested.
    if (BPS_SUCCESS != screen_request_events(_screen_ctx)) {
        fprintf(stderr, "screen_request_events failed\n");
        bbutil_terminate();
        screen_destroy_context(_screen_ctx);
        return 0;
    }

    if (BPS_SUCCESS != navigator_request_events(0)) {
        fprintf(stderr, "navigator_request_events failed\n");
        bbutil_terminate();
        screen_destroy_context(_screen_ctx);
        return 0;
    }

    // Look for attached gamepad and joystick devices.
    discoverControllers();

    // Enter the event loop.
    while (!_shutdown) {
        update();

        render();
    }

    // Clean up resources and shut everything down.
    finalize();

    return 0;
}