Java ME手机应用开发大全一书的配套光盘上的源码
源代码在线查看: control.java
package bluetoochgame;
public class Control {
Connection connection;
GameWorld gameworld;
MyCanvas mycanvas;
int selectedX,selectedY;
public boolean isServer;
boolean myMove;
public Control(GameWorld gameworld) {
this.gameworld = gameworld;
isServer = gameworld.isServer ;
}
public void start()
{
connection = new Connection(this);
connection.start() ;//连接开始
}
public void sendMessage(int selected_X,int selected_Y)
{
connection.sendMessage(selected_X,selected_Y);
}
public void receiveMessage()
{
gameworld.receiveMessage() ;
System.out.println("control is receivemessage");
}
public int getSelectedX()
{
selectedX = connection.getSelectedX() ;
return selectedX;
}
public int getSelectedY()
{
selectedY = connection.getSelectedY() ;
return selectedY;
}
}