Advertisement
Guest User

Untitled

a guest
Jun 12th, 2012
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. package com.olimoli123.fivesecondmania;
  2.  
  3. import org.cocos2d.layers.CCScene;
  4. import org.cocos2d.nodes.CCDirector;
  5. import org.cocos2d.nodes.CCNode;
  6. import org.cocos2d.opengl.CCGLSurfaceView;
  7.  
  8. import android.app.Activity;
  9. import android.os.Bundle;
  10. import android.view.View;
  11. import android.view.Window;
  12. import android.view.WindowManager;
  13. import android.widget.EditText;
  14. import android.widget.LinearLayout;
  15. import android.widget.TextView;
  16.  
  17. public class activity extends Activity {
  18. protected CCGLSurfaceView _glSurfaceView;
  19. @Override
  20.  
  21. public void onCreate(Bundle savedInstanceState)
  22. {
  23. super.onCreate(savedInstanceState);
  24. requestWindowFeature(Window.FEATURE_NO_TITLE);
  25. getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
  26. getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
  27. _glSurfaceView = new CCGLSurfaceView(this);
  28. setContentView(_glSurfaceView);
  29. TextView label = new TextView(this);
  30. LinearLayout ll = new LinearLayout(this);
  31. ll.setOrientation(LinearLayout.VERTICAL);
  32. LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
  33. LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
  34. label.setId(R.id.label);
  35. addContentView(ll, layoutParams);
  36. ll.addView(label, layoutParams);
  37.  
  38. }
  39. @Override
  40. public void onStart()
  41. {
  42. super.onStart();
  43. CCDirector.sharedDirector().setAnimationInterval(1.0f / 60.0f);
  44. CCDirector.sharedDirector().attachInView(_glSurfaceView);
  45. CCScene scene = GameLayer.scene();
  46. CCDirector.sharedDirector().runWithScene(scene);
  47.  
  48. }
  49. @Override
  50. public void onPause()
  51. {
  52. super.onPause();
  53.  
  54. CCDirector.sharedDirector().pause();
  55. }
  56.  
  57. @Override
  58. public void onResume()
  59. {
  60. super.onResume();
  61.  
  62. CCDirector.sharedDirector().resume();
  63. }
  64.  
  65. @Override
  66. public void onStop()
  67. {
  68. super.onStop();
  69.  
  70. CCDirector.sharedDirector().end();
  71. }
  72.  
  73.  
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement