aboutsummaryrefslogtreecommitdiff
path: root/engine/src/core/com/jme3/app/package.html
blob: ec6bb9a8988016662335158ef7a29421387dc4db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>

The <code>com.jme3.application</code> provides a toolset for jME3 applications
to interact with various components of the engine. Typically, the
{@link com.jme3.app.Application} class will be extended and the update() method
implemented to provide functionality for the main loop. <br>
<p>
An <code>Application</code> will typically provide the following services:
<ul>
    <li>{@link com.jme3.asset.AssetManager} - A system for finding and loading
    data assets included with the application, such as models and textures.</li>
    <li>{@link com.jme3.renderer.RenderManager} - A high-level rendering
        interface for 3D graphics, manages viewports and scenes assigned
        to the viewports, as well as general high-level rendering.</li>
    <li>{@link com.jme3.input.InputManager} - An interface for handling input
        from devices such as keyboard, mouse, and gamepad/joystick.</li>
    <li>{@link com.jme3.app.state.AppStateManager} - Manager for
        {@link com.jme3.app.state.AppState}s, which are specific application
        functionality to be executed inside the main loop.</li>
    <li>{@link com.jme3.audio.AudioRenderer} - Allows playing sound effects and 
        music.</li>
    <li>{@link com.jme3.system.Timer} - The timer keeps track of time and allows
        computing the time since the last frame (TPF) that is neccessary
        for framerate-independent updates and motion.</li>
    <li>{@link com.jme3.system.AppSettings} - A database containing various
        settings for the application. These settings may be set by the user
        or the application itself.</li>
</ul>


<h3>Usage</h3>

An example use of the Application class is as follows<br>
<br>

<code>
public class ExampleUse extends Application {<br>
<br>
    private Node rootNode = new Node("Root Node");<br>
<br>
    public static void main(String[] args){<br>
        ExampleUse app = new ExampleUse();<br>
        app.start();<br>
    }<br>
<br>
    @Override<br>
    public void initialize(){<br>
        super.initialize();<br>
<br>
        // attach root node to viewport<br>
        viewPort.attachScene(rootNode);<br>
    }<br>
<br>
    @Override<br>
    public void update(){<br>
        super.update();<br>
<br>
        float tpf = timer.getTimePerFrame();<br>
<br>
        // update rootNode<br>
        rootNode.updateLogicalState(tpf);<br>
        rootNode.updateGeometricState();<br>
<br>
        // render the viewports<br>
        renderManager.render(tpf);<br>
    }<br>
}<br>
<br>
</code>

</body>
</html>