-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3359b89
commit b850a92
Showing
22 changed files
with
1,635 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
...src/main/java/edu/hzuapps/androidworks/homeworks/net1314080903208/FeiJi_BaseActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package skyward.com.myapplication; | ||
|
||
import android.app.Activity; | ||
import android.content.pm.ActivityInfo; | ||
import android.os.Bundle; | ||
import android.view.Window; | ||
import android.view.WindowManager; | ||
|
||
public class FeiJi_BaseActivity extends Activity { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
|
||
this.requestWindowFeature(Window.FEATURE_NO_TITLE); | ||
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, | ||
WindowManager.LayoutParams.FLAG_FULLSCREEN); | ||
this.getWindow().setFlags( | ||
WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, | ||
WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); | ||
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); | ||
|
||
} | ||
} |
73 changes: 73 additions & 0 deletions
73
app/src/main/java/edu/hzuapps/androidworks/homeworks/net1314080903208/FeiJi_Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package skyward.com.myapplication; | ||
|
||
import org.cocos2d.layers.CCScene; | ||
import org.cocos2d.nodes.CCDirector; | ||
import org.cocos2d.nodes.CCTextureCache; | ||
import org.cocos2d.opengl.CCGLSurfaceView; | ||
import org.cocos2d.types.ccColor4B; | ||
|
||
import com.baidu.mobstat.StatService; | ||
|
||
import android.os.Bundle; | ||
|
||
public class FeiJi_Main extends FeiJi_BaseActivity { | ||
|
||
private CCGLSurfaceView _FeiJi_Surface; | ||
private CCScene _FeiJi_Scene; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
_FeiJi_Surface = new CCGLSurfaceView(this); | ||
setContentView(_FeiJi_Surface); | ||
} | ||
|
||
@Override | ||
protected void onDestroy() { | ||
super.onDestroy(); | ||
CCDirector.sharedDirector().end(); | ||
CCTextureCache.sharedTextureCache().removeAllTextures(); | ||
} | ||
|
||
@Override | ||
protected void onPause() { | ||
super.onPause(); | ||
CCDirector.sharedDirector().pause(); | ||
StatService.onPause(this); | ||
} | ||
|
||
@Override | ||
protected void onResume() { | ||
super.onResume(); | ||
CCDirector.sharedDirector().resume(); | ||
StatService.onResume(this); | ||
} | ||
|
||
@Override | ||
protected void onStart() { | ||
super.onStart(); | ||
// cocos2d��ϰ�������½���Ϊԭ��,ʱ�䵥λ���� | ||
CCDirector.sharedDirector().attachInView(_FeiJi_Surface);// ��cocos2d����GLSurfaceView��������� | ||
// CCDirector.sharedDirector().setDeviceOrientation( | ||
// CCDirector.kCCDeviceOrientationLandscapeLeft); | ||
// CCDirector.sharedDirector().setDisplayFPS(true);//��ʾ FPS | ||
// CCDirector.sharedDirector().setAnimationInterval(1.0f / 60.0f);// | ||
// ÿ������� | ||
_FeiJi_Scene = CCScene.node(); | ||
|
||
FeiJi_PlayActivity _Layer = new FeiJi_PlayActivity(ccColor4B.ccc4(255, 255, 255, 255)); | ||
// _Layer.GetContext(FeiJi_Main.this); | ||
_FeiJi_Scene.addChild(_Layer); | ||
|
||
CCDirector.sharedDirector().runWithScene(_FeiJi_Scene);// ����� | ||
|
||
CCDirector.sharedDirector().pause(); | ||
} | ||
|
||
@Override | ||
protected void onStop() { | ||
// TODO Auto-generated method stub | ||
super.onStop(); | ||
CCDirector.sharedDirector().end(); | ||
} | ||
} |
78 changes: 78 additions & 0 deletions
78
...src/main/java/edu/hzuapps/androidworks/homeworks/net1314080903208/FeiJi_MenuActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package skyward.com.myapplication; | ||
|
||
import com.baidu.mobstat.StatService; | ||
|
||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.view.View; | ||
import android.view.View.OnClickListener; | ||
import android.widget.Button; | ||
|
||
public class FeiJi_MenuActivity extends FeiJi_BaseActivity { | ||
|
||
private Button _FeiJi_Button_New, _FeiJi_Button_Score, | ||
_FeiJi_Button_Exit; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.feiji_menu); | ||
Init(); | ||
} | ||
|
||
private void Init() { | ||
// TODO Auto-generated method stub | ||
_FeiJi_Button_New = (Button) findViewById(R.id.feiji_bu_new); | ||
_FeiJi_Button_Score = (Button) findViewById(R.id.feiji_bu_score); | ||
_FeiJi_Button_Exit = (Button) findViewById(R.id.feiji_bu_exit); | ||
|
||
_FeiJi_Button_New.setOnClickListener(new OnClick()); | ||
_FeiJi_Button_Score.setOnClickListener(new OnClick()); | ||
_FeiJi_Button_Exit.setOnClickListener(new OnClick()); | ||
} | ||
|
||
private class OnClick implements OnClickListener { | ||
|
||
@Override | ||
public void onClick(View v) { | ||
// TODO Auto-generated method stub | ||
switch (v.getId()) { | ||
case R.id.feiji_bu_new: | ||
Intent intent = new Intent(FeiJi_MenuActivity.this, FeiJi_Main.class); | ||
startActivity(intent); | ||
finish(); | ||
break; | ||
|
||
case R.id.feiji_bu_score: | ||
Intent i = new Intent(FeiJi_MenuActivity.this, FeiJi_ScoreActivity.class); | ||
startActivity(i); | ||
break; | ||
|
||
case R.id.feiji_bu_exit: | ||
finish(); | ||
break; | ||
} | ||
} | ||
|
||
} | ||
|
||
public void onResume() { | ||
super.onResume(); | ||
|
||
/** | ||
* ҳ����ʼ��ÿ��Activity�ж���Ҫ��ӣ�����м̳еĸ�Activity���Ѿ�����˸õ��ã���ô��Activity����ز�����ӣ� | ||
* ������StatService.onPageStartһ��onPageEnd��������ʹ�� | ||
*/ | ||
StatService.onResume(this); | ||
} | ||
|
||
public void onPause() { | ||
super.onPause(); | ||
|
||
/** | ||
* ҳ�������ÿ��Activity�ж���Ҫ��ӣ�����м̳еĸ�Activity���Ѿ�����˸õ��ã���ô��Activity����ز�����ӣ� | ||
* ������StatService.onPageStartһ��onPageEnd��������ʹ�� | ||
*/ | ||
StatService.onPause(this); | ||
} | ||
} |
Oops, something went wrong.