Google cardBoard Android API(十一):HeadMountedDisplayManager
3187 ワード
public class
HeadMountedDisplayManager
Manages the initialization, updates and access to a
It initializes a
It makes sure that the
Public Constructors
HeadMountedDisplayManager(Context context)
Public Methods
HeadMountedDisplay
getHeadMountedDisplay()
void
onPause()
void
onResume()
boolean
updateCardboardDeviceParams(CardboardDeviceParams cardboardDeviceParams)
boolean
updateScreenParams(ScreenParams screenParams)
Inherited Methods
▸
From class java.lang.Object
Public Constructors
public HeadMountedDisplayManager (Context context)
Creates a new head mounted display manager from the given context.
Parameters
context
Current context.
Public Methods
public HeadMountedDisplay getHeadMountedDisplay ()
Returns the current head mounted display.
Updates to the returned object are discouraged and should instead be made through
Returns
the current head mounted display.
public void onPause ()
Informs the manager that the current activity has been paused.
Refer to
public void onResume ()
Informs the manager that the current activity has been resumed.
This is used by the manager to monitor if the
public boolean updateCardboardDeviceParams (CardboardDeviceParamscardboardDeviceParams)
Updates the cardboard device parameters used for rendering.
If the given parameters are different, then:
the current headset parameters are updated with the given ones.
the new parameters are persisted into the configuration file in external storage.
true is returned.
For more details on external storage's configuration file, refer to getConfigFile
The update is no-op if
Parameters
cardboardDeviceParams
the new cardboard device params.
Returns
whether the parameters were updated.
public boolean updateScreenParams (ScreenParams screenParams)
Updates the screen parameters used for rendering.
Parameters
screenParams
Parameters to update. Ignored if null.
Returns
whether the screen parameters were updated.
HeadMountedDisplayManager
Manages the initialization, updates and access to a
HeadMountedDisplay
. It initializes a
HeadMountedDisplay
using configuration files potentially located in external storage or in the asset folder of the application. It makes sure that the
CardboardDeviceParams
are correctly persisted in the external storage's configuration file so that other VRToolkit apps can access them. Public Constructors
HeadMountedDisplayManager(Context context)
Public Methods
HeadMountedDisplay
getHeadMountedDisplay()
void
onPause()
void
onResume()
boolean
updateCardboardDeviceParams(CardboardDeviceParams cardboardDeviceParams)
boolean
updateScreenParams(ScreenParams screenParams)
Inherited Methods
▸
From class java.lang.Object
Public Constructors
public HeadMountedDisplayManager (Context context)
Creates a new head mounted display manager from the given context.
Parameters
context
Current context.
Public Methods
public HeadMountedDisplay getHeadMountedDisplay ()
Returns the current head mounted display.
Updates to the returned object are discouraged and should instead be made through
updateCardboardDeviceParams
and updateScreenParams
to make sure they are correctly persisted if needed. Clients should avoid storing the returned HeadMountedDisplay
. Instead, they should always call this function to make sure they get the most up-to-date data. Returns
the current head mounted display.
public void onPause ()
Informs the manager that the current activity has been paused.
Refer to
onResume()
for more details. public void onResume ()
Informs the manager that the current activity has been resumed.
This is used by the manager to monitor if the
HeadMountedDisplay
should be updated. If this method is used, the corresponding onPause()
method must also be used to notify when the activity is paused. public boolean updateCardboardDeviceParams (CardboardDeviceParamscardboardDeviceParams)
Updates the cardboard device parameters used for rendering.
If the given parameters are different, then:
the current headset parameters are updated with the given ones.
the new parameters are persisted into the configuration file in external storage.
true is returned.
For more details on external storage's configuration file, refer to getConfigFile
The update is no-op if
cardboardDeviceParams
is null or equal to the current parameters. In both case, false is returned. Parameters
cardboardDeviceParams
the new cardboard device params.
Returns
whether the parameters were updated.
public boolean updateScreenParams (ScreenParams screenParams)
Updates the screen parameters used for rendering.
Parameters
screenParams
Parameters to update. Ignored if null.
Returns
whether the screen parameters were updated.