File: test_actions.c

package info (click to toggle)
gxr-openvr 0.15.1-2
  • links: PTS, VCS
  • area: contrib
  • in suites: bookworm, bullseye
  • size: 1,724 kB
  • sloc: ansic: 15,256; sh: 72; xml: 71; awk: 35; makefile: 19
file content (63 lines) | stat: -rw-r--r-- 1,284 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
 * gxr
 * Copyright 2018 Collabora Ltd.
 * Author: Lubosz Sarnecki <lubosz.sarnecki@collabora.com>
 * SPDX-License-Identifier: MIT
 */

#include <glib.h>
#include <gulkan.h>
#include "gxr.h"

static void
_test_load_action_manifest ()
{
  GxrContext *context = gxr_context_new (GXR_APP_SCENE, "Test Actions", 1);
  g_assert_nonnull (context);

  GulkanClient *gc = gulkan_client_new ();
  g_assert_nonnull (gc);

  if (gxr_context_get_api (context) == GXR_API_OPENVR)
  {
    if (!gxr_context_load_action_manifest (
      context,
      "xrdesktop.openvr",
      "/res/bindings/openvr",
      "actions.json",
      "bindings_vive_controller.json",
      "bindings_knuckles_controller.json",
      NULL))
    {
      g_print ("Failed to load action bindings!\n");
      return;
    }
  }
  else
  {
    {
      if (!gxr_context_load_action_manifest (
        context,
        "xrdesktop.openxr",
        "/res/bindings/openxr",
        "actions.json",
        "bindings_khronos_simple_controller.json",
        "bindings_valve_index_controller.json",
        NULL))
      {
        g_print ("Failed to load action bindings!\n");
        return;
      }
    }
  }

  g_object_unref (context);
}

int
main ()
{
  _test_load_action_manifest ();
  gxr_backend_shutdown ();
  return 0;
}