我正在尝试构建一个2D游戏,现在我创建了主菜单后,所有这些供应我在加载主菜单时出现问题,每当我启动应用程序时,只出现黑屏并显示主菜单是不是我认为我已经完成了创建它们的步骤,但我无法弄清楚错误是什么,我希望你能帮助我
这是logcat
02-15 13:05:10.437: E/dalvikvm(4253): 4253 :: IS_UNIFIED_ARM_PROCESS=FALSE, debugFlags = 3
02-15 13:05:10.657: D/AndEngine(4253): MainGameActivity.onCreate @(Thread: 'main')
02-15 13:05:10.657: D/dalvikvm(4253): Trying to load lib /data/data/com.example.dgame/lib/libandengine.so 0xb3033500
02-15 13:05:10.657: D/dalvikvm(4253): Added shared lib /data/data/com.example.dgame/lib/libandengine.so 0xb3033500
02-15 13:05:10.657: D/dalvikvm(4253): No JNI_OnLoad found in /data/data/com.example.dgame/lib/libandengine.so 0xb3033500, skipping init
02-15 13:05:10.717: D/AndEngine(4253): MainGameActivity.onResume @(Thread: 'main')
02-15 13:05:10.747: D/libEGL(4253): egl.cfg not found, using default config
02-15 13:05:10.747: D/libEGL(4253): loaded /system/lib/egl/libGLES_bst.so
02-15 13:05:10.747: W/PGA(4253): eglGetProcAddress: "eglGetRenderBufferANDROID" not found
02-15 13:05:10.747: W/PGA(4253): eglGetProcAddress: "eglGetSystemTimeFrequencyNV" not found
02-15 13:05:10.747: W/PGA(4253): eglGetProcAddress: "eglGetSystemTimeNV" not found
02-15 13:05:10.777: I/PGA(4253): New SOCKET connection: m.example.dgame (pid 4253, tid 4270)
02-15 13:05:10.817: I/PGA(4253): New SOCKET connection: m.example.dgame (pid 4253, tid 4253)
02-15 13:05:10.997: D/AndEngine(4253): VERSION: OpenGL ES 2.0
02-15 13:05:10.997: D/AndEngine(4253): RENDERER: Bluestacks
02-15 13:05:10.997: D/AndEngine(4253): EGLCONFIG: EGLConfig(Red=5, Green=6, Blue=5, Alpha=0, Depth=0, Stencil=0)
02-15 13:05:10.997: D/AndEngine(4253): EXTENSIONS: GL_OES_EGL_image
GL_ARB_texture_non_power_of_two GL_OES_blend_func_separate
GL_OES_blend_equation_separate GL_OES_blend_subtract GL_OES_byte_coordinates
GL_OES_compressed_paletted_texture GL_OES_point_size_array GL_OES_point_sprite
GL_OES_single_precision GL_OES_stencil_wrap GL_OES_texture_env_crossbar GL_OES_texture_mirrored_repeat GL_OES_element_index_uint GL_OES_texture_cube_map GL_OES_draw_texture GL_OES_framebuffer_object GL_OES_depth24 GL_OES_depth32 GL_OES_fbo_render_mipmap GL_OES_rgb8_rgba8 GL_OES_stencil1 GL_OES_stencil4 GL_OES_stencil8 GL_OES_packed_depth_stencil GL_EXT_texture_format_BGRA8888 GL_APPLE_texture_format_BGRA8888 GL_OES_compressed_ETC1_RGB8_texture
02-15 13:05:10.997: D/AndEngine(4253): MAX_VERTEX_ATTRIBS: 16
02-15 13:05:10.997: D/AndEngine(4253): MAX_VERTEX_UNIFORM_VECTORS: 256
02-15 13:05:10.997: D/AndEngine(4253): MAX_FRAGMENT_UNIFORM_VECTORS: 256
02-15 13:05:10.997: D/AndEngine(4253): MAX_TEXTURE_IMAGE_UNITS: 32
02-15 13:05:10.997: D/AndEngine(4253): MAX_TEXTURE_SIZE: 8192
02-15 13:05:10.997: D/AndEngine(4253): MainGameActivity.onSurfaceCreated @(Thread: 'GLThread 121')
02-15 13:05:10.997: D/AndEngine(4253): MainGameActivity.onCreateGame @(Thread: 'GLThread 121')
02-15 13:05:11.017: D/AndEngine(4253): MainGameActivity.onCreateResources @(Thread: 'GLThread 121')
02-15 13:05:11.027: D/AndEngine(4253): MainGameActivity.onSurfaceChanged(Width=1066, Height=552) @(Thread: 'GLThread 121')
02-15 13:05:28.407: E/dalvikvm(4253): No JIT support for bytecode f0 at offsetPC 0
02-15 13:05:28.407: E/dalvikvm(4253): JIT implementation not found
02-15 13:05:28.407: I/dalvikvm(4253): codeGenBasicBlockJit returns negative number
02-15 13:05:47.557: D/AndEngine(4253): MainGameActivity.onPause @(Thread: 'main')
02-15 13:05:49.857: D/AndEngine(4253): MainGameActivity.onResume @(Thread: 'main')
02-15 13:05:49.917: D/AndEngine(4253): VERSION: OpenGL ES 2.0
02-15 13:05:49.917: D/AndEngine(4253): RENDERER: Bluestacks
02-15 13:05:49.917: D/AndEngine(4253): EGLCONFIG: EGLConfig(Red=5, Green=6, Blue=5, Alpha=0, Depth=0, Stencil=0)
02-15 13:05:49.917: D/AndEngine(4253): EXTENSIONS: GL_OES_EGL_image GL_ARB_texture_non_power_of_two GL_OES_blend_func_separate GL_OES_blend_equation_separate GL_OES_blend_subtract GL_OES_byte_coordinates GL_OES_compressed_paletted_texture GL_OES_point_size_array GL_OES_point_sprite GL_OES_single_precision GL_OES_stencil_wrap GL_OES_texture_env_crossbar GL_OES_texture_mirrored_repeat GL_OES_element_index_uint GL_OES_texture_cube_map GL_OES_draw_texture GL_OES_framebuffer_object GL_OES_depth24 GL_OES_depth32 GL_OES_fbo_render_mipmap GL_OES_rgb8_rgba8 GL_OES_stencil1 GL_OES_stencil4 GL_OES_stencil8 GL_OES_packed_depth_stencil GL_EXT_texture_format_BGRA8888 GL_APPLE_texture_format_BGRA8888 GL_OES_compressed_ETC1_RGB8_texture
02-15 13:05:49.917: D/AndEngine(4253): MAX_VERTEX_ATTRIBS: 16
02-15 13:05:49.917: D/AndEngine(4253): MAX_VERTEX_UNIFORM_VECTORS: 256
02-15 13:05:49.917: D/AndEngine(4253): MAX_FRAGMENT_UNIFORM_VECTORS: 256
02-15 13:05:49.917: D/AndEngine(4253): MAX_TEXTURE_IMAGE_UNITS: 32
02-15 13:05:49.917: D/AndEngine(4253): MAX_TEXTURE_SIZE: 8192
这是mainmenu.java
package com.example.dgame;
import org.andengine.engine.camera.Camera;
import org.andengine.entity.scene.menu.MenuScene;
import org.andengine.entity.scene.menu.MenuScene.IOnMenuItemClickListener;
import org.andengine.entity.scene.menu.item.IMenuItem;
import org.andengine.entity.scene.menu.item.SpriteMenuItem;
import org.andengine.entity.scene.menu.item.decorator.ScaleMenuItemDecorator;
import org.andengine.entity.sprite.Sprite;
import org.andengine.opengl.util.GLState;
import com.example.dgame.SceneManager.SceneType;
public class MainMenu extends BaseScene implements IOnMenuItemClickListener{
private MenuScene menuChildScene;
private final int PLAY = 0;
@Override
public void createScene() {
// TODO Auto-generated method stub
this.attachChild(new Sprite(0,0,resourceManager.mainMenuBackground,vbom){
@Override
protected void preDraw(GLState pGLState, Camera pCamera){
super.preDraw(pGLState, pCamera);
pGLState.enableDither();
}
});
}
@Override
public void onBackPressed() {
// TODO Auto-generated method stub
}
@Override
public SceneType getSceneType() {
// TODO Auto-generated method stub
return null;
}
@Override
public void disposeScene() {
// TODO Auto-generated method stub
}
private void createMenuScene(){
this.menuChildScene = new MenuScene(camera);
this.menuChildScene.setPosition(0, 0);
final IMenuItem playMenuItem = new ScaleMenuItemDecorator(new
SpriteMenuItem(this.PLAY,resourceManager.playButton,vbom),1.2f,1);
this.menuChildScene.addMenuItem(playMenuItem);
menuChildScene.buildAnimations();
menuChildScene.setBackgroundEnabled(false);
menuChildScene.setOnMenuItemClickListener(this);
this.setChildScene(menuChildScene, false, true, true);
}
@Override
public boolean onMenuItemClicked(MenuScene pMenuScene, IMenuItem pMenuItem,
float pMenuItemLocalX, float pMenuItemLocalY) {
switch(pMenuItem.getID()){
case PLAY:
//load game
return true;
default:
return false;
}
}
}
这是maingameactivity.java
package com.example.dgame;
import org.andengine.engine.Engine;
import org.andengine.engine.LimitedFPSEngine;
import org.andengine.engine.camera.BoundCamera;
import org.andengine.engine.options.EngineOptions;
import org.andengine.engine.options.ScreenOrientation;
import org.andengine.engine.options.resolutionpolicy.FillResolutionPolicy;
import org.andengine.entity.scene.Scene;
import org.andengine.ui.activity.BaseGameActivity;
public class MainGameActivity extends BaseGameActivity {
private BoundCamera camera;
private float WIDTH = 800;
private float HEIGHT = 480;
@Override
public Engine onCreateEngine(EngineOptions engineOptions){
return new LimitedFPSEngine(engineOptions,60);
}
@Override
public EngineOptions onCreateEngineOptions() {
camera = new BoundCamera(0,0,WIDTH,HEIGHT);
EngineOptions engineOptions = new
EngineOptions(true,ScreenOrientation.LANDSCAPE_FIXED,new FillResolutionPolicy(),camera);