亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? tilemapper.java

?? DesignPatterns 的java源碼
?? JAVA
字號(hào):
package com.javapatterns.adapter.demos;
import java.awt.*;
import java.applet.*;
import java.awt.event.*;

     
/**
* TileMapper.java<p>
* Draws a simple tile based image map on the screen and allows the user
* to scroll the map with the arrow keys.
* @author Eric R. Northam (enorth1@gl.umbc.edu)
* @version 1.0 9 May 1999
*/
public class TileMapper extends Applet
{
  Image screenImage;  // Image used for double buffering and its respective
  Graphics screenGC;  // graphics context
  static final int screenWidth = 400;
  static final int screenHeight = 400;
  Image tileImage; // Use to store the image for the tiles
  static final int numTiles = 6; // The number of tiles
  static final int scrollInc = 8;  // How much pixels to move at each scroll

  int tileWidth;
  int tileImageHeight;
  int tileHeight;
  Tile[] tiles; // An array to hold all of the tiles

  static final byte[][] bgMap = {
			      {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
            {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
            {1, 1, 2, 0, 0, 0, 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
            {1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
            {1, 1, 0, 1, 1, 1, 1, 1, 5, 0, 0, 0, 0, 0, 0, 0, 0, 3, 1, 1},
            {1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1},
            {1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1},
            {1, 1, 5, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1},
            {1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1},
            {1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1},
            {1, 1, 1, 0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 3, 1, 1, 1, 0, 1, 1},
            {1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1},
            {1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1},
            {1, 1, 1, 5, 0, 0, 0, 0, 4, 1, 1, 1, 1, 5, 0, 0, 0, 4, 1, 1},
            {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
            {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}};

  static final int bgmapTileWidth = 20;
  static final int bgmapTileHeight = 16;
  int bgWidth;
  int bgHeight;

  int numXtiles;
  int numYtiles;
  int mapX = 0;
  int mapY = 0;


  public void init()
  {
    addKeyListener(new KeyAdapter(){
      public void keyPressed(KeyEvent e)
      {
        int keyCode = e.getKeyCode();

        switch(e.getKeyCode()){

          case KeyEvent.VK_UP:
            scrollUp();
            break;
          case KeyEvent.VK_RIGHT:
            scrollRight();
            break;
          case KeyEvent.VK_DOWN:
            scrollDown();
            break;
          case KeyEvent.VK_LEFT:
            scrollLeft();
            break;
          case KeyEvent.VK_PAGE_UP:
            scrollUpRight();
            break;
          case KeyEvent.VK_PAGE_DOWN:
            scrollDownRight();
            break;
          case KeyEvent.VK_HOME:
            scrollUpLeft();
            break;
          case KeyEvent.VK_END:
            scrollDownLeft();
            break;
        }
        repaint();
      }
    });
  }

  /**
  * Loads an image, splits it into tiles, and then displays each of the tiles
  * diagonally.
  * note: Netscape does not properly load the applet if calls to getImage() are
  * in the init() method, so I decided to just use the start() method
  */
  public void start()
  {
    resize(screenWidth, screenHeight);
    requestFocus();
    tileImage = getImage(getDocumentBase(), "images/road.gif");

    // Wait for the image to load
    MediaTracker tracker = new MediaTracker(this);
    tracker.addImage(tileImage, 0);
    try { tracker.waitForID(0); }
    catch (InterruptedException e) {}

    // Get tile dimensions
    tileImageHeight = tileImage.getHeight(this);
    tileWidth = tileImage.getWidth(this);
    tileHeight = tileImageHeight/numTiles;

    // Get the dimensions of the map
    bgWidth = tileWidth * bgmapTileWidth;
    bgHeight = tileHeight * bgmapTileHeight;

    // Create an offsreen image for double buffering
    // Give it a border with tilesize larger than the screen
    screenImage = createImage(screenWidth + 2*tileWidth,
                              screenHeight + 2*tileHeight);
    screenGC = screenImage.getGraphics();

    // Break image into tiles.
    prepareTiles();

    // Draw the upper left portion of the map
    numXtiles = screenWidth/tileWidth;
    numYtiles = screenHeight/tileHeight;
    drawMap();

  }

  /**
  * Break the tile image into tiles
  */
  public void prepareTiles()
  {
    tiles = new Tile[numTiles];

    // Assume the tile images are arranged vertically
    for(int i = 0; i < numTiles; i++)
      tiles[i] = new Tile(tileImage, tileWidth, tileHeight, i);
  }

  /**
  * Draw a portion of the map
  */
  public void drawMap()
  {
    int curX = 0, curY = 0;
    int xInc, yInc;
    int xTile, yTile;

    // Calculate the starting matrix entry for the tiles
    xTile = mapX / tileWidth;
    yTile = mapY / tileHeight;

    // Calculate the tile increments
    xInc = mapX % tileWidth;
    yInc = mapY % tileHeight;

    // Last column or row in the map is not drawn unless the screen width or
    // height is divisible by the tile dimensions
    for(int i = 0; i <= numYtiles; i++){
      for(int j = 0; j <= numXtiles; j++){
        tiles[bgMap[yTile + i][xTile + j]].paint(screenGC, curX - xInc, curY - yInc);
        curX += tileWidth;
      }
      curY += tileHeight;
      curX = 0;
    }
    repaint();
  }

  /**
  * scroll the map up
  */
  public void scrollUp()
  {
    // First check to see if at the top of the map
    if((mapY - scrollInc) < 0)
      return;

    mapY -= scrollInc;
    drawMap();
  }

  /**
  * scroll the map down
  */
  public void scrollDown()
  {
    // First check to see if at the bottom of the map
    if((mapY + scrollInc + screenHeight) >= bgHeight)
      return;

    mapY += scrollInc;
    drawMap();
  }

  /**
  * scroll the map left
  */
  public void scrollLeft()
  {
    // First check to see if at the left of the map
    if((mapX - scrollInc) < 0)
      return;

    mapX -= scrollInc;
    drawMap();
  }

  /**
  * scroll the map right
  */
  public void scrollRight()
  {
    // First check to see if at the right of the map
    if((mapX + scrollInc + screenWidth) >= bgWidth)
      return;

    mapX += scrollInc;
    drawMap();
  }

  /**
  * scroll the map up and right
  */
  public void scrollUpRight()
  {
    // Check to see if at the top of the map
    if((mapY - scrollInc) >= 0)
      mapY -= scrollInc;

    // Check to see if at the right of the map
    if((mapX + scrollInc + screenWidth) < bgWidth)
      mapX += scrollInc;

    drawMap();
  }

  /**
  * scroll the map up and left
  */
  public void scrollUpLeft()
  {
    // Check to see if at the top of the map
    if((mapY - scrollInc) >= 0)
      mapY -= scrollInc;

    // Check to see if at the left of the map
    if((mapX - scrollInc) >= 0)
      mapX -= scrollInc;

    drawMap();
  }

  /**
  * scroll the map down and right
  */
  public void scrollDownRight()
  {
    // Check to see if at the bottom of the map
    if((mapY + scrollInc + screenHeight) < bgHeight)
      mapY += scrollInc;

    // Check to see if at the right of the map
    if((mapX + scrollInc + screenWidth) < bgWidth)
      mapX += scrollInc;

    drawMap();
  }

  /**
  * scroll the map down and left
  */
  public void scrollDownLeft()
  {
    // Check to see if at the bottom of the map
    if((mapY + scrollInc + screenHeight) < bgHeight)
      mapY += scrollInc;

    // Check to see if at the right of the map
    if((mapX - scrollInc) >= 0)
      mapX -= scrollInc;

    drawMap();
  }



  public void update(Graphics g)
  {
    paint(g);
  }

  public void paint(Graphics g)
  {
    g.drawImage(screenImage, 0, 0, null);
  }

  public void destroy()
  {
    screenGC.dispose();
  }
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91麻豆国产香蕉久久精品| 91色porny在线视频| 免费人成黄页网站在线一区二区| 中文字幕亚洲欧美在线不卡| 国产欧美一区二区精品性| 国产视频一区二区在线观看| 久久精品日韩一区二区三区| 欧美精品一区二区三区蜜臀| 26uuu色噜噜精品一区| 亚洲精品在线观看视频| 日韩精品一区国产麻豆| 精品第一国产综合精品aⅴ| 精品国产成人系列| 久久久精品tv| 亚洲欧洲成人精品av97| 亚洲精品乱码久久久久久| 亚洲韩国精品一区| 日韩不卡一二三区| 国模冰冰炮一区二区| 国产成人免费视频| 99精品黄色片免费大全| 欧美日韩一区二区三区在线看| 欧美精品免费视频| 精品国产伦一区二区三区免费 | 亚洲精品视频一区二区| 亚洲综合另类小说| 无码av中文一区二区三区桃花岛| 日本麻豆一区二区三区视频| 青青草国产成人99久久| 免费久久精品视频| 国产成人精品www牛牛影视| 国产成人av电影| 成人黄色网址在线观看| 91一区二区在线观看| 欧美在线影院一区二区| 欧美精品免费视频| 欧美午夜精品一区二区三区| 欧美午夜精品一区二区蜜桃 | 欧美日韩激情在线| 欧美日韩精品福利| 日韩三级精品电影久久久| 精品福利视频一区二区三区| 久久精品亚洲精品国产欧美kt∨ | 欧美久久久久久久久中文字幕| 欧美猛男gaygay网站| 日韩一二三区视频| 国产亚洲精品精华液| 中文字幕一区二区三中文字幕| 亚洲视频一二三区| 日韩在线一二三区| 国产一区二区三区电影在线观看 | 成人美女视频在线看| 91丨九色porny丨蝌蚪| 欧美日韩亚洲综合在线 | 91精品在线一区二区| 精品日韩一区二区| 国产精品视频一区二区三区不卡| 亚洲精品国产无套在线观| 日韩成人av影视| 国产91精品精华液一区二区三区 | 欧美日韩一级黄| 久久影院视频免费| 一区二区三区在线免费播放| 日韩电影在线观看网站| 韩国理伦片一区二区三区在线播放| av一区二区三区黑人| 69堂国产成人免费视频| 欧美国产视频在线| 五月婷婷久久丁香| 福利视频网站一区二区三区| 欧美午夜不卡视频| 国产日韩欧美a| 亚洲美女在线国产| 日本不卡一区二区三区| 丁香婷婷深情五月亚洲| 欧美亚洲自拍偷拍| 久久综合久久久久88| 亚洲成人激情av| 波多野结衣在线aⅴ中文字幕不卡 波多野结衣在线一区 | 亚洲成人av福利| 成熟亚洲日本毛茸茸凸凹| 欧美老肥妇做.爰bbww| 欧美国产日韩精品免费观看| 亚洲123区在线观看| 国产激情91久久精品导航| 欧美探花视频资源| 中文字幕一区二区在线播放 | 丁香五精品蜜臀久久久久99网站| 欧美日韩亚洲综合一区| 国产精品美女久久福利网站| 日韩国产欧美视频| 99re这里都是精品| 久久日一线二线三线suv| 亚洲bt欧美bt精品| 色猫猫国产区一区二在线视频| 国产清纯白嫩初高生在线观看91 | av在线不卡观看免费观看| 日韩精品一区二区三区在线| 亚洲福利一区二区三区| 91小视频在线| 国产精品久久网站| 国产一区亚洲一区| 日韩精品资源二区在线| 午夜久久久久久电影| 色婷婷综合久久久久中文| 欧美激情在线观看视频免费| 精久久久久久久久久久| 这里是久久伊人| 夜夜操天天操亚洲| 色哟哟亚洲精品| 最新久久zyz资源站| 看电影不卡的网站| 欧美高清性hdvideosex| 亚洲免费av在线| yourporn久久国产精品| 久久久精品免费免费| 九九九精品视频| 欧美一区二区三区四区视频| 视频一区国产视频| 欧美群妇大交群中文字幕| 亚洲一线二线三线久久久| 91精品国产麻豆| 亚洲成人午夜电影| 欧美精品日韩综合在线| 午夜精品视频在线观看| 欧美麻豆精品久久久久久| 亚洲一区免费在线观看| 欧美性一二三区| 亚洲成在线观看| 9191成人精品久久| 免费久久99精品国产| 精品欧美一区二区久久 | 不卡在线视频中文字幕| 中文字幕字幕中文在线中不卡视频| 成人激情小说乱人伦| 亚洲欧洲日韩一区二区三区| 91女神在线视频| 亚洲综合免费观看高清在线观看| 欧美日韩视频在线第一区| 午夜在线电影亚洲一区| 欧美一区二区三区免费观看视频| 卡一卡二国产精品| 久久―日本道色综合久久| 久久97超碰色| 久久久久国产成人精品亚洲午夜 | 蜜桃视频在线观看一区二区| 91精品国产福利在线观看| 免费观看日韩av| 欧美精品一区二区三区很污很色的 | 精品伊人久久久久7777人| 久久久久久久久久久久电影| 成人午夜又粗又硬又大| 亚洲自拍偷拍图区| 日韩欧美国产综合| 成人av电影在线播放| 午夜伊人狠狠久久| 久久久亚洲精品一区二区三区| 不卡的av网站| 天天影视涩香欲综合网| 久久先锋影音av鲁色资源| 91在线精品秘密一区二区| 亚洲不卡av一区二区三区| 精品国精品自拍自在线| 99久久伊人网影院| 天天av天天翘天天综合网| 久久综合999| 欧美性淫爽ww久久久久无| 久久电影网电视剧免费观看| 亚洲欧洲精品天堂一级| 欧美一区二区播放| 91丨国产丨九色丨pron| 日本成人在线一区| 中文字幕一区二区三区视频| 欧美这里有精品| 蜜臀av一区二区在线免费观看| 久久这里只精品最新地址| 99久久精品国产导航| 首页国产丝袜综合| 国产亚洲一区二区在线观看| 91精品国产麻豆国产自产在线 | 一区二区三区 在线观看视频| 日韩精品中文字幕一区二区三区| zzijzzij亚洲日本少妇熟睡| 蜜桃精品视频在线观看| 亚洲欧美激情视频在线观看一区二区三区 | 国产亚洲精品中文字幕| 欧美日韩国产首页在线观看| 风间由美性色一区二区三区| 日韩国产在线一| 国产日韩欧美激情| 欧美一区二区在线播放| 97国产一区二区| 激情欧美日韩一区二区| 五月天网站亚洲| 久久精品亚洲精品国产欧美| 欧美一二三在线| 欧美探花视频资源| 91免费精品国自产拍在线不卡| 国产精品资源在线| 免费观看一级欧美片|