PlayN或支持库(如TriplePlay等)对非标准字体提供什么样的支持 - 特别是自定义TrueType字体.
我已经创建了这个Button类来捕获Pointer事件:
public class Button implements Pointer.Listener {
public void initLayer(Image defaultImage) {
layer = parent.createImageLayer(this.defaultImage);
layer.addListener(this);
}
...
Run Code Online (Sandbox Code Playgroud)
如果我触摸其中一个instanciated按钮,我会得到onPointerStart和onPointerEnd事件.但是,如果我的某个按钮已被触摸并且我开始触摸另一个按钮,则我没有得到第二个按钮的onPointerStart事件.
有没有办法用playn获得这些多点触控事件?
在PlayN项目中,我有以下 Java 代码
import com.google.common.base.Charsets;
import java.nio.ByteBuffer;
ByteBuffer msg = ... // a ByteBuffer that contains a String
String s = Charsets.UTF_8.decode(msg).toString();
Run Code Online (Sandbox Code Playgroud)
这在 Java 中运行良好,但是当我尝试使用 GWT 编译它时,我得到:
The method decode(ByteBuffer) is undefined for the type Charset
在 GWT 中,获取 ByteBuffer 中的字符串(以 UTF-8 编码)的正确方法是什么?
当我构建PlayN项目并运行java版本时,它的行为与我运行HTML版本时的行为不同.
基本上我制作了一款棋盘游戏,它使用Minimax算法的修改版本(搜索树和加权评估)来实现AI.
由于没有随机计算,如果输入相同,我希望输出也是一样的.
但是,java和javascript(HTML)版本的AI与同一输入的行为不同.
可在此处找到Html/javascript版本的链接:http: //mugle-app.appspot.com/+games/staff/fiar/
在java的:(JAR)文件,可以发现 http://ez-playn.googlecode.com/files/FiarJava.zip
它们都使用相同的代码,只有编译有所不同,但都使用提供的Ant脚本.树深度是固定的,评估者权重是固定的
我无法理解为什么会出现差异,因为除了搜索树之外,每件事情都有效......可能是因为评估很重且javascript运行资源不足?
谢谢你的帮助.
我在eclipse上安装了playn(http://code.google.com/p/playn/wiki/GettingStarted#Running_via_Eclipse),我加载了示例程序并加载了文件,java运行正常.但对于HTML我右键单击showcase-html> google> compile我没有得到任何错误:
Compiling module playn.showcase.Showcase
Compiling 1 permutation
Compiling permutation 0...
Compile of permutations succeeded
Linking into C:\Users\(my path)\playn-samples\showcase\html\target\playn-showcase-html-1.0-SNAPSHOT\showcase
Link succeeded
Compilation succeeded -- 12.208s
Run Code Online (Sandbox Code Playgroud)
然后运行> Web应用程序
我在开发标签中找到了一个网址:
http://127.0.0.1:8888/Showcase.html?gwt.codesvr=127.0.0.1:9997
Run Code Online (Sandbox Code Playgroud)
当我运行它时它会挂起我的浏览器
当我运行这个:
http://127.0.0.1:8888/Showcase.html
Run Code Online (Sandbox Code Playgroud)
它在弹出窗口中说"GWT MODULE可能需要(重新建立)"并且不加载任何东西.
知道什么可能是错的吗?
这是一个愚蠢的问题.
你如何阅读playn游戏中的文件?我尝试使用File和Scanner,就像我通常在标准的java程序中那样:
void readFromFile(){
int x;
int y;
int pixel;
int[][] board;
try{
Scanner scan = new Scanner(new File(in));
x = scan.nextInt();
y = scan.nextInt();
pixel = scan.nextInt();
Point start = new Point(scan.nextInt(), scan.nextInt());
Point dir = new Point(scan.nextInt(), scan.nextInt());
Point end = new Point(scan.nextInt(), scan.nextInt());
int antRoads = scan.nextInt();
board = new int[x][y];
for (int i = 0; i < y; i++){
for (int j = 0; j < x; j++){
board[i][j] = scan.nextInt();
}
}
lev = new …
Run Code Online (Sandbox Code Playgroud) 我在ImageLayer中使用了Pointer.Listener和Mouse.Listener,但它确实有效.但是当我将Pointer.Listener用于GroupLayer时,它不会监听点击或触摸.我怎样才能做到这一点?
我使用以下代码.
myGroupLayer.addListener(new Pointer.Listener() {
@Override
public void onPointerEnd(Event event) {
System.out.println("click registered");
myMethodToRun();
}
@Override
public void onPointerDrag(Event event) { }
@Override
public void onPointerStart(Event event) { }
});
Run Code Online (Sandbox Code Playgroud)