• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

badlogic/lwjgl3-maven-gradle: Maven/Gradle based HelloWorld LWJGL 3 app

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

badlogic/lwjgl3-maven-gradle

开源软件地址(OpenSource Url):

https://github.com/badlogic/lwjgl3-maven-gradle

开源编程语言(OpenSource Language):

Java 100.0%

开源软件介绍(OpenSource Introduction):

LWJGL 3 Maven/Gradle sample

This sample demonstrates how to use LWJGL 3 via Maven or Gradle. The pom.xml and build.gradle files show you the general setup when using LWJGL 3 with either build system.

Maven

To use LWJGL 3 via Maven, add the following dependencies to your pom.xml:

<properties>
	<lwjgl.version>3.0.0a</lwjgl.version>
</properties>

<dependencies>
	<dependency>
		<groupId>org.lwjgl</groupId>
		<artifactId>lwjgl</artifactId>
		<version>${lwjgl.version}</version>
	</dependency>
	<dependency>
		<groupId>org.lwjgl</groupId>
		<artifactId>lwjgl-platform</artifactId>
		<version>${lwjgl.version}</version>
		<classifier>natives-windows</classifier>
	</dependency>
	<dependency>
		<groupId>org.lwjgl</groupId>
		<artifactId>lwjgl-platform</artifactId>
		<version>${lwjgl.version}</version>
		<classifier>natives-osx</classifier>
	</dependency>
	<dependency>
		<groupId>org.lwjgl</groupId>
		<artifactId>lwjgl-platform</artifactId>
		<version>${lwjgl.version}</version>
		<classifier>natives-linux</classifier>
	</dependency>
</dependencies>

Note the <properties> element, which lets you easily switch between versions of LWJGL. The lwjgl artifact contains the core API of LWJGL. The lwjgl-platform artifacts each contain the native shared libraries for the platforms Windows, Linux and Mac OS X. You can remove dependencies for platforms you don't want to support, or you can modify your build to generate platform specific distributions, only containing the shared libraries required for each platform.

LWJGL also releases snapshot builds daily to SonaType. This lets you use the latest and greatest changes from the Git master branch. To use a snapshot build, you need to add the SonaType snapshot repository to your pom.xml:

<repositories>
	<repository>
		<id>snapshots-repo</id>
		<url>https://oss.sonatype.org/content/repositories/snapshots</url>
		<releases>
			<enabled>false</enabled>
		</releases>
		<snapshots>
			<enabled>true</enabled>
		</snapshots>
	</repository>
</repositories>

Then simply change the <lwjgl.version> element to a snapshot version, e.g. 3.0.0a-SNAPSHOT.

Gradle

To use LWJGL 3 via Gradle, add the following dependencies to your build.gradle:

project.ext.lwjglVersion = "3.0.0a"

dependencies {
	compile "org.lwjgl:lwjgl:${lwjglVersion}"
	compile "org.lwjgl:lwjgl-platform:${lwjglVersion}:natives-windows"
	compile "org.lwjgl:lwjgl-platform:${lwjglVersion}:natives-linux"
	compile "org.lwjgl:lwjgl-platform:${lwjglVersion}:natives-osx"
}

Note the assignment to project.ext.lwjglVersion, which lets you easily switch between versions of LWJGL. The lwjgl artifact contains the core API of LWJGL. The lwjgl-platform artifacts each contain the native shared libraries for the platforms Windows, Linux and Mac OS X. You can remove dependencies for platforms you don't want to support, or you can modify your build to generate platform specific distributions, only containing the shared libraries required for each platform.

LWJGL also releases snapshot builds daily to SonaType. This lets you use the latest and greatest changes from the Git master branch. To use a snapshot build, you need to add the SonaType snapshot repository to your `build.gradle:

repositories {
    mavenCentral()
    maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}

Then simply assign a snapshot version to project.ext.lwjglVersion, e.g. 3.0.0a-SNAPSHOT.

Shared library loading

The source of this repository contains a class SharedLibraryLoader. It lets you load the platform specific shared library from the platform JARs pulled in as dependencies. Before accessing any LWJGL APIs, simply call:

SharedLibraryLoader.load()

You can do this as the first statement in your application's main method.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
scalamacros/maven-example: An example Maven project which uses macros (Scala 2.1 ...发布时间:2022-08-17
下一篇:
neo4j-contrib/m2: Maven Repository发布时间:2022-08-17
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap