Tag: application
How to: Create a splash screen
by Martin on Oct.14, 2009, under how to
Many Applications, mostly games, on the market show splash screens. With this screen they prompt a logo for the application and/or the author.
I will show you a short way to implement a splash screen which will occur on every startup, will stay for a number of seconds you can define, will close on touching the screen and will not reappear on pressing the back button.
I created an empty project named SplashScreen with the activity SplashScreen. This activity will display the splash screen, so we have to create a new activity which will be the first real view you want to display. In my case this activity is named MyApp.
(continue reading…)
Android 3D game tutorial – Part VI
by Martin on Sep.02, 2009, under tutorial
Updated to be Android 2.0.1 compatible.
You are new to this series? Please start with the first part.
The sixth part of this series will show you how you create the correct perspective because 3D is nothing without the correct perspective.
Before we start we should discuss the two possible “views” OpenGL offers: orthographic and perspective.
(continue reading…)
How to create an option menu
by Martin on Aug.28, 2009, under how to
Today we learn how you can create an option menu for your application.
Lets start with an empty android project. The package name will be com.droidnova.android.howto.optionmenu and the activity will have the name SimpleOptionMenu.
Our activity should now look very familiar to us:
1 2 3 4 5 6 7 8 9 10 11 12 13 | package com.droidnova.android.howto.optionmenu; import android.app.Activity; import android.os.Bundle; public class SimpleOptionMenu extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } } |
Android 3D game tutorial – Part V
by Martin on Aug.21, 2009, under tutorial
Updated to be Android 2.0.1 compatible.
You are new to this series? Please start with the first part.
The fifth part of this series will show you how you can create your first full 3d object. In this case a 4 sided pyramid.
Some preparation will be needed to make our future development much easier.
We have to be more dynamic in calculating our buffers and creating arrays with the correct size. (continue reading…)
Android 3D game tutorial – Part IV
by Martin on Aug.19, 2009, under tutorial
Updated to be Android 2.0.1 compatible.
You are new to this series? Please start with the first part.
The fourth part of this series will show you how to add some colors to you triangle.
In the last part we created a second static triangle to prove the rotation of the triangle and not the entire scene. We will now get rid of this static triangle by removing the function initStaticTriangle(), removing both buffers, _indexBufferStatic and _vertexBufferStatic, used for it. We also have to remove the last 4 lines of code of our onDrawFrame() where we initialized the static triangle. (continue reading…)
Android 3D game tutorial – Part III
by Martin on Aug.18, 2009, under tutorial
Updated to be Android 2.0.1 compatible.
You are new to this series? Please start with the first part.
The third part of this series will show you how to stop the rotation of the triangle and that the rotation really just work on the triangle and not the “camera”.
We want to have more control over the rotation. To get that, we reset the matrix on every call of the onDrawFrame() method. This will reset the angle of our triangle so it always it stays rotated at the given angle on initialization. (continue reading…)
Android 3D game tutorial – Part II
by Martin on Aug.17, 2009, under tutorial
Updated to be Android 2.0.1 compatible.
You are new to this series? Please start with the first part.
The second part of this series will show you how to add a triangle and how to rotate it a bit.
The first thing we have to do is to initialize the triangle we want to display. We have to create a function named initTriangle() in our VortexRenderer class.
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 | // new object variables we need // a raw buffer to hold indices private ShortBuffer _indexBuffer; // a raw buffer to hold the vertices private FloatBuffer _vertexBuffer; private short[] _indicesArray = {0, 1, 2}; private int _nrOfVertices = 3; // code snipped private void initTriangle() { // float has 4 bytes ByteBuffer vbb = ByteBuffer.allocateDirect(_nrOfVertices * 3 * 4); vbb.order(ByteOrder.nativeOrder()); _vertexBuffer = vbb.asFloatBuffer(); // short has 2 bytes ByteBuffer ibb = ByteBuffer.allocateDirect(_nrOfVertices * 2); ibb.order(ByteOrder.nativeOrder()); _indexBuffer = ibb.asShortBuffer(); float[] coords = { -0.5f, -0.5f, 0f, // (x1, y1, z1) 0.5f, -0.5f, 0f, // (x2, y2, z2) 0f, 0.5f, 0f // (x3, y3, z3) }; _vertexBuffer.put(coords); _indexBuffer.put(_indicesArray); _vertexBuffer.position(0); _indexBuffer.position(0); } |
Android 3D game tutorial – Part I
by Martin on Aug.10, 2009, under tutorial
Updated to be Android 2.0.1 compatible.
The first part of this series will give you a short introduction to the OpenGL terminology and the first step in your 3D programming.
The series itself will be about a 3D game called Vortex.
The tutorial will focus on 3D programming, stuff like menu or life cycle may be part of the code but will not be introduced.
Lets start with the terminology of OpenGL.
(continue reading…)
Playing with graphics in Android – Part VII
by Martin on Jul.06, 2009, under tutorial
You are new to this series? Please start with the first part.
In our last part of this series, I will present a mini “game” based on the very famous game “Rock, Paper, Scissors”.
The follow features are fully implemented:
- Add a rock, paper or scissors by touching the screen
- Define speed and direction by touch-drag-release
- On collision the loser explodes
- There’s a sound on explosion
Playing with graphics in Android – Part VI
by Martin on Jun.05, 2009, under tutorial
You are new to this series? Please start with the first part.
The sixth part of this series will let you move the item you will add. As long as you touch the screen, you can change the position of the bitmap you want to add.
We simply have to add a temporary class variable in our Panel class.
1 | private GraphicObject _currentGraphic = null; |