Skip to content

Demens Deum

Soft & Games

  • Software
  • Games
  • Demos
  • About us
  • Contact Us
  • English
    • Русский

Tutorial: Demon’s Cave Android At GitHub

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!

screenshots

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!

Posted bydemensdeumMay 9, 2016August 26, 2016Posted inTutorialsTags:camera2d, Demens Deum, github, logo, rajawali, tutorial

Published by demensdeum

View all posts by demensdeum

Post navigation

Previous Post Previous post:
Tutorial: Making Android Game. Setup Rajawali – Show Earth
Next Post Next post:
Demon’s Cave Android Dev Blog Update
Demens Deum, Proudly powered by WordPress.
We use cookies on our website. By clicking “Accept”, you consent to the use of ALL the cookies. Мы используем куки на сайте. Нажимая "ПРИНЯТЬ" вы соглашаетесь с этим.
Cookie settingsACCEPT/ПРИНЯТЬ
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT