Anonymous avatar Anonymous committed 5aae282

removed scala and sbt support (it belongs in another project)

Comments (0)

Files changed (7)

   1. Download the sources:
        hg clone https://bitbucket.org/chuck/lwjgl-sandbox
 
-  2. Install SBT, following the instructions here:
-       https://github.com/harrah/xsbt/wiki/Setup
+  2. Install maven if you don't have it already.
+     Make sure the mvn executable is in your PATH
 
-  3. Open up a command prompt to where this README file is
-
-  4. Run sbt update TWICE (this patches a bug in a dependency):
-       sbt update
-       sbt update
-     (You only need to do this once unless dependencies change)
-
-  5. Run one of the examples using SBT:
-       sbt run
-     (You'll be prompted which one to run)
-
+  3. Run an example: bin/launch sandbox.misc.SpinningSquare
+     (Windows: bin\launch.bat sandbox.misc.SpinningSquare)
 
 WHAT'S HERE
 
 
   I don't cover any deployment scenarios at all, such as how to
   package the native libraries.  Like "sandbox" implies, this is just
-  a place for me and you to play around with code, and not get all
-  serious about delivering code artifacts.
+  a place to play around, not to build lasting artifacts.
 
 
 USING YOUR IDE (with maven):
 
-   First, run mvn compile in order to unpack libraries into target/lib/native.
-   Users of eclipse, use the command line -- it won't work from eclipse.   
+   First, run mvn compile in order to unpack libraries into target/natives.
+   Eclipse users, use the command line -- it won't work from the IDE yet.
 
    ECLIPSE: 
-   These steps keep you from having to edit the launch config for every demo:
      * Right click on the project, select Properties, Java Build Path.
 
      * On the "Source" tab (leftmost) select the folder for src/main/java
 
      * Click "Edit", and "External Folder".
 
-     * Find the unpacked natives folder under target/lib/native/<youros>
+     * Select target/natives
 
    IDEA: 
      * Select "Run" from the menu, then "Edit Configurations".  
 
      * Expand "Defaults", select "Application". 
 
-     * In "VM Parameters", add -Djava.library.path=target/lib/native/<youros>
-       (where <youros> is one of windows|linux|solaris|macosx)
+     * In "VM Parameters", add -Djava.library.path=target/natives
+       (or /full/path/to/project/target/natives if you prefer)
 
      * MAKE SURE you edit "VM Parameters" and NOT "Program Parameters"!
    
   Thanks to the LWJGL maintainers for making their awesome library and
   being super-fast to fix bugs.
 
-  Thanks to Diablo-D3 for hosting the maven repository for the LWJGL
-  2.7.x series.
+  Thanks to ruben01 for the maven packaging support, and to Diablo-D3
+  for hosting the maven repository for the LWJGL 2.7.x series.
 
   Finally, thanks to all the friendly people on #lwjgl on
   irc.freenode.net.  (You can find me there with the nick "sproingie")
+#!/bin/sh
+here=`dirname $0`
+cd $here
+cd ..
+
+main=$1
+shift
+
+if [ -z $main ]
+then
+    echo "Usage: $0 package.and.Class" >&2
+    echo "    Example: $0 sandbox.misc.SpinningSquare" >&2
+    exit 1
+fi
+
+export MAVEN_OPTS="-Djava.library.path=target/natives"
+exec mvn compile exec:java -Dexec.mainClass=$main -Dexec.commandLineArgs="$*"
+
+
+@echo off
+
+set MAVEN_OPTS="-Djava.library.path=target/natives"
+
+@rem TODO support commandline args
+mvn compile exec:java "-Dexec.mainClass=%1"
+
+

build.sbt

-name         := "lwjgl-sandbox"
-
-version      := "0.1.0-SNAPSHOT"
-
-scalaVersion := "2.9.1"
-
-seq(lwjglSettings: _*)
-
-seq(slickSettings: _*)
-
-libraryDependencies += "java3d" % "vecmath" % "1.3.1"
-
 
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-        <lwjgl.version>2.7.1</lwjgl.version>
+        <lwjgl.version>2.8.1</lwjgl.version>
         <slick.version>274</slick.version>
     </properties>
 
     <repositories>
         <repository>
-            <id>lwjgl</id>
-            <name>lwjgl</name>
-            <url>http://adterrasperaspera.com/lwjgl</url>
+            <id>mavenNatives</id>
+            <name>Maven Natives Repository</name>
+            <url>http://mavennatives.googlecode.com/svn/repo/</url>
+            <snapshots>
+                <enabled>true</enabled>
+            </snapshots>
         </repository>
+
         <repository>
             <id>slick</id>
             <name>slick</name>
 
     <dependencies>
         <dependency>
-            <groupId>org.lwjgl</groupId>
+            <groupId>org.lwjgl.lwjgl</groupId>
             <artifactId>lwjgl</artifactId>
             <version>${lwjgl.version}</version>
         </dependency>
         <dependency>
-            <groupId>org.lwjgl</groupId>
-            <artifactId>lwjgl-util</artifactId>
-            <version>${lwjgl.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.lwjgl</groupId>
-            <artifactId>lwjgl-jinput</artifactId>
-            <version>${lwjgl.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.lwjgl</groupId>
-            <artifactId>lwjgl-native</artifactId>
-            <version>${lwjgl.version}</version>
-        </dependency>
-        <dependency>
             <groupId>slick</groupId>
             <artifactId>slick</artifactId>
             <version>${slick.version}</version>
                     <target>1.6</target>
                 </configuration>
             </plugin>
+
             <plugin>
-                <!-- unpacks native libs to lib/native -->
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-dependency-plugin</artifactId>
-                <configuration>
-                    <artifactItems>
-                        <artifactItem>
-                            <groupId>org.lwjgl</groupId>
-                            <artifactId>lwjgl-native</artifactId>
-                            <version>${lwjgl.version}</version>
-                            <type>jar</type>
-                            <outputDirectory>${project.build.directory}/lib/native</outputDirectory>
-                            <overWrite>true</overWrite>
-                        </artifactItem>
-                    </artifactItems>
-                </configuration>
+                <groupId>com.googlecode.mavennatives</groupId>
+                <artifactId>maven-nativedependencies-plugin</artifactId>
+                <version>0.0.4</version>
                 <executions>
                     <execution>
-                        <id>unpack</id>
+                        <id>unpacknatives</id>
                         <phase>generate-resources</phase>
                         <goals>
-                            <goal>unpack</goal>
+                            <!--suppress MavenModelInspection -->
+                            <goal>copy</goal>
                         </goals>
                     </execution>
                 </executions>
             </plugin>
         </plugins>
-
-        <pluginManagement>
-            <plugins>
-                <plugin>
-                    <!-- Used (and needed) only with Eclipse Indigo and later.  -->
-                    <!--suppress MavenModelInspection -->
-                    <groupId>org.eclipse.m2e</groupId>
-                    <!--suppress MavenModelInspection -->
-                    <artifactId>lifecycle-mapping</artifactId>
-                    <!--suppress MavenModelInspection -->
-                    <version>1.0.0</version>
-                    <configuration>
-                        <lifecycleMappingMetadata>
-                            <pluginExecutions>
-                                <pluginExecution>
-                                    <pluginExecutionFilter>
-                                        <groupId>org.apache.maven.plugins</groupId>
-                                        <artifactId>maven-dependency-plugin</artifactId>
-                                        <versionRange>[1.0.0,)</versionRange>
-                                        <goals>
-                                            <goal>unpack</goal>
-                                        </goals>
-                                    </pluginExecutionFilter>
-                                    <action>
-                                        <ignore/>
-                                    </action>
-                                </pluginExecution>
-                            </pluginExecutions>
-                        </lifecycleMappingMetadata>
-                    </configuration>
-                </plugin>
-            </plugins>
-        </pluginManagement>
     </build>
-
-</project>
+</project>

project/plugins.sbt

-addSbtPlugin("com.github.philcali" % "sbt-lwjgl-plugin" % "3.1.0")

src/main/scala/sandbox/scala/SpinningSquare.scala

-package sandbox.scala
-
-import org.lwjgl.input.Keyboard._
-import org.lwjgl.opengl.{Display, DisplayMode}
-import org.lwjgl.opengl.GL11._
-
-object SpinningSquare extends App {
-  val GAME_TITLE = "Spinning Square"
-  val FRAMERATE = 60
-  val width = 640
-  val height = 480
-
-  var finished = false
-  var rotation = 0.0f
-
-  init()
-  run()
-
-  def init() {
-    Display.setTitle(GAME_TITLE)
-    Display.setVSyncEnabled(true)
-    Display.setDisplayMode(new DisplayMode(width, height))
-    Display.create()
-
-    val v = Display.getDisplayMode.getWidth.toFloat / Display.getDisplayMode.getHeight.toFloat
-    glMatrixMode(GL_PROJECTION)
-    glFrustum(-v, v, -1, 1, 1, 100)
-    glClearColor(0, 0, 0, 1)
-    glMatrixMode(GL_MODELVIEW)
-  }
-
-  def cleanup() {
-    Display.destroy()
-  }
-
-  def run() {
-    while (!finished) {
-      Display.update()
-
-      logic()
-      render()
-
-      Display.sync(FRAMERATE)
-    }
-  }
-
-  def logic() {
-    rotation += 1.0f
-    if (isKeyDown(KEY_ESCAPE) || Display.isCloseRequested)
-      finished = true
-  }
-
-  def render() {
-    glClear(GL_COLOR_BUFFER_BIT);
-    glColor3f(0, 1, 0)
-    glLoadIdentity()
-
-    glTranslatef(0, 0, -5)
-    glRotatef(rotation, 0, 0, 1)
-    val size = 3
-    glBegin(GL_QUADS)
-    glVertex2f(-size, -size)
-    glVertex2f(size, -size)
-    glVertex2f(size, size)
-    glVertex2f(-size, size)
-
-    glEnd()
-  }
-}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.