Rev 108 |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
package com.gebauz.pingK.common.game;
import com.gebauz.pingK.common.R;
import com.gebauz.pingK.common.framework.GLUtil;
import com.gebauz.pingK.common.framework.ResourceManager;
import com.gebauz.pingK.common.game.gamestates.GameStateManager;
import android.app.Activity;
import android.content.pm.ActivityInfo;
import android.graphics.PixelFormat;
import android.opengl.GLSurfaceView;
import android.os.Bundle;
import android.os.Handler;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.View.OnTouchListener;
import android.widget.LinearLayout;
public class GameActivity extends Activity //implements OnTouchListener
{
/* public static final String ADMOB_PUBLISHER_ID = "a14ea091b1a94ea";
private AdView mAdView;
private GLSurfaceView mGameView = null;
final Handler mHandler = new Handler();
// Create runnable for posting
final Runnable mUpdateResults = new Runnable() {
public void run() {
//TextView text = (TextView)findViewById(R.id.debug_text);
//text.setText(MultitouchInput.getInstance().getDebugText());
}
};*/
/** Called when the activity is first created. */
/* @Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
getWindow().setFormat(PixelFormat.TRANSLUCENT);
getWindow().setWindowAnimations(0);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
// Create the adView
mAdView = new AdView(this, AdSize.BANNER, ADMOB_PUBLISHER_ID);
// Lookup your LinearLayout assuming itÂ’s been given
// the attribute android:id="@+id/mainLayout"
LinearLayout layout = (LinearLayout)findViewById(R.id.adContainer);
// Add the adView to it
layout.addView(mAdView);
// Initiate a generic request to load it with an ad
mAdView.loadAd(new AdRequest());
mGameView = (GLSurfaceView)findViewById(R.id.glsurfaceview);
mGameView.setEGLConfigChooser(8, 8, 8, 8, 16, 0);
mGameView.setRenderer(new GameRenderer(this));
mGameView.setOnTouchListener(this);
// set landscape mode
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
// set the current context
ResourceManager.getInstance().setCurrentContext(this);
// queue initial game state
GameStateManager.getInstance().setContext(this);
GameStateManager.getInstance().switchState(getResources().getString(R.string.initial_state));
//Log.v("TEST", "i: " + R.integer.integer_name);
}
protected void onResume()
{
super.onResume();
mGameView.onResume();
}
protected void onPause()
{
super.onPause();
mGameView.onPause();
}
public boolean onTouch(View v, MotionEvent event)
{
MultitouchInput.getInstance().handleInput(event);
return true;
}*/
public void onSurfaceChanged(int w, int h)
{
/*GLUtil.getInstance().setWidth(w);
GLUtil.getInstance().setHeight(h);
MultitouchInput.getInstance().setVirtualScreenRatio(GameConsts.VIRTUAL_SCREEN_WIDTH / (float)w, GameConsts.VIRTUAL_SCREEN_HEIGHT / (float)h);
GameStateManager.getInstance().onSurfaceChanged(w, h);*/
}
public void update(float deltaTime)
{
/* // Fire off a thread to do some work that we shouldn't do directly in the UI thread
Thread t = new Thread()
{
public void run()
{
mHandler.post(mUpdateResults);
}
};
t.start();
GameStateManager.getInstance().update(deltaTime);
MultitouchInput.getInstance().update(deltaTime);*/
}
public void render()
{
/* GameStateManager.getInstance().render();
MultitouchInput.getInstance().render();*/
}
}