サイトのトップへ戻る

libGDX ドキュメント 日本語訳

サードパーティ製拡張のサポート



LibGDX の設定におけるサードパーティ製拡張のサポート


LibGDX の設定時にはサードパーティ製の拡張についても設定が行われます。これらの拡張はLibGDX 開発チームが管理していないコミュニティのメンバーによって作成されています。 これにより、ユーザー自身が自分でビルドスクリプトを編集しなくても、これらサードパーティ製拡張を使ったプロジェクトを簡単に生成できます。 (ビルドプロジェクトの編集がそんなに難しいというわけではありませんが)。



LibGDX 設定時に拡張を取得する方法



Requirements




Am I an extension?

As much as you may try... no you are not (Unless you are an advanced AI extension, in which case, citation needed), but you may be developing one!

Does your project aim to extend LibGDX with a specific goal in mind?
あなたのプロジェクトは LibGDX ユーザーにとって有用なものですか?
あなたのプロジェクトは安定していますか?
あなたのプロジェクトは Maven centralに公開されていますか?

Congratulations! It's an extension!



承認

To get your beautiful extension in the setup, you must sneak past/bribe/bewitch the LibGDX developers into thinking that your extension belongs in the setup. To do this, make sure:

  • Your project is open source, for security issues
  • Your project is well established
  • Your project is well maintained, (we will remove it if it becomes unsupported/not maintained!)


Extension definition

We use a simple xml file in the LibGDX core repository to define external extensions.

The file can be found here

An example of this file:

<?xml version="1.0" encoding="UTF-8"?>
<extensions>
    <extension>
       <name>My Extension</name> <!-- Extension name -->
       <description>What my extension does</description> <!-- Short description of your extension-->
       <package>my.package.cheeky</package> <!-- Package name-->
       <version>0.0.1</version>             <!-- Current release version of your extension-->
       <compatibility>1.5.3</compatibility> <!-- Latest version of LibGDX your extension is compatible with-->
       <website>http://mywebsite.com</website>  <!-- Url of your extension, either your extension website/github-->
       <gwtInherits>
              <inherit>cheeky</inherit>     <!-- GWT module of your extension, for the HTML project -->
       </gwtInherits>
       <projects>
           <core>                                 <!-- All dependencies for the core project-->
               <dependency>groupId:artifactId</dependency> <!--A single dependency-->
           </core>
           <desktop>
               <dependency>groupId:artifactId:classifier</dependency> <!--Multiple dependencies -->
               <dependency>groupId:artifactIdTwo:classifierTwo</dependency> <!--Multiple dependencies -->
           </desktop>                                          <!--All dependencies for the desktop project-->
           <android></android>                                <!--All dependencies for the android project-->
           <ios>null</ios>                                    <!--All dependencies for the ios project-->
           <html>groupId:artifactIdTwo:classifierTwo</html>   <!--All dependencies for the html project-->
       </projects>
    </extension>
</extensions>


How dependencies are declared in the extensions.xml file

Under the tag are all the LibGDX supported platforms. Core/Desktop/ios/Android/HTML. In each of these project tags, you can include the dependency deceleration/s for each platform.


In the above example, there is a dependency for the core project on the artifact: groupId:artifactId This means that when the project is generated with the extension ticked, we end up with:

compile "groupId:artifactId:0.0.1"

In our core project dependency section.

We also have two dependencies for the desktop platform, groupId:artifactId:classifier and groupId:artifactIdTwo:classifierTwo. This would result in:

compile "groupId:artifactId:0.0.1:classifier"
compile "groupId:artifactIdTwo:0.0.1:classifierTwo"

In our desktop project dependency section.


This is the same for all platorms.
A few notes:

  • If you don't support a platform, you must put null like in the ios project above.
  • If you don't have any extras dependencies for platform, (as they are inherited from core for example) leave the section clear, like android in the example above.
  • Html projects require the source of dependencies! Make sure you push this source artifact and declare it in the extensions.xml!

This provides all the information required to display your extension and add it to user's projects in the setup.

You must provide all the data shown above, appended to the extensions.xml file and submit your addition as a PR.