我有AndEngine GLES2的问题.
我有这个代码:
Sprite black = new Sprite(0,0, blackRegion, this.getVertexBufferObjectManager());
black.setSize(CAMERA_WIDTH, CAMERA_HEIGHT);
black.registerEntityModifier(new AlphaModifier(2, 0, 255));
mScene.attachChild(black);
Run Code Online (Sandbox Code Playgroud)
所以它不起作用.什么都没有......
我需要做什么?
我正在开发(学习构建:))与andengine GLES2的游戏.我正在使用Base游戏活动,并且我会覆盖setContent视图以放置我的admob广告.
除了解决方案政策外,每件事情都可以.
比率解析策略是我使用的CAMERA_WIDTH = 800; 和CAMERA_HEIGHT = 480;
问题是,只要覆盖invoiceContentView 场景没有对齐到中心,边距只显示在底部而不是顶部和底部,同样会导致水平对齐时边距将仅显示在右侧,而不是两侧.我怎么能纠正这个.我在下面给出我的代码
@Override
protected void onSetContentView() {
System.out.println("Content setting");
this.mRenderSurfaceView = new RenderSurfaceView(this);
final LayoutParams layoutParams = new LayoutParams(
android.view.ViewGroup.LayoutParams.MATCH_PARENT,
android.view.ViewGroup.LayoutParams.MATCH_PARENT);
layoutParams.gravity = Gravity.LEFT ;
final android.widget.FrameLayout.LayoutParams surfaceViewLayoutParams = new FrameLayout.LayoutParams(
layoutParams);
adView = new AdView(this, AdSize.BANNER, "xxxxxxxxxxxxx");
final FrameLayout.LayoutParams adViewLayoutParams = new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.WRAP_CONTENT,
FrameLayout.LayoutParams.WRAP_CONTENT, Gravity.LEFT
);
final FrameLayout frameLayout = new FrameLayout(this);
final FrameLayout.LayoutParams frameLayoutLayoutParams = new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.FILL_PARENT,
FrameLayout.LayoutParams.FILL_PARENT,Gravity.CENTER);
frameLayout.addView(this.mRenderSurfaceView, surfaceViewLayoutParams); …
Run Code Online (Sandbox Code Playgroud) 我使用AndEngine-GLES2-AnchorCenter,我希望实现Google Play游戏服务.
我在同一个软件包中复制BaseGameActivity
并GameHelper
从BaseGameUtils
(Google Play游戏服务的一部分 - Android示例)中分类到我的项目util
.
因为AndEngine已经使用了BaseGameActivity
,我将它重命名为GBaseGameActivity
并将扩展类更改为BaseGameActivity(AndEngine类),所以从这里:
public abstract class BaseGameActivity extends FragmentActivity
Run Code Online (Sandbox Code Playgroud)
至:
public abstract class GBaseGameActivity extends BaseGameActivity
Run Code Online (Sandbox Code Playgroud)
然后我扩展了我的课程GBaseGameActivity
(当我扩展BaseGameActivity(AndEngine类)时,它的工作......但不是GBaseGameActivity(BaseGameUtils类))
public class BaseActivity extends GBaseGameActivity
Run Code Online (Sandbox Code Playgroud)
我尝试编译我的项目,但我得到了:
...
Could not find class 'com.xxx.xxx.util.GameHelper', referenced from method com.xxx.xxx.util.GBaseGameActivity.<init>
Could not find class 'com.xxx.xxx.util.GameHelper', referenced from method com.xxx.xxx.util.GBaseGameActivity.onCreate
FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.xxx.xxx.util.GameHelper
at com.xxx.xxx.util.GBaseGameActivity.<init>(GBaseGameActivity.java:63)
at com.xxx.xxx.BaseActivity.<init>(BaseActivity.java:35)
...
Run Code Online (Sandbox Code Playgroud)
GBaseGameActivity.java:63:
63| mHelper = new GameHelper(this);
Run Code Online (Sandbox Code Playgroud)
BaseActivity.java:35:
35| public class …
Run Code Online (Sandbox Code Playgroud) 我正在使用AndEngine GLES 2为Android编写游戏.一切都工作正常 - 我有一个背景图像,有精灵移动甚至一些音乐 - 直到最近我尝试了一些新的东西(我希望能够在两个不同的场景之间切换)当显示变黑.
我仍然可以执行游戏并且没有显示错误.我在游戏过程中显示的所有日志条目都显示出来,即使音乐正在播放,所以我知道游戏"正常"运行,但我看不到任何图像.没有.全黑.
所以我想,在出现这个"错误"之前将一切都改回来,就可以了.但屏幕仍然是黑色的.
我甚至尝试评论所有内容,但背景图片 - 没有.
现在,如果问的不是太多,请问任何人都可以查看这段简短的代码并告诉我那里有什么问题?
这是我使用的变量:
private SmoothCamera camera;
private BitmapTextureAtlas bitmapTextureAtlas;
private Scene scene;
private Sprite background;
Run Code Online (Sandbox Code Playgroud)
该EngineOptions我从来没有改变过,所以他们应该是好的.
@Override
public EngineOptions onCreateEngineOptions() {
float positionX = 80f; // horizontal (x) position of the camera
float positionY = 280f; // vertical (y) position of the camera
float velocityX = 200f; // velocity of the horizontal camera movement
float velocityY = 200f; // velocity of the vertical …
Run Code Online (Sandbox Code Playgroud) 我必须提供我的Android游戏的64位版本,该版本正在Google Play商店中使用AndEngine。AndEngine的官方github存储库未提供该库的64位版本。有谁知道如何将库转换为64位?我尝试添加以下内容:
APP_ABI := armeabi-v7a x86 x86_64 arm64-v8a
Run Code Online (Sandbox Code Playgroud)
行到“ Application.mk”文件并运行build.sh。不幸的是没有成功。
有人成功构建了64位版本的AndEngine吗?
我目前正在使用AndEngine GLES2 Center设置一个场景,我有以下疑问:我放置了背景,根据我的理解,使用这个新版本的AndEngine,精灵的位置应该相对于左下角.
但是如果我想将一个对象放在位置(x,y)并且我在FireWorks这样的编辑器中看到这样的位置并在Sprite参数中使用它,它将不会出现在编辑器中出现的相同位置.如何知道放置物体的正确位置?
谢谢!