title: android zoomable and scrollable board game
body: <p>I'm developing a Android board game and have a question regarding creating a board that is zoomable and scrollable. The board contains a static background, characters (players) and  the actual "level" which is drawn using tiles.</p>
  
  <p>My solutions is to have a collection of elements (tiles, figures, all game elements - all have x,y coordinates and width + height), a camera and a renderer that draws the collection according to cameraX,cameraY, cameraWidth and cameraHeight. So if a user would scroll to the right, the camera would just set the cameraX appropriately - and the surface is scrollable. And if a user would zoom in/out the renderer would just scale every element image appropriately.</p>
  
  <p>Example code for the renderer with scrollable surface and zoom in/out</p>
  
  <pre><code>    protected function draw(Canvas c){
        Collection elements = collection.getElements(cameraX,cameraY,cameraWidth,cameraHeight);
        if(elements.size() &gt; 0) {
           for(int i = 0; i &lt; elements.size(); i++) {
                elements.get(i).drawElement(c);
           }
        }
      }
      .
      .
      .
      // element class drawElement function
      protected drawElement function(Canvas c) {
          if(this.image != null) {            
            int w = this.width;
            int h = this.height;
            if(this.zoomFactor &lt; 1) {
               w*=this.zoomFactor;
               h*=this.zoomFactor;
            }
            c.drawBitmap(this.image,this.x,this.y,w,h);
          }
      }
  </code></pre>
  
  <ul>
  <li>Is this the best solutions?</li>
  <li>Could it be achived somehow else? </li>
  <li>Could scrolling be achived using a ScrollView? </li>
  </ul>
  
  <p>I dont wanna use any engine, because this is for a school project.</p>