【正文】
} } else { ().yield()。 } // wait for a little and give the other threads // the chance to run long timeTaken = () startTime。 // draw the 2d part draw2D(g)。 drawingTime = () drawingTime。 long drawingTime = ()。 while (playing) { try { long startTime = ()。 } finally { // release the target if (bound) { ()。 // advance the animation ((int)(() gameStart))。 try { // binds the target (g)。 // draw FPS on the bottom left (FPS: + fps, 0, getHeight(), | )。 ((() gameStart) / 1000)。 ( Time:).append(duration / 1000)。 StringBuffer status = new StringBuffer(finished ? Done : )。 (locationx, 10f, locationz)。 } } // key pressed used to show the main menu protected void keyPressed(int key) { if (key 0) { ()。 } // if we move we reset the top view state if (topView) { switchView()。 (1f)。 (locationx, locationz, 4f)) { finished = true。 } // and reset the view 本科課程設(shè)計(jì)論文 22 if (moved) { if (!finished amp。 locationz += stepz。 } else if ((keyState amp。 locationz = stepz。 } else if ((keyState amp。 // shift the background a bit to the left (() 3, 0, getWidth(), getHeight())。 stepx = STEP * (float) ((angley))。 } else if ((keyState amp。 // shift the background a bit to the right (() + 3, 0, getWidth(), getHeight())。 stepx = STEP * (float) ((angley))。 } } } // here we assume only one button is pressed otherwise the second // press is ignored if ((keyState amp。 (0, wallClearAppearance)。 if ((1, , , camera, ri)) { Node selected = ()。 if ((keyState amp。 } // the method checks whenever the keys are pressed private void checkKeys() 本科課程設(shè)計(jì)論文 20 { int keyState = getKeyStates()。 } } } if (!forward) { // revert to the original view (180, 0f, 1f, 0f)。s the size of a step float distance = () * 9。 } if ((1, , , camera, ri)) { Node selected = ()。 本科課程設(shè)計(jì)論文 19 } // collision with walls is easily implemented using picking // if there is something in front of the camera and the distance is too // small, the movement is not allowed RayIntersection ri = new RayIntersection()。 // First check if inside the maze area float mazeSize = MAZE_SIDE_LENGTH / 2 2。 } } // decides whether it is allowed to move to a given place // otherwise it is possible to cross walls and go outside the maze private boolean canMove(float stepx, float stepz, boolean forward) { float x = locationx + stepx。 (0, wallAppearance)。 } // The maze create the planes and they are added to the world Enumeration wallsEnum = ()。 // set the texture (0, wallTexture)。 ()。 wallTexture = new Texture2D( new Image2D(, wallTextureImage))。 // load the wall texture Image wallTextureImage = (/)。 (wallClearCompositeMode)。 // this is to make a wall semi transparent CompositingMode wallClearCompositeMode = new CompositingMode()。 (true)。 (locationSquare)。 (false)。 locationSquare = ()。 (0, locationSquareTexture)。 本科課程設(shè)計(jì)論文 17 ()。 if (locationSquareImage != null) { locationSquareTexture = new Texture2D( new Image2D(, locationSquareImage))。 Texture2D locationSquareTexture = null。 (8, 8, )。 } // create the player location square private void createLocationSquare() { // initial location of the square // we are only interested in rotating and scaling it Transform locationSquareTransform = new Transform()。 // the floor is not pickable (false)。 // build the mesh Mesh floorMesh = ()。 (0, floorTexture)。 本科課程設(shè)計(jì)論文 16 ()。 if (floorTextureImage != null) { floorTexture = new Texture2D( new Image2D(, floorTextureImage))。 // load the texture Texture2D floorTexture = null。 (true)。 // The floor appearance. Basically a texture repeated many times Appearance floorAppearance = new Appearance()。 (, , , )。 } // creates the floor private void createF