Ejemplo n.º 1
0
    public GameThread(SurfaceHolder surfaceHolder, Context context, Handler handler) {
      mGameSurfaceHolder = surfaceHolder;
      mGameContext = context;

      Resources res = context.getResources();

      mBackgroundImage = BitmapFactory.decodeResource(res, R.drawable.canvas_bg_01);

      Display display = mGameActivity.getWindowManager().getDefaultDisplay();
      mScreenXMax = display.getWidth();
      mScreenYMax = display.getHeight();
      mScreenXCenter = (mScreenXMax / 2);
      mScreenYCenter = (mScreenYMax / 2);

      setGameStartState();
    }
Ejemplo n.º 2
0
 // Actualisation of speed from mouse position
 public void mouseMoved(MouseEvent e) {
   xSpeed = (e.getPoint().x - content.getWidth() / 2) / xSensibility;
   ySpeed = -(e.getPoint().y - content.getHeight() / 2) / ySensibility;
 }