playn

Collaboration from PlayN client with server

不打扰是莪最后的温柔 提交于 2020-01-20 05:27:08
问题 I have written a game in PlayN, which has to communicate with a JavaEE-Server with Seam. First of all I only need the game running in HTML5. The current issue is the communication between the PlayN-client and the JavaEE-Server 1) First I tried to communicate over the PlayN.net() interface exchanging information using JSON. Since PlayN is running on port 8888 and the server on 8080 I correctly run into problems with the same-origin-policy. 2) Now I'm looking for a working solution. Which one

How can I draw a circle to the screen with PlayN?

笑着哭i 提交于 2020-01-14 05:23:28
问题 This is about as basic as it gets. I don't want to use an image file. Rather, I want to programmatically draw a circle and blit it to a surface (as they say in pygame). I tried to follow the "Using CanvasLayers" example here: https://developers.google.com/playn/devguide/rendering From my game class: // Surface SurfaceLayer surface; // Background int width = 640; int height = 480; //ImageLayer bgLayer; CanvasImage bgImage; Canvas canvas; // Circle CanvasImage circleImage; //ImageLayer

PlayN-canvas object not on top of page

筅森魡賤 提交于 2020-01-05 20:20:14
问题 I don't find a solution for this issue: I want to show my playN-game in a html-iframe: <iframe src="../playn-showcase-html/Showcase.html" width="640" height="480" name="Showcase" scrolling="no" marginwidth="0px" marginheigth="0px" frameborder="0" align="top"> </iframe> I want to embedd it with no borders. But as you can see in the image below, there is a 15px black 'rectangle' on top of the iframe I don't want to have. What one can see is the background of Showcase.html (which is black). As i

Programmatically fading in an image in PlayN

一曲冷凌霜 提交于 2020-01-02 19:28:23
问题 I'm working on a game using PlayN, and there's a bit where I would like to take an image (which is currently in PNG format, with 8-bit alpha already) and I would like to multiply the image by an additional alpha factor, based on a value from my code. Specifically, I have a picture of a face that currently lives in an ImageLayer, and the effect that I would like would be to have something like this: void init() { faceImage = assetManager().getImage("images/face.png"); graphics().rootLayer()

In PlayN, how can I build the HTML version of my project from the command line?

荒凉一梦 提交于 2019-12-25 05:14:43
问题 Currently I'm building it in Eclipse using the GWT plugin. I'd like to automate deployment to my development webserver using a script that does the GWT compilation from the command line. I've followed the directions in the Running Via Maven section of the Getting Started page: mvn -Phtml integration-test But it tries to build all the versions, erring out on the Android build (which I'd prefer to skip at the moment) and throws a warning stating the html profile doesn't exist: [INFO] ----------

TextCentering inside Canvas PlayN

為{幸葍}努か 提交于 2019-12-24 13:13:02
问题 I have one little problem: I am trying go center a given text inside a Canvas with PlayN. I do not have any FontMetrics, because GWT does not offer one, and simple repositioning depending of character number and fontsize just does not works :(.. Can somebody please help 回答1: Use Graphics.layoutText to create a TextLayout . TextLayout provides the width and height of the text, which you can use to position it however you like and render it into a Canvas using Canvas.drawText(TextLayout,x,y) .

In PlayN, how can I get the HTML version of my project using Google's Guava libraries to compile?

╄→尐↘猪︶ㄣ 提交于 2019-12-24 10:52:09
问题 I can run the Java version of my project fine by simply importing Guava libraries like so: import com.google.gwt.thirdparty.guava.common.collect.ImmutableList; Following the advice here, I've added this line to html/pom.xml: <dependency> <groupId>com.google.guava</groupId> <artifactId>guava-gwt</artifactId> <version>10.0.1</version> </dependency> And this line to html/project.gwt.xml file: <inherits name="com.google.common.collect.Collect"/> But when I try to GWT-Compile my HTML version in

ByteBuffer to String in GWT

隐身守侯 提交于 2019-12-24 00:57:38
问题 On a PlayN project I have the following Java code 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(); this works fine in Java, but when I try to compile it with GWT I get: The method decode(ByteBuffer) is undefined for the type Charset What's the proper way, in GWT, to obtain a String (encoded in UTF-8) that's inside a ByteBuffer? 回答1: You should be able to use new

Unable to run playn sample project - compile errors

元气小坏坏 提交于 2019-12-23 09:27:19
问题 I've tried to follow the instructions on the getting started page for playn and run into problems when running the first program java showcase. I get the following errors when right clicking and running Maven test. Also I get numerous errors in the problem tab of eclipse related to (failure to transfer xxx from yyy) where xxx is some jar file and yyy is a gwt or playn website [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------

How to Run my playN game in production mode locally?

那年仲夏 提交于 2019-12-23 05:15:11
问题 I want to run my playN game in production mode as the development mode is too slow to test. I am not able to click and get the response for buttons and it updates very slow in dev mode. I have read that substituting the IP of the link with "localhost" will do. But even after i have done the same, It is too slow like before. I need to run the html version only. How can I do this? 回答1: You should try running it having the test-html profile active. From PlayN's getting started page: cd playn