Google cardBoard Android API (十一):HeadMountedDisplayManager

20 篇文章 0 订阅
18 篇文章 0 订阅
public class  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

Inherited Methods

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 throughupdateCardboardDeviceParams 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.
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值