私はゲームMrSnakeyを試しています。実行してもエラーは発生しません。ただし、エミュレータを起動すると、エミュレータは黒い画面を表示します。あなたはそれを解決する方法を知らないのですか?この問題を解決するために必要な私のプロジェクトに関する情報はもうありません。ここに投稿することを教えてください。
まず、マニフェストファイル
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.zardtechnologies.androidgames.mrsnakey"
android:versionCode="1"
android:versionName="1.0" >
<application
androidicon="@drawable/icon"
android:debuggable="true"
android:label="Mr. Snakey" >
<activity
android:name=".MrSnakeyActivity"
android:configChanges="keyboard|keyboardHidden|orientation"
android:label="Mr. Snakey"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-sdk
android:minSdkVersion="3"
android:targetSdkVersion="12" />
</manifest>
第二に、MrSnakeyActivity
package com.zardtechnologies.androidgames.mrsnakey;
import com.zardtechnologies.framework.Screen;
import com.zardtechnologies.framework.impl.AndroidGame;
public class MrSnakeyActivity extends AndroidGame {
public Screen getStartScreen() {
return new LoadingScreen(this);
}
}
第三に、MrSnakeyActivityからリンクされているAndroidGameアクティビティ
package com.zardtechnologies.androidgames.mrsnakey;
import android.app.Activity;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.os.Bundle;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.view.Window;
import android.view.WindowManager;
import com.zardtechnologies.framework.Audio;
import com.zardtechnologies.framework.FileIO;
import com.zardtechnologies.framework.Game;
import com.zardtechnologies.framework.Graphics;
import com.zardtechnologies.framework.Input;
import com.zardtechnologies.framework.Screen;
public abstract class AndroidGame extends Activity implements Game {
AndroidFastRenderView renderView;
Graphics graphics;
Audio audio;
Input input;
FileIO fileIO;
Screen screen;
WakeLock wakeLock;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
boolean isLandscape = getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;
int frameBufferWidth = isLandscape ? 480 : 320;
int frameBufferHeight = isLandscape ? 320 : 480;
Bitmap frameBuffer = Bitmap.createBitmap(frameBufferWidth,
frameBufferHeight, Config.RGB_565);
float scaleX = (float) frameBufferWidth
/ getWindowManager().getDefaultDisplay().getWidth();
float scaleY = (float) frameBufferHeight
/ getWindowManager().getDefaultDisplay().getHeight();
renderView = new AndroidFastRenderView(this, frameBuffer);
graphics = new AndroidGraphics(getAssets(), frameBuffer);
fileIO = new AndroidFileIO(getAssets());
audio = new AndroidAudio(this);
input = new AndroidInput(this, renderView, scaleX, scaleY);
screen = getStartScreen();
setContentView(renderView);
PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
wakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK, "GLGame");
}
@Override
public void onResume() {
super.onResume();
wakeLock.acquire();
screen.resume();
renderView.resume();
}
@Override
public void onPause() {
super.onPause();
wakeLock.release();
renderView.pause();
screen.pause();
if (isFinishing())
screen.dispose();
}
public Input getInput() {
return input;
}
public FileIO getFileIO() {
return fileIO;
}
public Graphics getGraphics() {
return graphics;
}
public Audio getAudio() {
return audio;
}
public void setScreen(Screen screen) {
if (screen == null)
throw new IllegalArgumentException("Screen must not be null");
this.screen.pause();
this.screen.dispose();
screen.resume();
screen.update(0);
this.screen = screen;
}
public Screen getCurrentScreen() {
return screen;
}
}
アプリが黒い画面として表示される原因がわからないため、さらにどのような情報が必要かわかりません。ああ、コンソールログ:
[2012-04-29 14:24:54 - MrSnakey] Android Launch!
[2012-04-29 14:24:54 - MrSnakey] adb is running normally.
[2012-04-29 14:24:54 - MrSnakey] Performing com.zardtechnologies.androidgames.mrsnakey.MrSnakeyActivity activity launch
[2012-04-29 14:24:54 - MrSnakey] Automatic Target Mode: using existing emulator 'emulator-5554' running compatible AVD 'Test.Phone'
[2012-04-29 14:24:54 - MrSnakey] Uploading MrSnakey.apk onto device 'emulator-5554'
[2012-04-29 14:24:55 - MrSnakey] Installing MrSnakey.apk...
[2012-04-29 14:25:20 - MrSnakey] Success!
[2012-04-29 14:25:20 - MrSnakey] Project dependency found, installing: AndroidGamesFramework
[2012-04-29 14:25:22 - AndroidGamesFramework] Application already deployed. No need to reinstall.
[2012-04-29 14:25:22 - MrSnakey] Project dependency found, installing: AndroidGamesFrameworkImplementation
[2012-04-29 14:25:24 - AndroidGamesFrameworkImplementation] Application already deployed. No need to reinstall.
[2012-04-29 14:25:24 - AndroidGamesFrameworkImplementation] Project dependency found, installing: AndroidGamesFramework
[2012-04-29 14:25:26 - AndroidGamesFramework] Application already deployed. No need to reinstall.
[2012-04-29 14:25:26 - MrSnakey] Starting activity com.zardtechnologies.androidgames.mrsnakey.MrSnakeyActivity on device emulator-5554
[2012-04-29 14:25:28 - MrSnakey] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.zardtechnologies.androidgames.mrsnakey/.MrSnakeyActivity }
エラーはありません。このアプリは、ゲームに参加できないというだけで、完全に正常に機能すると思います。黒い画面の問題を解決するのを手伝ってください。もう情報が必要な場合は、教えてください。ここに投稿します。ありがとう