混合的Andr​​oid浏览和GLSurfaceView [英] Mixing Android Views and GLSurfaceView

查看:101
本文介绍了混合的Andr​​oid浏览和GLSurfaceView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前工作的一个比赛,我不想让一半,如果发现我在做什么原因的错误/杀死性能。这就是我想设置它的。

I'm currently working on a game and I would hate to get halfway through and find that the what I'm doing causes errors/kills performance. This is how I'm thinking of setting it up.

首先希望有与含有平视显示器,并且然后一个GLSurfaceView一个的LinearLayout一个的LinearLayout。不过,我可能会在某些点暂停比赛视图,切换到不同的线性布局包含库存或装备等。

First want to have a LinearLayout with a LinearLayout containing a HUD, and then a GLSurfaceView. However I may at certain points "pause" the game view and switch to a different linear layout containing an inventory or equips, etc.

我觉得这种方式是最好的,因为我可以利用所有的Andr​​oid自带有,而不是让我自己用OpenGL伟大的组件。不过,我很担心,混合两种观点可能有一些问题。任何见解或建议,将不胜AP preciated。谢谢你。

I think this way would be best because I can make use of all the great components that android comes with rather than making my own with OpenGL. However I am worried that mixing the two types of view may have some problems. Any insight or suggestions would be greatly appreciated. Thanks.

推荐答案

我一直在使用的GLSurfaceView一个的FrameLayout为第一要素。即在堆栈的底部,与其他次/ viewgroups上分层它的顶部。我建议你​​只是暂停游戏环,并把一些不透明的景色,它的顶部隐藏它,而不是交换意见进出或什么:

I've been using a FrameLayout with the GLSurfaceView as the first element. I.e. at the bottom of the stack, with other views / viewgroups layered over the top of it. I'd recommend just pausing the game-loop and placing some opaque view over the top of it to hide it rather than swapping views in and out or whatever:

<FrameLayout 
    android:id="@+id/graphics_frameLayout1" 
    android:layout_width="fill_parent" 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_height="fill_parent">
    <android.opengl.GLSurfaceView 
        android:id="@+id/graphics_glsurfaceview1" 
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent">
    </android.opengl.GLSurfaceView>
    <LinearLayout 
        android:layout_height="fill_parent" 
        android:id="@+id/inventory" 
        android:gravity="center" 
        android:layout_width="fill_parent" 
        android:orientation="vertical"
        android:visibility="gone">
    </LinearLayout>
    <LinearLayout 
        android:layout_height="fill_parent" 
        android:id="@+id/HUD" 
        android:gravity="center" 
        android:layout_width="fill_parent" 
        android:orientation="vertical">
    </LinearLayout>
</FrameLayout>

这篇关于混合的Andr​​oid浏览和GLSurfaceView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆