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

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

?? maze.java

?? DesignPatterns 的java源碼
?? JAVA
字號:
package com.javapatterns.adapter.demos;

import java.awt.*;
import java.applet.*;
import java.awt.event.*;

public class Maze 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
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲一卡二卡三卡四卡| 亚洲国产精品人人做人人爽| 精品国产一区二区在线观看| 欧美日韩精品一区二区| 欧洲亚洲精品在线| 欧美三级日韩三级国产三级| 欧美私人免费视频| 欧美高清视频www夜色资源网| 欧美女孩性生活视频| 制服丝袜日韩国产| 日韩一二三四区| 久久精品在线免费观看| 欧美激情综合在线| 国产精品久久网站| 亚洲美女电影在线| 一区二区三区在线看| 亚洲第一主播视频| 日本伊人午夜精品| 国产一区视频导航| 国产激情精品久久久第一区二区| 国产成人亚洲综合色影视| a美女胸又www黄视频久久| 91麻豆免费看| 欧美日本在线播放| 欧美不卡激情三级在线观看| 亚洲精品在线三区| 国产精品久久久久四虎| 亚洲一区二区三区四区五区黄 | 亚洲欧美日韩电影| 亚洲高清免费一级二级三级| 蜜桃久久久久久久| 欧美激情艳妇裸体舞| 精品粉嫩超白一线天av| 欧美熟乱第一页| 欧美日本一道本| 6080国产精品一区二区| 91精品办公室少妇高潮对白| 色综合天天狠狠| 91香蕉视频黄| 91国产免费看| 777亚洲妇女| 精品捆绑美女sm三区| 久久综合九色综合97婷婷女人 | 国产98色在线|日韩| 奇米精品一区二区三区在线观看| 久草中文综合在线| 日韩av在线免费观看不卡| 国产精品大尺度| 日韩欧美一区二区免费| 日韩女优电影在线观看| 精品成人在线观看| 久久99精品国产麻豆不卡| 国产精品日韩成人| 91精品国产综合久久精品| 精品久久久久久亚洲综合网 | 日韩欧美卡一卡二| 亚洲婷婷综合色高清在线| 日韩专区在线视频| 成人午夜电影小说| 91精品国产综合久久久久| 国产女人水真多18毛片18精品视频 | 欧美日韩中文一区| 国产丝袜在线精品| 日韩精品每日更新| 色综合视频在线观看| 亚洲精品一区二区三区99| 一区二区三区在线不卡| 国产精品一区在线观看乱码 | 国产精品蜜臀av| 免费观看在线色综合| 一本久道久久综合中文字幕| 精品福利一区二区三区 | 丝袜亚洲精品中文字幕一区| 99国产精品一区| 久久久亚洲国产美女国产盗摄| 亚洲国产中文字幕| 99久久精品国产精品久久| 精品国产免费久久| 日日摸夜夜添夜夜添亚洲女人| 97超碰欧美中文字幕| 国产精品热久久久久夜色精品三区| 日韩av一区二区三区| 欧美午夜电影一区| 亚洲啪啪综合av一区二区三区| 国产一区二区美女诱惑| 91精品国产乱码| 亚洲国产日韩一区二区| 91老师片黄在线观看| 国产精品视频看| 国产高清精品网站| 欧美成人vr18sexvr| 视频一区欧美日韩| 久久久久久久综合日本| 久久精品国产99国产精品| 欧美日韩国产综合久久 | av成人免费在线观看| 久久久国产一区二区三区四区小说| 免费在线观看不卡| 91精品国产一区二区人妖| 日韩黄色一级片| 91精品国产手机| 日本免费新一区视频| 欧美一区二区三区日韩| 午夜在线电影亚洲一区| 欧美日韩在线一区二区| 亚洲小说春色综合另类电影| 色偷偷久久人人79超碰人人澡 | 国产精品主播直播| 久久久久久久久久久久电影| 国产尤物一区二区| 久久久综合网站| 成人av综合在线| 最好看的中文字幕久久| 91丨porny丨首页| 亚洲女人小视频在线观看| 色哟哟一区二区三区| 亚洲综合激情另类小说区| 欧美人xxxx| 久久福利视频一区二区| 国产亚洲欧美日韩俺去了| 成人在线视频一区| 亚洲欧美日韩在线播放| 欧美色手机在线观看| 日本伊人午夜精品| 久久综合九色综合97_久久久| 国产suv精品一区二区6| 亚洲视频电影在线| 欧美日韩精品一区二区三区蜜桃 | 一区二区三区免费| 欧美电影一区二区三区| 男人的天堂亚洲一区| 中文字幕亚洲电影| 色av综合在线| 日本美女一区二区三区| 国产亚洲欧美在线| 91国偷自产一区二区开放时间| 图片区小说区区亚洲影院| 精品1区2区在线观看| 99国内精品久久| 日韩高清在线一区| 久久精品视频一区二区| 91看片淫黄大片一级| 三级欧美韩日大片在线看| 久久蜜臀中文字幕| 91社区在线播放| 日韩成人dvd| 国产精品每日更新在线播放网址| 欧美亚洲国产一区二区三区va| 奇米一区二区三区av| 国产精品国产精品国产专区不蜜| 欧美亚洲另类激情小说| 国产精品综合在线视频| 一卡二卡三卡日韩欧美| 精品美女被调教视频大全网站| 99久久精品免费| 久久精品国产精品青草| 亚洲婷婷在线视频| 日韩免费性生活视频播放| 99久久国产免费看| 免费一区二区视频| 亚洲乱码一区二区三区在线观看| 日韩亚洲欧美成人一区| 一本久久a久久免费精品不卡| 捆绑变态av一区二区三区| 亚洲色欲色欲www在线观看| 日韩三级视频中文字幕| 91色视频在线| 韩国av一区二区三区四区| 午夜精品成人在线视频| 综合久久一区二区三区| 精品久久久久久久一区二区蜜臀| 91美女视频网站| 国产高清一区日本| 久久成人免费日本黄色| 亚洲一区二区五区| 日韩美女视频一区二区| 国产亚洲精品福利| 日韩无一区二区| 欧美日韩亚州综合| 色哟哟一区二区| 99久久99久久精品免费看蜜桃| 经典三级视频一区| 日韩精品乱码免费| 亚洲国产中文字幕在线视频综合 | 日本道精品一区二区三区| 国产传媒一区在线| 国内精品伊人久久久久av一坑 | 国产欧美在线观看一区| 91精品国产乱| 欧美吞精做爰啪啪高潮| 成人黄页在线观看| 三级欧美韩日大片在线看| 亚洲少妇屁股交4| 中文在线一区二区| 欧美日韩国产中文| 色综合久久综合网欧美综合网| 国产激情一区二区三区| 丝袜国产日韩另类美女| 一区二区高清免费观看影视大全| 国产丝袜在线精品|