Skip to content

Commit 749f96b

Browse files
committed
Initial commit
0 parents  commit 749f96b

File tree

151 files changed

+6840
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

151 files changed

+6840
-0
lines changed

.classpath

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" path="src"/>
4+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
5+
<classpathentry combineaccessrules="false" kind="src" path="/gdx"/>
6+
<classpathentry combineaccessrules="false" kind="src" path="/gdx-bullet"/>
7+
<classpathentry combineaccessrules="false" kind="src" path="/model-loaders"/>
8+
<classpathentry kind="output" path="bin"/>
9+
</classpath>

.project

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>World</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.jdt.core.javanature</nature>
16+
</natures>
17+
</projectDescription>
163 Bytes
Binary file not shown.
1.62 KB
Binary file not shown.
1.32 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4.27 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
516 Bytes
Binary file not shown.
7.86 KB
Binary file not shown.
883 Bytes
Binary file not shown.
Binary file not shown.
2.56 KB
Binary file not shown.
1.37 KB
Binary file not shown.
1.49 KB
Binary file not shown.
10.1 KB
Binary file not shown.
2.49 KB
Binary file not shown.
1.68 KB
Binary file not shown.
2.28 KB
Binary file not shown.
2 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
9.06 KB
Binary file not shown.
2.93 KB
Binary file not shown.
4.44 KB
Binary file not shown.
1.35 KB
Binary file not shown.
1.58 KB
Binary file not shown.
2.81 KB
Binary file not shown.
2.64 KB
Binary file not shown.
1.24 KB
Binary file not shown.
1.24 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
7.03 KB
Binary file not shown.
Binary file not shown.
2.79 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
13.9 KB
Binary file not shown.
1.96 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
953 Bytes
Binary file not shown.
913 Bytes
Binary file not shown.
5.44 KB
Binary file not shown.
417 Bytes
Binary file not shown.
1.1 KB
Binary file not shown.
7.93 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

bin/com/xoppa/math/Bezier$Curve.class

931 Bytes
Binary file not shown.
1020 Bytes
Binary file not shown.

bin/com/xoppa/math/Bezier.class

2.43 KB
Binary file not shown.

bin/com/xoppa/math/Bspline.class

4.34 KB
Binary file not shown.

bin/com/xoppa/math/Knots.class

3.61 KB
Binary file not shown.

bin/com/xoppa/math/Path.class

186 Bytes
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.xoppa.android.game;
2+
3+
import com.badlogic.gdx.Screen;
4+
5+
public interface IManagedScreen extends Screen {
6+
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
package com.xoppa.android.game;
2+
3+
import com.badlogic.gdx.Game;
4+
import com.badlogic.gdx.Screen;
5+
6+
public abstract class ManagedGame extends Game {
7+
protected IManagedScreen mSplashScreen;
8+
protected IManagedScreen mMainScreen;
9+
10+
protected abstract IManagedScreen onCreateSplashScreen();
11+
protected abstract void onStartLoadingGlobalResources();
12+
protected abstract IManagedScreen onCreateMainScreen();
13+
14+
public abstract String getTitle();
15+
public abstract boolean getUseGL20();
16+
17+
@Override
18+
public void create() {
19+
showSplashScreen();
20+
onStartLoadingGlobalResources();
21+
}
22+
23+
@Override
24+
public void dispose() {
25+
super.dispose();
26+
if (mSplashScreen != null) {
27+
mSplashScreen.dispose();
28+
mSplashScreen = null;
29+
}
30+
if (mMainScreen != null) {
31+
mMainScreen.dispose();
32+
mMainScreen = null;
33+
}
34+
}
35+
36+
public void showSplashScreen() {
37+
if (mSplashScreen == null)
38+
mSplashScreen = onCreateSplashScreen();
39+
if (mSplashScreen != null)
40+
setScreen(mSplashScreen);
41+
}
42+
43+
public void globalResourcesLoaded() {
44+
showMainScreen();
45+
}
46+
47+
public void showMainScreen() {
48+
if (mMainScreen == null)
49+
mMainScreen = onCreateMainScreen();
50+
if (mMainScreen != null)
51+
setScreen(mMainScreen);
52+
if (mSplashScreen != null) {
53+
mSplashScreen.dispose();
54+
mSplashScreen = null;
55+
}
56+
}
57+
58+
@Override
59+
public void setScreen(Screen screen) {
60+
super.setScreen(screen);
61+
}
62+
@Override
63+
public Screen getScreen() {
64+
return super.getScreen();
65+
}
66+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package com.xoppa.android.game;
2+
3+
public class ManagedScreen<T> implements IManagedScreen {
4+
public final T mGame;
5+
6+
public ManagedScreen(final T pGame) {
7+
mGame = pGame;
8+
}
9+
10+
@Override
11+
public void render(float delta) {
12+
}
13+
14+
@Override
15+
public void resize(int width, int height) {
16+
}
17+
18+
@Override
19+
public void show() {
20+
}
21+
22+
@Override
23+
public void hide() {
24+
}
25+
26+
@Override
27+
public void pause() {
28+
}
29+
30+
@Override
31+
public void resume() {
32+
}
33+
34+
@Override
35+
public void dispose() {
36+
}
37+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
package com.xoppa.android.loaders.material.orge;
2+
3+
import java.io.BufferedReader;
4+
import java.io.IOException;
5+
import java.io.InputStreamReader;
6+
7+
import com.badlogic.gdx.Gdx;
8+
import com.badlogic.gdx.assets.AssetDescriptor;
9+
import com.badlogic.gdx.assets.AssetLoaderParameters;
10+
import com.badlogic.gdx.assets.AssetManager;
11+
import com.badlogic.gdx.assets.loaders.FileHandleResolver;
12+
import com.badlogic.gdx.assets.loaders.SynchronousAssetLoader;
13+
import com.badlogic.gdx.files.FileHandle;
14+
import com.badlogic.gdx.graphics.Color;
15+
import com.badlogic.gdx.graphics.Texture;
16+
import com.badlogic.gdx.graphics.Texture.TextureFilter;
17+
import com.badlogic.gdx.graphics.Texture.TextureWrap;
18+
import com.badlogic.gdx.graphics.g3d.materials.ColorAttribute;
19+
import com.badlogic.gdx.graphics.g3d.materials.Material;
20+
import com.badlogic.gdx.graphics.g3d.materials.MaterialAttribute;
21+
import com.badlogic.gdx.graphics.g3d.materials.MaterialCollection;
22+
import com.badlogic.gdx.graphics.g3d.materials.TextureAttribute;
23+
import com.badlogic.gdx.utils.Array;
24+
import com.badlogic.gdx.utils.ObjectMap;
25+
26+
public class OgreMaterialLoader extends SynchronousAssetLoader<MaterialCollection, AssetLoaderParameters<MaterialCollection>> {
27+
MaterialCollection result = null;
28+
Array<AssetDescriptor> dependencies = new Array<AssetDescriptor>();
29+
ObjectMap<TextureAttribute, String> textures = new ObjectMap<TextureAttribute, String>();
30+
31+
public OgreMaterialLoader(FileHandleResolver resolver) {
32+
super(resolver);
33+
}
34+
35+
@Override
36+
public MaterialCollection load(AssetManager assetManager, String fileName, AssetLoaderParameters<MaterialCollection> params) {
37+
for (ObjectMap.Entry<TextureAttribute, String> entry : textures.entries()) {
38+
entry.key.texture = assetManager.get(entry.value, Texture.class);
39+
Gdx.app.log("OgreMaterialLoader", "Set texture of material to: "+entry.key.texture);
40+
}
41+
MaterialCollection result = this.result;
42+
this.result = null;
43+
return result;
44+
}
45+
46+
@Override
47+
public Array<AssetDescriptor> getDependencies(String fileName, AssetLoaderParameters<MaterialCollection> params) {
48+
this.result = new MaterialCollection();
49+
this.textures.clear();
50+
this.dependencies.clear();
51+
FileHandle file = resolve(fileName);
52+
BufferedReader reader = null;
53+
try {
54+
load(reader = new BufferedReader(new InputStreamReader(file.read()), 4096), file.parent());
55+
Gdx.app.log("OgeMaterialLoader", "Loaded material: "+file.path());
56+
} catch (IOException e) {
57+
e.printStackTrace();
58+
} finally {
59+
if (reader != null)
60+
try {
61+
reader.close();
62+
} catch (IOException e) {
63+
e.printStackTrace();
64+
}
65+
}
66+
return dependencies;
67+
}
68+
69+
protected void load(final BufferedReader reader, final FileHandle base) throws IOException {
70+
String line;
71+
Material current = null;
72+
while((line = reader.readLine()) != null) {
73+
final String[] tokens = line.trim().split("\\s+");
74+
if (tokens[0].compareTo("material")==0) {
75+
if (current != null)
76+
result.add(current);
77+
current = new Material(tokens[1], new Array<MaterialAttribute>(1));
78+
}
79+
else if (current != null) {
80+
if (tokens[0].compareTo("diffuse") == 0)
81+
current.addAttribute(new ColorAttribute(parseColor(tokens), ColorAttribute.diffuse));
82+
else if (tokens[0].compareTo("specular") == 0)
83+
current.addAttribute(new ColorAttribute(parseColor(tokens), ColorAttribute.specular));
84+
else if (tokens[0].compareTo("texture") == 0)
85+
current.addAttribute(parseTextureAttribute(tokens, base));
86+
}
87+
}
88+
if (current != null)
89+
result.add(current);
90+
}
91+
92+
protected Color parseColor(final String[] tokens) {
93+
final Color result = new Color(0f, 0f, 0f, 1f);
94+
if (tokens.length > 1) result.r = Float.parseFloat(tokens[1]);
95+
if (tokens.length > 2) result.g = Float.parseFloat(tokens[2]);
96+
if (tokens.length > 3) result.b = Float.parseFloat(tokens[3]);
97+
if (tokens.length > 4) result.a = Float.parseFloat(tokens[4]);
98+
return result;
99+
}
100+
101+
protected TextureAttribute parseTextureAttribute(final String[] tokens, final FileHandle base) {
102+
final TextureAttribute result = new TextureAttribute(null, 0, "s_tex", TextureFilter.Linear, TextureFilter.Linear, TextureWrap.ClampToEdge, TextureWrap.ClampToEdge);
103+
final String filename = base.child(tokens[1]).path();
104+
boolean found = false;
105+
for (int i = 0; i < dependencies.size; i++) {
106+
if (dependencies.get(i).fileName.compareTo(filename)==0) {
107+
found = true;
108+
break;
109+
}
110+
}
111+
if (!found)
112+
dependencies.add(new AssetDescriptor(filename, Texture.class));
113+
textures.put(result, filename);
114+
return result;
115+
}
116+
}

0 commit comments

Comments
 (0)