|
1 /* |
|
2 * Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 package javax.microedition.m3g; |
|
20 |
|
21 public class World extends Group |
|
22 { |
|
23 //------------------------------------------------------------------ |
|
24 // Instance data |
|
25 //------------------------------------------------------------------ |
|
26 |
|
27 private Camera activeCamera; |
|
28 private Background background; |
|
29 |
|
30 //------------------------------------------------------------------ |
|
31 // Constructor(s) |
|
32 //------------------------------------------------------------------ |
|
33 |
|
34 public World() |
|
35 { |
|
36 super(_ctor(Interface.getHandle())); |
|
37 } |
|
38 |
|
39 /** |
|
40 */ |
|
41 World(int handle) |
|
42 { |
|
43 super(handle); |
|
44 background = (Background) getInstance(_getBackground(handle)); |
|
45 activeCamera = (Camera) getInstance(_getActiveCamera(handle)); |
|
46 } |
|
47 |
|
48 //------------------------------------------------------------------ |
|
49 // Public methods |
|
50 //------------------------------------------------------------------ |
|
51 |
|
52 public void setBackground(Background background) |
|
53 { |
|
54 _setBackground(handle, background != null ? background.handle : 0); |
|
55 this.background = background; |
|
56 } |
|
57 |
|
58 public Background getBackground() |
|
59 { |
|
60 return background; |
|
61 } |
|
62 |
|
63 public void setActiveCamera(Camera camera) |
|
64 { |
|
65 _setActiveCamera(handle, camera != null ? camera.handle : 0); |
|
66 this.activeCamera = camera; |
|
67 } |
|
68 |
|
69 public Camera getActiveCamera() |
|
70 { |
|
71 return activeCamera; |
|
72 } |
|
73 |
|
74 // Native methods |
|
75 private static native int _ctor(int hInterface); |
|
76 private static native void _setActiveCamera(int handle, int hCamera); |
|
77 private static native void _setBackground(int handle, int hBackground); |
|
78 private static native int _getActiveCamera(int handle); |
|
79 private static native int _getBackground(int handle); |
|
80 } |