Happy victory day!
Today Demon’s Cave game code for Android has been released at GitHub:
https://github.com/demensdeum/DemonsCaveAndroid
I have no time right now for record YouTube tutorial, so here is short text version.
Now you can just download Demon’s Cave code and compile on your machine.
We are going to show Demens Deum Logo on top of Rajawali engine (OpenGL-ES 2.0)
1. Download Demens Deum Logo png file
http://demensdeum.com/games/demonsCave/data/graphics/demensdeumLogo.png
2. Install Gimp, and flip image by horizontal
sudo apt-get install gimp
3. Add fullscreen activity settings
Add this code to onCreate method of MainActivity.java class
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); requestWindowFeature(Window.FEATURE_NO_TITLE);
Add/replace those settings to res/values/styles.xml
<resources> <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <item name="colorPrimary">@color/colorPrimaryitem> <item name="colorPrimaryDark">@color/colorPrimaryDarkitem> <item name="colorAccent">@color/colorAccentitem> <item name="android:windowNoTitle">trueitem> <item name="android:windowActionBar">falseitem> <item name="android:windowFullscreen">trueitem> <item name="android:windowContentOverlay">@nullitem> <style> <resources>
4. Initialize Camera2D
Add private value to Renderer.class
import org.rajawali3d.cameras.Camera2D;
Add new method to initialize Camera2d
protected void initializeCamera() { gameCamera = new Camera2D(); getCurrentScene().addCamera(gameCamera); getCurrentScene().switchCamera(gameCamera); }
5. Add Plane primitive with demensdeum_logo.png image to Scene
Add new private value Plane to Renderer.java class
private Plane plane;
Add new method to initialize Plane
protected void initializePlane() { Material material = new Material(); material.enableLighting(false); material.setDiffuseMethod(new DiffuseMethod.Lambert()); material.setColor(0); Texture earthTexture = new Texture("Earth", R.drawable.demensdeum_logo); try{ material.addTexture(earthTexture); } catch (ATexture.TextureException error){ Log.d("DEBUG", "TEXTURE ERROR"); } plane = new Plane(1, 1, 2, 2); plane.setPosition(0,0,0); plane.setMaterial(material); }
Add changes to scene initialization code:
@Override protected void initScene() { initializeCamera(); initializePlane(); getCurrentScene().addChild(plane); getCurrentCamera().setZ(200.2f); }
6. Add demensdeum_logo.png into res/drawable directory
7. Compile and run on your android device!
You will see Demens Deum company logo on your android device. If it’s flipped by horizontal, just flip it in Gimp first.
Or (for advanced users) try to use last Rajawali engine, this is known issue.
If you have questions, just ask me.
Keep learning!