3D编程指南第四部分:M3G内建碰撞、光照物理学和照相机视点[32]

[入库:2006年2月23日] [更新:2007年3月24日]

本文简介:

你可以看到130fovy值的给我们一个相当有趣的隧道效果。另外,别忘了这个游戏实际上是相当好玩。再进行一点点改进,你就会使它成为一个真正使人上瘾的游戏。作为一个联系,你可以尝试使游戏场地的墙面旋转!切记,为了每一次旋转墙面时作出适当的反射,你不得不旋转存储在wallVec数组中的所有法线向量。

TutorialMidlet

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

public class TutorialMidlet extends MIDlet implements CommandListener
{
    // A variable that holds the unique display
 private Display display = null;
 
 // The canvas
 private M3GCanvas canvas = null;
 
 // The MIDlet itself
 private static MIDlet self = null;

 /** Called when the application starts, and when it is resumed.
  * We ignore the resume here and allocate data for our canvas
  * in the startApp method. This is generally very bad practice.
  */
 protected void startApp() throws MIDletStateChangeException
 {
     // Allocate
  display = Display.getDisplay(this);
  canvas = new M3GCanvas(30);
  
  // Add a quit command to the canvas
  // This command won't be seen, as we
  // are running in fullScreen mode
  // but it's always nice to have a quit command
  canvas.addCommand(new Command("Quit", Command.EXIT, 1));
  
  // Set the listener to be the MIDlet
  canvas.setCommandListener(this);
  
  // Start canvas
  canvas.start();
  display.setCurrent(canvas);
  
  // Set the self
  self = this;
 }

 /** Called when the game should pause, such as during a call */
 protected void pauseApp()
 {
  
 }

本文关键:3D编程指南第四部分:M3G内建碰撞、光照物理学和照相机视点
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top