bastd.ui.settings.vrtesting

Provides UI for testing vr settings.

 1# Released under the MIT License. See LICENSE for details.
 2#
 3"""Provides UI for testing vr settings."""
 4
 5from __future__ import annotations
 6
 7from typing import TYPE_CHECKING
 8
 9import ba
10from bastd.ui.settings.testing import TestingWindow
11
12if TYPE_CHECKING:
13    from typing import Any
14
15
16class VRTestingWindow(TestingWindow):
17    """Window for testing vr settings."""
18
19    def __init__(self, transition: str = 'in_right'):
20
21        entries: list[dict[str, Any]] = []
22        app = ba.app
23        # these are gear-vr only
24        if app.platform == 'android' and app.subplatform == 'oculus':
25            entries += [
26                {
27                    'name': 'timeWarpDebug',
28                    'label': 'Time Warp Debug',
29                    'increment': 1.0,
30                },
31                {
32                    'name': 'chromaticAberrationCorrection',
33                    'label': 'Chromatic Aberration Correction',
34                    'increment': 1.0,
35                },
36                {
37                    'name': 'vrMinimumVSyncs',
38                    'label': 'Minimum Vsyncs',
39                    'increment': 1.0,
40                },
41                # {'name':'eyeOffsX','label':'Eye IPD','increment':0.001}
42            ]
43        # cardboard/gearvr get eye offset controls..
44        # if app.platform == 'android':
45        #     entries += [
46        #         {'name':'eyeOffsY','label':'Eye Offset Y','increment':0.01},
47        #         {'name':'eyeOffsZ','label':'Eye Offset Z','increment':0.005}]
48        # everyone gets head-scale
49        entries += [
50            {'name': 'headScale', 'label': 'Head Scale', 'increment': 1.0}
51        ]
52        # and everyone gets all these..
53        entries += [
54            {
55                'name': 'vrCamOffsetY',
56                'label': 'In-Game Cam Offset Y',
57                'increment': 0.1,
58            },
59            {
60                'name': 'vrCamOffsetZ',
61                'label': 'In-Game Cam Offset Z',
62                'increment': 0.1,
63            },
64            {
65                'name': 'vrOverlayScale',
66                'label': 'Overlay Scale',
67                'increment': 0.025,
68            },
69            {
70                'name': 'allowCameraMovement',
71                'label': 'Allow Camera Movement',
72                'increment': 1.0,
73            },
74            {
75                'name': 'cameraPanSpeedScale',
76                'label': 'Camera Movement Speed',
77                'increment': 0.1,
78            },
79            {
80                'name': 'showOverlayBounds',
81                'label': 'Show Overlay Bounds',
82                'increment': 1,
83            },
84        ]
85
86        super().__init__(
87            ba.Lstr(resource='settingsWindowAdvanced.vrTestingText'),
88            entries,
89            transition,
90        )
class VRTestingWindow(bastd.ui.settings.testing.TestingWindow):
17class VRTestingWindow(TestingWindow):
18    """Window for testing vr settings."""
19
20    def __init__(self, transition: str = 'in_right'):
21
22        entries: list[dict[str, Any]] = []
23        app = ba.app
24        # these are gear-vr only
25        if app.platform == 'android' and app.subplatform == 'oculus':
26            entries += [
27                {
28                    'name': 'timeWarpDebug',
29                    'label': 'Time Warp Debug',
30                    'increment': 1.0,
31                },
32                {
33                    'name': 'chromaticAberrationCorrection',
34                    'label': 'Chromatic Aberration Correction',
35                    'increment': 1.0,
36                },
37                {
38                    'name': 'vrMinimumVSyncs',
39                    'label': 'Minimum Vsyncs',
40                    'increment': 1.0,
41                },
42                # {'name':'eyeOffsX','label':'Eye IPD','increment':0.001}
43            ]
44        # cardboard/gearvr get eye offset controls..
45        # if app.platform == 'android':
46        #     entries += [
47        #         {'name':'eyeOffsY','label':'Eye Offset Y','increment':0.01},
48        #         {'name':'eyeOffsZ','label':'Eye Offset Z','increment':0.005}]
49        # everyone gets head-scale
50        entries += [
51            {'name': 'headScale', 'label': 'Head Scale', 'increment': 1.0}
52        ]
53        # and everyone gets all these..
54        entries += [
55            {
56                'name': 'vrCamOffsetY',
57                'label': 'In-Game Cam Offset Y',
58                'increment': 0.1,
59            },
60            {
61                'name': 'vrCamOffsetZ',
62                'label': 'In-Game Cam Offset Z',
63                'increment': 0.1,
64            },
65            {
66                'name': 'vrOverlayScale',
67                'label': 'Overlay Scale',
68                'increment': 0.025,
69            },
70            {
71                'name': 'allowCameraMovement',
72                'label': 'Allow Camera Movement',
73                'increment': 1.0,
74            },
75            {
76                'name': 'cameraPanSpeedScale',
77                'label': 'Camera Movement Speed',
78                'increment': 0.1,
79            },
80            {
81                'name': 'showOverlayBounds',
82                'label': 'Show Overlay Bounds',
83                'increment': 1,
84            },
85        ]
86
87        super().__init__(
88            ba.Lstr(resource='settingsWindowAdvanced.vrTestingText'),
89            entries,
90            transition,
91        )

Window for testing vr settings.

VRTestingWindow(transition: str = 'in_right')
20    def __init__(self, transition: str = 'in_right'):
21
22        entries: list[dict[str, Any]] = []
23        app = ba.app
24        # these are gear-vr only
25        if app.platform == 'android' and app.subplatform == 'oculus':
26            entries += [
27                {
28                    'name': 'timeWarpDebug',
29                    'label': 'Time Warp Debug',
30                    'increment': 1.0,
31                },
32                {
33                    'name': 'chromaticAberrationCorrection',
34                    'label': 'Chromatic Aberration Correction',
35                    'increment': 1.0,
36                },
37                {
38                    'name': 'vrMinimumVSyncs',
39                    'label': 'Minimum Vsyncs',
40                    'increment': 1.0,
41                },
42                # {'name':'eyeOffsX','label':'Eye IPD','increment':0.001}
43            ]
44        # cardboard/gearvr get eye offset controls..
45        # if app.platform == 'android':
46        #     entries += [
47        #         {'name':'eyeOffsY','label':'Eye Offset Y','increment':0.01},
48        #         {'name':'eyeOffsZ','label':'Eye Offset Z','increment':0.005}]
49        # everyone gets head-scale
50        entries += [
51            {'name': 'headScale', 'label': 'Head Scale', 'increment': 1.0}
52        ]
53        # and everyone gets all these..
54        entries += [
55            {
56                'name': 'vrCamOffsetY',
57                'label': 'In-Game Cam Offset Y',
58                'increment': 0.1,
59            },
60            {
61                'name': 'vrCamOffsetZ',
62                'label': 'In-Game Cam Offset Z',
63                'increment': 0.1,
64            },
65            {
66                'name': 'vrOverlayScale',
67                'label': 'Overlay Scale',
68                'increment': 0.025,
69            },
70            {
71                'name': 'allowCameraMovement',
72                'label': 'Allow Camera Movement',
73                'increment': 1.0,
74            },
75            {
76                'name': 'cameraPanSpeedScale',
77                'label': 'Camera Movement Speed',
78                'increment': 0.1,
79            },
80            {
81                'name': 'showOverlayBounds',
82                'label': 'Show Overlay Bounds',
83                'increment': 1,
84            },
85        ]
86
87        super().__init__(
88            ba.Lstr(resource='settingsWindowAdvanced.vrTestingText'),
89            entries,
90            transition,
91        )
Inherited Members
ba.ui.Window
get_root_widget