public void drawTile (int xi, int yi, int tileid) {
        if (background == null) return;
        // determine position within bg
        int x = el.moduloFloor(xi + 1, el.viewnrtilesx + 3) * el.scaledtilex;
        int y = el.moduloFloor(yi + 1, el.viewnrtilesy + 3) * el.scaledtiley;
        // draw
        if (bgg == null) bgg = background.getGraphics();
        Integer tileid_obj = new Integer(tileid);
        JREImage img = (JREImage) el.getTileImage(tileid_obj);
        // define background behind tile in case the tile is null or
        // transparent.
        if (img == null || el.images_transp.containsKey(tileid_obj)) {
            EngineLogic.BGImage bg_image = (EngineLogic.BGImage)
                    el.bg_images.get(0);
            if (bg_image == null) {
                setColor(bgg, el.bg_color);
                bgg.fillRect(x, y, el.scaledtilex, el.scaledtiley);
            }
            else {
                int xtile = el.moduloFloor(xi, bg_image.tiles.x);
                int ytile = el.moduloFloor(yi, bg_image.tiles.y);
                bgg.drawImage(((JREImage) el.getImage(bg_image.imgname)).img,
                              x, y, x + el.scaledtilex, y + el.scaledtiley,
                              xtile * el.scaledtilex, ytile * el.scaledtiley,
                              (xtile + 1) * el.scaledtilex, (ytile + 1) * el.scaledtiley,
                              (Color) el.bg_color.impl,
                              null);
            }
        }
        if (img != null) bgg.drawImage(img.img, x, y, this);
        // System.out.println("Drawn tile"+tileid);
    }