Dez 16

Bei einem Autocomplete Input-Feld mit JQuery (Autocomplete-Plugin von pengoworks.com), bei dem viele Elemente zurückgeliefert wurden, entstand eine Scrollbar in dem Resultate-Div. Das Problem: Ein Klick auf die Scrollbar im IE oder Opera klappte die gesamte Resultate-Liste zu, anscheinend auf Grund eines Javascript-Events blur() auf dem Input-Feld. Durch dieses Event wurde die Resultate-Liste geschlossen.

Mein Fix in jquery.autocomplete.js:

Weiterlesen »

Sep 29

Wir suchen zum 01.11. oder später für unsere schöne Wohnung in Paderborn-Wewer einen Nachmieter.
- 3Zi. Dachgeschoß-Wohnung, ca. 70qm, in Sackgasse gelegen
- Badezimmer mit Dusche u. Vollbad, Kellerraum, Autostellplatz
- großer überdachter Balkon über die ganze Hausbreite
- vor gerade 10 Monaten schön renoviert/tapeziert
- Laminat im Schlafzimmer/Büro, Parkett im Wohnzimmer, Fliesen in Flur und Bad

UPDATE:
Die Wohnung ist weg.

Jul 28

I’ve had a problem after the update of the nbandroid plugin for NetBeans. After updating the debugging mode neither in emulator, nor on real device, doesn’t work anymore.

To fix this, put the following lines in build-impl.xml in the debugging section. Just remove the old part and paste in the new:

<target depends="init,-debug-start-debuggee" if="netbeans.home" name="-debug-start-debugger">
      <androidproject1:nbjpdaconnect/>
  </target>
  <target depends="init,compile,-start-emulator,-wait-for-emulator,-install-app" name="-debug-start-debuggee">
      <exec executable="${adb}">
          <arg line="${android.target.device}"/>
          <arg value="shell"/>
          <arg value="am start -D -n ${main.component}/${main.class}"/>
      </exec>
      <getdebuggerport addressProperty="local.debug.port" app="${main.component}"/>
  </target>
  <target depends="init,compile,-debug-start-debuggee,-debug-start-debugger" description="Debug project in IDE." if="netbeans.home" name="debug"/>
  <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
      <androidproject1:nbjpdastart stopclassname="${main.class}"/>
  </target>
  <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
Jul 16

Unter den neuen Widgets die ich für die Vodafone Widget Runtime programmiert habe ist u.a. “Galaxy Lander”. Ein Spiel, das wahrscheinlich viele schon auf programmierbaren Taschenrechnern gespielt haben. Mehr Funktionaliät als damals gibt es auch nicht, nur etwas schönere Grafiken :-)

In 3 Levels kann der Spieler Versuchen seine Landefähre auf dem Mond, dem Mars oder dem Jupiter zu landen. Natürlich ist der Jupiter das schwerste Level, aber es ist möglich heile anzukommen! Mit der “Hoch”-Taste des Handys kann der Spieler die Raketen zünden und damit den Fall abbremsen, aber Achtung: Man hat keinen unendlichen Kerosinvorrat!
Viel Spaß macht auch der umgekehrte Spielmodus: “Wer macht den tiefsten Krater?”. Probiert’s mal aus!

Also viel Spaß beim Spielen, hier mal der Link auf die deutsche Version:
Galaxy Lander downloaden

Jun 24

This is part 2 of my Android mobile game series. I want to develop a game just like my Widget game for the Vodafone Widget Runtime: Space Janitor.

So, in the last part we created some parts of the UI the user sees when he starts the game.

Today we want to create a small part of the real “Game View”!
First, lets change the standard layout of the Android App. The layout file can be found in res/layout/main.xml.
The standard is a simple LinearLayout with a TextView, that currently just displays “Hello…” when you start the game.
Let’s remove this part and change it to:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
 
    <GameView
    	android:id="@+id/game"
    	android:layout_width="fill_parent"
    	android:layout_height="fill_parent" />
 
    <RelativeLayout
	android:layout_width="fill_parent"
	android:layout_height="fill_parent">
	<TextView
		android:id="@+id/text"
		android:text="@string/space_janitor_info_text"
		android:visibility="visible"
		android:layout_height="wrap_content"
		android:layout_width="wrap_content"
		android:layout_centerInParent="true"
		android:gravity="center_horizontal"
		android:textColor="#88ffffff"
		android:textSize="24sp" />
    </RelativeLayout>
</FrameLayout>

First, we define a Game View that we can use later on to hold the game graphics. Second we defined a RelativeLayout that holds a TextView, we need this to display some infos later on.

Now let’s extend the code to use this views.

Create a new class called GameView in your App. The GameView extends SurfaceView and has to implement the SufaceHolder.Callback interface. Add the yet unimplemented methods and a constructor to fulfill the interface’s requirements.

public class GameView extends SurfaceView implements SurfaceHolder.Callback {
 
	public GameView(Context context, AttributeSet attrs) {
		super(context, attrs);
		// TODO Auto-generated constructor stub
	}
 
	public void surfaceChanged(SurfaceHolder holder, int format, int width,
			int height) {
		// TODO Auto-generated method stub
 
	}
 
	public void surfaceCreated(SurfaceHolder holder) {
		// TODO Auto-generated method stub
 
	}
 
	public void surfaceDestroyed(SurfaceHolder holder) {
		// TODO Auto-generated method stub
 
	}
}

The SurfaceView is designated to hold the game graphics. Via the SurfaceHolder.Callback we are informed about dimension changes, i.e. when the user switches to landscape mode.

In the Main View we now have to code a connection to the Game View, we’ll do this via an instance variable of GameView. Add a variable of the type “GameView” to your Activity.

public class SpaceJanitor extends Activity {
	private static final int MENU_START = 1;
	private GameView myGameView;
        ...
}

In our “onCreate”-method we have to initialize this variable and we would like to give the GameView the ability to display some info in the TextView we recently defined in our layout file, like “Game Over”, etc. So:

public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
 
   requestWindowFeature(Window.FEATURE_NO_TITLE);
   setContentView(R.layout.main);
   myGameView = (GameView) findViewById(R.id.game);
   myGameView.setTextView = (TextView) findViewById(R.id.text);
}

This implies that we have to add a method “setTextView” in the GameView class to save a reference on this TextView locally.

public void setTextView(TextView findViewById) {
		// TODO Auto-generated method stub	
	}

In the next part we will add a thread to handle graphic updates, user actions, etc. etc.

Jun 18

Die 4-Wege Navigation (also das navigieren im Widget ohne den virtuellen Cursor) kann im Widget so funktionieren:
Die Runtime springt von Link zu Link je nachdem in welche Richtung der User auf dem Joypad des Handys klickt. Man kann sich das wie einen unsichtbaren Mauszeiger vorstellen, der dann auf die jeweiligen Navigationselemente fokussiert.
Interessanterweise springt der unsichtbare Zeiger aber auch auf -Tags.

Folgendes Beispiel:

...
< img src="einbild.png">
< a id="quitbutton">Quit
...

Dann müsste der User 2mal auf seinem Joypad nach unten klicken bis der Anchor-Tag aktiviert wird und der Zustand “hover” gesetzt wird. Der unsichtbare Mauszeiger springt erst zu dem Bild, dieses hat keinen “hover”-Zustand also sieht man keine Veränderung, erst beim nächsten Klick sieht man, dass überhaupt etwas beim Klicken passiert.

Das ist nervig und umgehen kann man das, indem man die Bilder z.B. als Div mit einem background-image anzeigt. Dann wird im Beispiel oben das Bild nicht angesprungen, sondern direkt der Link, was dem Handybenutzer auch logischer erscheinen wird.

#einbild_container{
  background-image: url(einbild.png);
  width: bildbreite;
  height: bildhöhe;
  background-repeat: no-repeat;
}


< div id="einbild_container">
< a id="quitbutton">Quit

Jun 01

Game development tutorial on Android – Part 1

First I have to say that I am using Eclipse and the Android plugin to program, because it really minifies the work needed. If your using another IDE you have to change some of the steps according to your IDE’s workflow, but the code stays the same.

I decided that my game should have a welcome screen and an options menu to start the game (or later when playing to pause or stop the game). That is easily done with Android.
First lets create a new project in Android, name it what you like, I chose “Space Janitor” (I assume that you already now how to create new Android project, otherwise refer to one of the many tutorials).

Weiterlesen »

Jun 01

I am currently learning more on Android development and for me the best way to learn something new is to try it out by myself. It’s the same when I learn new ways of programming: reading books and tutorials is fine, but when I try to build my own apps I learn even more.

So I decided to write a simple game for the Android platform, not that there aren’t already enough games in the Android Market, more because in the last weeks I mostly concentrated on developing games for the Vodafone mobile widget runtime. I made a game called “Space Janitor”, which I now want to port to the Android platform. I would like to extend the game at some points, i.e. making use of the device accelerometer sensors to move the spaceship to the left or to the right, or vibrating the mobile when being hit by an asteroid. That would be real fun.

Another good way to learn is to try to explain the things one learned to others. That was a great way to learn during my university time, because the professors always wanted to have something explained :-) So if one already explained the learned things to others, it was no problem to explain it again to the professor. I now decided to keep track of my development by writing some blog posts about how to develop the game, thus explaing it to others. But I would also very much appreciate your comments on how to improve the quality and the speed of my code as I would call myself just a novice in Android programming. Maybe you’ve also got some more tipps for game improvement, game handling, gameplay, etc.

I will somewhat unregularly post new entries in my blog, so keep in touch.

Mai 06

Space Janitor ist zur App of the Week ausgesucht worden, momentan leider “nur” in Italien :-)

Mal schauen wann es in Deutschland zu haben ist.

App of the Week

Apr 27

Heute wurde mein erstes Spiel für die Vodafone Mobile Widget Runtime vom Vodafone-Team freigeschaltet. Hoffentlich ist es dann auch bald auf den deutschen Vodafone-Widget Seiten zu finden, bis dahin kann man es unter diesem Link direkt herunterladen und aufs Handy, z.B. per Bluetooth, laden.

Mit einem Klick auf die übertragene Datei wird dann der Widget Manager von Vodafone (falls noch nicht auf dem Handy, dann hier runterladen) und das Spiel gestartet.

Geflogen wird mit den Tasten 2, 4, 6 und 8 für vorne, links, rechts und runter, und das Ziel des Spieles ist möglichst viele Satelliten einzusammeln ohne von den Asteroiden getroffen zu werden.

Viel Spaß beim Müllsammeln!

Update:
11.06.09: Habe soeben erfahren, dass Space Janitor schon 460mal von der Vodafone Plattform heruntergeladen wurde. Wer’s jetzt noch nicht hat, sofort holen!