mirror of
https://github.com/stan220/godot-docs.git
synced 2026-09-08 18:29:11 +00:00
Merge pull request #333 from RandomShaper/patch-4
Update creating_android_modules.rst
This commit is contained in:
@@ -88,13 +88,18 @@ Java singleton
|
||||
--------------
|
||||
|
||||
An android module will usually have a singleton class that will load it,
|
||||
this class inherits from ``Godot.SingletonBase``. A singleton object
|
||||
template follows:
|
||||
this class inherits from ``Godot.SingletonBase``. Resource identifiers for
|
||||
any additional resources you have provided for the module will be in the
|
||||
``com.godot.game.R`` class, so you'll likely want to import it.
|
||||
|
||||
A singleton object template follows:
|
||||
|
||||
.. code:: java
|
||||
|
||||
// package com.android.godot; // for 1.1
|
||||
package org.godotengine.godot; // for 2.0
|
||||
|
||||
import com.godot.game.R;
|
||||
|
||||
public class MySingleton extends Godot.SingletonBase {
|
||||
|
||||
@@ -214,6 +219,24 @@ module, add it like this:
|
||||
env.android_add_java_dir("Directory that contain MySingelton.java")
|
||||
env.android_add_to_manifest("AndroidManifestChunk.xml")
|
||||
|
||||
|
||||
|
||||
Resources
|
||||
---------
|
||||
|
||||
In order to provide additional resources with your module you have to
|
||||
add something like this:
|
||||
|
||||
.. code:: python
|
||||
|
||||
def configure(env):
|
||||
if env['platform'] == 'android':
|
||||
# [...]
|
||||
env.android_add_res_dir("Directory that contains resource subdirectories (values, drawable, etc.)")
|
||||
|
||||
Now you can refer to those resources by their id (``R.string.my_string``, and the like)
|
||||
by importing the ``com.godot.game.R`` class in your Java code.
|
||||
|
||||
SDK library
|
||||
-----------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user