Exemplo n.º 1
0
 /** 创建游戏窗体载体 */
 private void createScreen() {
   this.canvasImage = new LImage(width = handler.getWidth(), height = handler.getHeight(), false);
   this.gl = canvasImage.getLGraphics();
   this.currentScreen = canvasImage.getBitmap();
   if (LSystem.isLowerVer()) {
     this.surfaceHolder = getHolder();
     this.surfaceHolder.addCallback(this);
   } else {
     this.surfaceHolder = getHolder();
     int mode = 0;
     try {
       mode = 1;
       surfaceHolder.setType(android.view.SurfaceHolder.SURFACE_TYPE_HARDWARE);
     } catch (Exception e) {
       try {
         mode = 2;
         surfaceHolder.setType(android.view.SurfaceHolder.SURFACE_TYPE_GPU);
       } catch (Exception e2) {
         surfaceHolder.setType(android.view.SurfaceHolder.SURFACE_TYPE_NORMAL);
       }
     }
     switch (mode) {
       case 1:
         Log.i("Android2DView", "Hardware surface");
         break;
       case 2:
         Log.i("Android2DView", "GPU surface");
         break;
       default:
         Log.i("Android2DView", "No hardware acceleration available");
     }
     this.surfaceHolder.addCallback(this);
     this.surfaceHolder.setFormat(PixelFormat.RGB_565);
   }
   this.setClickable(false);
   this.setFocusable(true);
   this.setFocusableInTouchMode(true);
   this.setKeepScreenOn(true);
   this.setLongClickable(false);
   this.destroyDrawingCache();
   this.setDrawingCacheBackgroundColor(0);
   this.setDrawingCacheEnabled(false);
   if (LSystem.isHTC()) {
     this.setWillNotCacheDrawing(false);
     this.setWillNotDraw(false);
   } else {
     this.setWillNotCacheDrawing(true);
     this.setWillNotDraw(true);
   }
   this.requestFocus();
   this.requestFocusFromTouch();
 }
Exemplo n.º 2
0
 public void dispose() {
   super.dispose();
   timer = null;
   wait = null;
   if (image != null) {
     image.dispose();
     image = null;
   }
 }
Exemplo n.º 3
0
 /**
  * 更有游戏画布为指定大小
  *
  * @param img
  * @param w
  * @param h
  */
 public void updateResize(LImage img, int w, int h) {
   if (img == null) {
     return;
   }
   updateResize(img.getBitmap(), w, h);
 }
Exemplo n.º 4
0
 /**
  * 更新游戏画布
  *
  * @param img
  */
 public void update(LImage img) {
   if (img == null) {
     return;
   }
   update(img.getBitmap());
 }
Exemplo n.º 5
0
 /**
  * 刷新图像到指定位置
  *
  * @param img
  * @param x
  * @param y
  */
 public void updateLocation(LImage img, int x, int y) {
   if (img == null) {
     return;
   }
   updateLocation(img.getBitmap(), x, y);
 }
Exemplo n.º 6
0
 public void dispose() {
   if (characterCG != null) {
     characterCG.dispose();
     characterCG = null;
   }
 }
Exemplo n.º 7
0
 public Chara(LImage image, final int x, final int y, int w) {
   this(image, x, y, image.getWidth(), image.getHeight(), w);
 }