Browse code

add PlaynNuitJavaDisplay

devnewton authored on 26/05/2014 at 12:39:33
Showing 14 changed files
... ...
@@ -4,7 +4,7 @@
4 4
     <parent>
5 5
         <groupId>im.bci</groupId>
6 6
         <artifactId>jnuit</artifactId>
7
-        <version>0.11</version>
7
+        <version>0.12-SNAPSHOT</version>
8 8
         <relativePath>../pom.xml</relativePath>
9 9
     </parent>
10 10
     <groupId>im.bci</groupId>
... ...
@@ -24,7 +24,7 @@ THE SOFTWARE. --><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="h
24 24
     <parent>
25 25
         <groupId>im.bci</groupId>
26 26
         <artifactId>jnuit</artifactId>
27
-        <version>0.11</version>
27
+        <version>0.12-SNAPSHOT</version>
28 28
         <relativePath>../pom.xml</relativePath>
29 29
     </parent>
30 30
     <artifactId>jnuit-artemis</artifactId>
... ...
@@ -25,7 +25,7 @@ THE SOFTWARE. -->
25 25
     <parent>
26 26
         <groupId>im.bci</groupId>
27 27
         <artifactId>jnuit</artifactId>
28
-        <version>0.11</version>
28
+        <version>0.12-SNAPSHOT</version>
29 29
         <relativePath>../pom.xml</relativePath>
30 30
     </parent>
31 31
     <groupId>im.bci</groupId>
... ...
@@ -25,7 +25,7 @@ THE SOFTWARE. -->
25 25
     <parent>
26 26
         <groupId>im.bci</groupId>
27 27
         <artifactId>jnuit</artifactId>
28
-        <version>0.11</version>
28
+        <version>0.12-SNAPSHOT</version>
29 29
         <relativePath>../pom.xml</relativePath>
30 30
     </parent>
31 31
     <groupId>im.bci</groupId>
... ...
@@ -25,7 +25,7 @@ THE SOFTWARE. -->
25 25
     <parent>
26 26
         <groupId>im.bci</groupId>
27 27
         <artifactId>jnuit</artifactId>
28
-        <version>0.11</version>
28
+        <version>0.12-SNAPSHOT</version>
29 29
         <relativePath>../pom.xml</relativePath>
30 30
     </parent>
31 31
     <groupId>im.bci</groupId>
... ...
@@ -25,7 +25,7 @@ THE SOFTWARE. -->
25 25
     <parent>
26 26
         <groupId>im.bci</groupId>
27 27
         <artifactId>jnuit</artifactId>
28
-        <version>0.11</version>
28
+        <version>0.12-SNAPSHOT</version>
29 29
         <relativePath>../pom.xml</relativePath>
30 30
     </parent>
31 31
     <groupId>im.bci</groupId>
32 32
new file mode 100644
... ...
@@ -0,0 +1,141 @@
0
+<?xml version="1.0" encoding="UTF-8"?>
1
+<!-- The MIT License (MIT)
2
+
3
+Copyright (c) 2014 devnewton <devnewton@bci.im>
4
+
5
+Permission is hereby granted, free of charge, to any person obtaining a copy
6
+of this software and associated documentation files (the "Software"), to deal
7
+in the Software without restriction, including without limitation the rights
8
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+copies of the Software, and to permit persons to whom the Software is
10
+furnished to do so, subject to the following conditions:
11
+
12
+The above copyright notice and this permission notice shall be included in
13
+all copies or substantial portions of the Software.
14
+
15
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+THE SOFTWARE. -->
22
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
23
+    <modelVersion>4.0.0</modelVersion>
24
+    <parent>
25
+        <groupId>im.bci</groupId>
26
+        <artifactId>jnuit</artifactId>
27
+        <version>0.12-SNAPSHOT</version>
28
+        <relativePath>../pom.xml</relativePath>
29
+    </parent>
30
+    <groupId>im.bci</groupId>
31
+    <artifactId>jnuit-playn-java</artifactId>
32
+    <packaging>jar</packaging>
33
+    <name>jnuit-playn-java</name>
34
+    <description>jnuit playn implementation</description>
35
+    <url>http://git.bci.im/jnuit</url>
36
+    <licenses>
37
+        <license>
38
+            <name>MIT</name>
39
+            <url>http://git.bci.im/jnuit/blob/master/LICENSE</url>
40
+            <distribution>repo</distribution>
41
+        </license>
42
+    </licenses>
43
+    <developers>
44
+        <developer>
45
+            <name>Dave Newton</name>
46
+            <url>http://devnewton.bci.im</url>
47
+        </developer>
48
+    </developers>
49
+    <properties>
50
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
51
+        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
52
+    </properties>
53
+    <build>
54
+        <resources>
55
+            <resource>
56
+                <directory>src/main/resources</directory>
57
+                <filtering>false</filtering>
58
+            </resource>
59
+        </resources>
60
+        <plugins>
61
+            <plugin>
62
+                <artifactId>maven-compiler-plugin</artifactId>
63
+            </plugin> 
64
+            <plugin>
65
+                <groupId>org.apache.maven.plugins</groupId>
66
+                <artifactId>maven-source-plugin</artifactId>
67
+            </plugin>
68
+            <plugin>
69
+                <groupId>org.apache.maven.plugins</groupId>
70
+                <artifactId>maven-javadoc-plugin</artifactId>
71
+                <version>2.9.1</version>
72
+                <executions>
73
+                    <execution>
74
+                        <id>attach-javadocs</id>
75
+                        <goals>
76
+                            <goal>jar</goal>
77
+                        </goals>
78
+                    </execution>
79
+                </executions>
80
+            </plugin>
81
+            <plugin>
82
+                <groupId>org.apache.maven.plugins</groupId>
83
+                <artifactId>maven-release-plugin</artifactId>
84
+                <version>2.4.2</version>
85
+                <configuration>
86
+                    <goals>deploy</goals>
87
+                    <pushChanges>false</pushChanges>
88
+                    <localCheckout>true</localCheckout>
89
+                </configuration>
90
+            </plugin> 
91
+        </plugins>
92
+    </build>
93
+    <dependencies>
94
+        <dependency>
95
+            <groupId>com.googlecode.playn</groupId>
96
+            <artifactId>playn-java</artifactId>
97
+            <exclusions>
98
+                <exclusion>
99
+                    <groupId>jlayer</groupId>
100
+                    <artifactId>mp3spi</artifactId>        
101
+                </exclusion>
102
+            </exclusions>
103
+        </dependency>
104
+        <dependency>
105
+            <groupId>im.bci</groupId>
106
+            <artifactId>jnuit-playn</artifactId>
107
+        </dependency>
108
+    </dependencies>
109
+    <profiles>
110
+        <profile>
111
+            <id>release-sign-artifacts</id>
112
+            <activation>
113
+                <property>
114
+                    <name>performRelease</name>
115
+                    <value>true</value>
116
+                </property>
117
+            </activation>
118
+            <build>
119
+                <plugins>
120
+                    <plugin>
121
+                        <groupId>org.apache.maven.plugins</groupId>
122
+                        <artifactId>maven-gpg-plugin</artifactId>
123
+                        <version>1.4</version>
124
+                        <executions>
125
+                            <execution>
126
+                                <id>sign-artifacts</id>
127
+                                <phase>verify</phase>
128
+                                <goals>
129
+                                    <goal>sign</goal>
130
+                                </goals>
131
+                            </execution>
132
+                        </executions>
133
+                    </plugin>
134
+                </plugins>
135
+            </build>
136
+        </profile>
137
+    </profiles>
138
+</project>
139
+
140
+
0 141
new file mode 100644
... ...
@@ -0,0 +1,78 @@
0
+package im.bci.jnuit.playn.java;
1
+
2
+
3
+import im.bci.jnuit.NuitDisplay;
4
+import im.bci.jnuit.display.VideoResolution;
5
+import java.util.ArrayList;
6
+import java.util.List;
7
+import java.util.TreeSet;
8
+import org.lwjgl.LWJGLException;
9
+import org.lwjgl.opengl.Display;
10
+import org.lwjgl.opengl.DisplayMode;
11
+import playn.core.PlayN;
12
+import playn.java.JavaGraphics;
13
+
14
+/*
15
+ The MIT License (MIT)
16
+
17
+ Copyright (c) 2014 devnewton <devnewton@bci.im>
18
+
19
+ Permission is hereby granted, free of charge, to any person obtaining a copy
20
+ of this software and associated documentation files (the "Software"), to deal
21
+ in the Software without restriction, including without limitation the rights
22
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
23
+ copies of the Software, and to permit persons to whom the Software is
24
+ furnished to do so, subject to the following conditions:
25
+
26
+ The above copyright notice and this permission notice shall be included in
27
+ all copies or substantial portions of the Software.
28
+
29
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
35
+ THE SOFTWARE.
36
+ */
37
+/**
38
+ *
39
+ * @author devnewton
40
+ */
41
+public class PlaynNuitJavaDisplay implements NuitDisplay {
42
+
43
+    @Override
44
+    public List<VideoResolution> listResolutions() {
45
+        try {
46
+            TreeSet<VideoResolution> resolutions = new TreeSet<VideoResolution>();
47
+            for (DisplayMode m : Display.getAvailableDisplayModes()) {
48
+                resolutions.add(new VideoResolution(m.getWidth(), m.getHeight()));
49
+            }
50
+            return new ArrayList<VideoResolution>(resolutions);
51
+        } catch (LWJGLException ex) {
52
+            throw new RuntimeException(ex);
53
+        }
54
+    }
55
+
56
+    @Override
57
+    public boolean canChangeResolution() {
58
+        return true;
59
+    }
60
+
61
+    @Override
62
+    public void changeResolution(VideoResolution resolution, boolean fullscreen) {
63
+        JavaGraphics jg = (JavaGraphics) PlayN.graphics();
64
+        jg.setSize(resolution.getWidth(), resolution.getHeight(), fullscreen);
65
+    }
66
+
67
+    @Override
68
+    public VideoResolution getResolution() {
69
+        return new VideoResolution(PlayN.graphics().width(), PlayN.graphics().height());
70
+    }
71
+
72
+    @Override
73
+    public boolean isFullscreen() {
74
+        return Display.isFullscreen();
75
+    }
76
+
77
+}
... ...
@@ -25,7 +25,7 @@ THE SOFTWARE. -->
25 25
     <parent>
26 26
         <groupId>im.bci</groupId>
27 27
         <artifactId>jnuit</artifactId>
28
-        <version>0.11</version>
28
+        <version>0.12-SNAPSHOT</version>
29 29
         <relativePath>../pom.xml</relativePath>
30 30
     </parent>
31 31
     <groupId>im.bci</groupId>
... ...
@@ -25,7 +25,7 @@ THE SOFTWARE. -->
25 25
     <parent>
26 26
         <groupId>im.bci</groupId>
27 27
         <artifactId>jnuit</artifactId>
28
-        <version>0.11</version>
28
+        <version>0.12-SNAPSHOT</version>
29 29
         <relativePath>../pom.xml</relativePath>
30 30
     </parent>
31 31
     <groupId>im.bci</groupId>
... ...
@@ -29,7 +29,7 @@ THE SOFTWARE. -->
29 29
         <version>9</version>
30 30
     </parent>
31 31
     <artifactId>jnuit</artifactId>
32
-    <version>0.11</version>
32
+    <version>0.12-SNAPSHOT</version>
33 33
     <name>jnuit</name>
34 34
     <packaging>pom</packaging>
35 35
     <description>Simple gui toolkit for lwjgl or playn videogames.</description>
... ...
@@ -56,6 +56,7 @@ THE SOFTWARE. -->
56 56
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
57 57
         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
58 58
         <lwjgl.version>2.9.1</lwjgl.version>
59
+        <playn.version>1.8.5</playn.version>
59 60
     </properties>
60 61
     <modules>
61 62
         <module>core</module>
... ...
@@ -64,6 +65,7 @@ THE SOFTWARE. -->
64 64
         <module>lwjgl</module>
65 65
         <module>lwjgl-utils</module>
66 66
         <module>playn</module>
67
+        <module>playn-java</module>
67 68
         <module>playn-utils</module>
68 69
         <module>smjpegdecoder</module>
69 70
         <module>samples</module>
... ...
@@ -150,7 +152,12 @@ THE SOFTWARE. -->
150 150
             <dependency>
151 151
                 <groupId>com.googlecode.playn</groupId>
152 152
                 <artifactId>playn-core</artifactId>
153
-                <version>1.8.5</version>
153
+                <version>${playn.version}</version>
154
+            </dependency>
155
+            <dependency>
156
+                <groupId>com.googlecode.playn</groupId>
157
+                <artifactId>playn-java</artifactId>
158
+                <version>${playn.version}</version>
154 159
             </dependency>
155 160
             <dependency>
156 161
                 <groupId>com.samskivert</groupId>
... ...
@@ -24,7 +24,7 @@ THE SOFTWARE. --><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="h
24 24
     <parent>
25 25
         <groupId>im.bci</groupId>
26 26
         <artifactId>jnuit</artifactId>
27
-        <version>0.11</version>
27
+        <version>0.12-SNAPSHOT</version>
28 28
         <relativePath>../pom.xml</relativePath>
29 29
     </parent>
30 30
     <artifactId>jnuit-samples</artifactId>
... ...
@@ -25,7 +25,7 @@ THE SOFTWARE. -->
25 25
     <parent>
26 26
         <groupId>im.bci</groupId>
27 27
         <artifactId>jnuit</artifactId>
28
-        <version>0.11</version>
28
+        <version>0.12-SNAPSHOT</version>
29 29
         <relativePath>../pom.xml</relativePath>
30 30
     </parent>
31 31
     <groupId>im.bci</groupId>
... ...
@@ -25,7 +25,7 @@ THE SOFTWARE. -->
25 25
     <parent>
26 26
         <groupId>im.bci</groupId>
27 27
         <artifactId>jnuit</artifactId>
28
-        <version>0.11</version>
28
+        <version>0.12-SNAPSHOT</version>
29 29
         <relativePath>../pom.xml</relativePath>
30 30
     </parent>
31 31
     <groupId>im.bci</groupId>