Home > other >  Android USES CCDrawingPrimitives problem
Android USES CCDrawingPrimitives problem

Time:09-25

Public class MainActivity extends the Activity {//drawing primitives test

Private CCGLSurfaceView mGLSurfaceView;//set up the view

@ Override
Protected void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

MGLSurfaceView=new CCGLSurfaceView (this);//create the surface
The setContentView (mGLSurfaceView);//map view
CCDirector. SharedDirector (.) attachInView (mGLSurfaceView);//the view to director class
CCScene scene.=CCScene node ();
Scene. The addChild (new Test1 ());//create node
CCDirector. SharedDirector (.) runWithScene (scene);//director to give the view layer above elements to play
}

Private static class Test1 extends CCLayer {//test 1
Private GL10 gl.
Public Test1 () {

The draw (gl);
}
Public void the draw (GL10 gl) {//a painting class
CGSize s=CCDirector. SharedDirector (.) winSize ();//get the screen size
CCDrawingPrimitives. CcDrawLine (gl, CGPoint. CCP (0, 0), CGPoint. The CCP (s. idth and Sheldon horowitz eight));//drawing primitives are used to draw lines
}

}

}
Thank you for your
  • Related