fredsa / playn

Cross platform game library for N≥4 platforms
0 stars 1 forks source link

Java and HTML platforms do not draw the same way #233

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Created a new project from the playn archetype version 1.6
2. Added the following code to the main game class (GridTest in this case)
 init method

    @Override
    public void init() {

    float width = 50f;
    float height = 50f;
    CanvasImage tileImage = 
               PlayN.graphics().createImage(width, height);
    Canvas tileCanvas = tileImage.canvas();
    tileCanvas.setFillColor(Color.rgb(255, 255, 0));
    Path tilePath = tileCanvas.createPath();

        tilePath.moveTo(0, 0);
    tilePath.lineTo(width, 0);
    tilePath.lineTo(width, height);
    tilePath.lineTo(0, height);
    tilePath.close();
    tileCanvas.fillPath(tilePath);
    tileCanvas.setFillColor(Color.rgb(0, 0, 0));
    tileCanvas.drawLine(0, 0, width, 0);
    tileCanvas.drawLine(width, 0, width, height);
    tileCanvas.drawLine(width, height, 0, height);
    tileCanvas.drawLine(0, height, 0, 0);

    for (int y = 0; y < 4; y++) {
        for (int x = 0; x < 4; x++) {
            ImageLayer tileLayer =   
                            PlayN.graphics().createImageLayer(
                        tileImage);
                PlayN.graphics().rootLayer().addAt(tileLayer, x * width, y * height);
            }
        }
        CanvasImage circleImage =       
                     PlayN.graphics().createImage(20f, 20f);
        Canvas circleCanvas = circleImage.canvas();
        circleCanvas.setFillColor(Color.rgb(128, 0, 0));
        circleCanvas.fillCircle(10f, 10f, 10f);
        ImageLayer circleLayer = 
                     PlayN.graphics().createImageLayer(circleImage);
        PlayN.graphics().rootLayer().addAt(circleLayer, 22f, 22f);
    }

3. Compiled and ran the project on both Java and HTML platforms

What is the expected output? What do you see instead?

Expected output is a grid of 4x4 yellow tiles each 50x50 pixels in size and a 
red circle with a radius of 10 pixels drawn centered at point [22,22]. On HTML 
platform this works but not on the Java Platform (see attachments).

The tiles have borders painted in Color.rgb(0, 0, 0) (black). On HTML platform 
this works but on the Java platform the grid is painted in white. 

What version of the product are you using? On what operating system?
PlayN 1.6
Java 1.6.0 updates 29, 30, 38
Java 1.7.0 update 11
Windows 7 64-bit Operating System

Please provide any additional information below.
http://stackoverflow.com/questions/15599604/adding-an-imagelayer-to-a-certain-lo
cation-in-a-grouplayer-does-not-move-the-ima

Original issue reported on code.google.com by savolain...@gmail.com on 1 Apr 2013 at 10:02

Attachments:

GoogleCodeExporter commented 9 years ago
I noticed that this is not an issue on other computers. Only on my work laptop.

Here are the specs:

Manufacturer: Hewlett-Packard
Model: HP EliteBook Folio 9470m
Processor: Intel(R) Core(TM) i5-3427U CPU @ 1.80GHz 2.30 GHz
Installed memory (RAM): 4,00 GB
System type: 64-bit Operating System
Display Adapter: Intel(R) HD Graphics 4000

PlayN 1.6 & 1.7
JDK 1.6.0 updates 29, 30, 38, 45
JDK 1.7.0 update 11

Original comment by savolain...@gmail.com on 7 May 2013 at 3:45