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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? maze.java

?? 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();
  }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产一二精品视频| 8x8x8国产精品| 久久99国产精品久久99 | 天堂成人国产精品一区| 中文字幕日韩精品一区| 国产精品午夜在线| 国产区在线观看成人精品 | 婷婷综合在线观看| 亚洲国产日韩a在线播放| 亚洲激情av在线| 亚洲一区二区av在线| 亚洲成人在线观看视频| 亚洲gay无套男同| 天使萌一区二区三区免费观看| 午夜久久福利影院| 玖玖九九国产精品| 美女视频网站久久| 国产乱码精品1区2区3区| 国产精品一区二区果冻传媒| 粉嫩av亚洲一区二区图片| 94色蜜桃网一区二区三区| 欧美视频一区二区三区在线观看| 欧美性视频一区二区三区| 精品日韩欧美在线| 亚洲欧洲日产国码二区| 亚洲人成伊人成综合网小说| 午夜在线成人av| 久久99国产精品麻豆| 99re视频精品| 91精品国产麻豆| 欧美激情在线一区二区| 亚洲成精国产精品女| 亚洲成av人片在线观看无码| 麻豆国产欧美日韩综合精品二区| www.欧美色图| 色成人在线视频| 久久久精品人体av艺术| 亚洲1区2区3区4区| va亚洲va日韩不卡在线观看| 欧美丰满少妇xxxbbb| 久久久亚洲精品一区二区三区 | 精品一二线国产| 午夜精品一区二区三区电影天堂 | 亚洲成人1区2区| 丁香激情综合国产| 欧美大肚乱孕交hd孕妇| 亚洲欧美色一区| 国产福利精品导航| 91精品国产色综合久久不卡蜜臀| 中文字幕一区三区| 国产福利91精品一区二区三区| 欧美喷潮久久久xxxxx| 亚洲蜜臀av乱码久久精品| 国产精品1区2区| 日韩欧美电影一二三| 婷婷开心久久网| 色婷婷久久久综合中文字幕| 综合色中文字幕| 成人高清视频免费观看| 欧美一级黄色录像| 亚洲精品成人少妇| 成人av集中营| 中文字幕欧美激情一区| 国产一区二区三区在线观看免费视频| 3atv在线一区二区三区| 亚洲成人激情自拍| 精品1区2区3区| 亚洲色图色小说| 日本精品一级二级| 国产亚洲女人久久久久毛片| 国产一区二区调教| 久久久噜噜噜久噜久久综合| 免费久久99精品国产| 欧美一区二区三区白人| 五月综合激情日本mⅴ| 欧美乱熟臀69xxxxxx| 午夜精品国产更新| 欧美日韩高清影院| 国产一区二区精品久久91| 日本午夜精品一区二区三区电影| 天天综合日日夜夜精品| 欧美另类高清zo欧美| 亚洲第一会所有码转帖| 51精品久久久久久久蜜臀| 日本不卡中文字幕| 精品sm在线观看| 成人看片黄a免费看在线| 亚洲欧洲无码一区二区三区| 91高清视频在线| 天天操天天综合网| 久久综合九色综合久久久精品综合 | 成人一区二区三区中文字幕| 国产婷婷色一区二区三区四区| 高清av一区二区| 一区二区三区在线视频免费观看| 日本韩国一区二区三区视频| 性感美女极品91精品| 精品欧美一区二区久久| 国产·精品毛片| 亚洲国产一区视频| 久久先锋影音av鲁色资源| 成人国产精品免费网站| 午夜精品久久久久| 日本一区二区成人在线| 欧美网站一区二区| 国产高清精品网站| 午夜精品福利在线| 国产精品卡一卡二卡三| 在线不卡a资源高清| 国产成人亚洲综合a∨猫咪 | 5566中文字幕一区二区电影| 国产老肥熟一区二区三区| 一区二区三区高清不卡| 久久久综合九色合综国产精品| 色综合久久六月婷婷中文字幕| 免播放器亚洲一区| 亚洲精品乱码久久久久久| 精品国产91乱码一区二区三区| 在线免费观看日本欧美| 国产成人免费在线观看| 日本91福利区| 一区二区三区**美女毛片| 国产亚洲欧美中文| 欧美美女bb生活片| 色噜噜狠狠一区二区三区果冻| 国产麻豆视频一区二区| 老司机一区二区| 国产丝袜美腿一区二区三区| 欧美日高清视频| 色天天综合久久久久综合片| 韩国av一区二区三区四区| 亚洲综合成人在线视频| 欧美大尺度电影在线| 欧美色图在线观看| 91黄色免费网站| 99久久99久久免费精品蜜臀| 国产精品一区在线观看乱码| 麻豆成人91精品二区三区| 亚洲第一成年网| 亚洲一区av在线| 亚洲综合成人在线视频| 亚洲欧洲国产专区| 久久人人超碰精品| 欧美乱妇15p| 精品视频一区二区三区免费| 风间由美一区二区av101| 狠狠色丁香久久婷婷综合_中 | 亚洲男人的天堂网| 亚洲视频电影在线| 成人免费在线视频| 国产精品美女一区二区三区| 久久久.com| 国产亚洲成aⅴ人片在线观看 | 国产一区二区h| 国产乱码精品一区二区三区av| 美女视频一区二区| 韩国欧美国产一区| 国产一区二区三区久久久 | 一区二区三区欧美日| 伊人色综合久久天天人手人婷| 亚洲欧美另类小说视频| 亚洲国产成人va在线观看天堂| 一区二区三区不卡视频| 午夜精品在线看| 另类小说色综合网站| 精品一区二区精品| 成人福利视频在线看| 欧美日韩在线播放三区四区| 欧美三电影在线| 欧美第一区第二区| 国产精品高潮呻吟| 午夜激情久久久| 韩国一区二区视频| 99精品偷自拍| 91麻豆精品国产91久久久使用方法| 日韩一区二区三区观看| 国产人成亚洲第一网站在线播放| 亚洲欧美一区二区在线观看| 亚洲一区二区三区在线看| 精品综合免费视频观看| 99久久精品国产网站| 337p亚洲精品色噜噜| 国产精品视频第一区| 日日夜夜精品视频天天综合网| 国模一区二区三区白浆| 色网站国产精品| 91精品国产综合久久久久| 国产精品亲子乱子伦xxxx裸| 午夜精品久久久久久久久| 国产99久久久国产精品潘金| 欧美日韩一区二区不卡| 亚洲国产精品黑人久久久| 丝袜美腿亚洲一区二区图片| 不卡av在线免费观看| 欧美不卡激情三级在线观看| 亚洲色欲色欲www| 国产一区二三区好的| 欧美人伦禁忌dvd放荡欲情| 国产精品久久看| 奇米一区二区三区av|