Posts tagged Android
Internationalization for libgdx projects
6Edit: I just added UTF-8 support
Localization is a key aspect in games, specially if you want to reach a wider audience. I recently ported Freegemas to the libgdx platform and, as the original one, I wanted to ship it with multi-language support. There is no such a thing as gettext for Java and I didn’t see the Android internationalization system as a good fit in a multiplatform development. That’s why I developed my little own internationalization module.
Download LanguagesManager.java
Its usage is extremely simple, first we need a media/languages.xml file where all the strings in our project will be located. The syntax is pretty straight forward, we lay language sections identified with the code for each language. Inside every language, we provide a list of key value pairs with the localized strings.
< ?xml version="1.0" encoding="UTF-8"?>
<languages>
<!-- English -->
<language name="en_UK" >
<!-- Menu -->
<string key="Timetrial mode" value="Timetrial mode" />
<string key="How to play" value="How to play" />
<string key="Exit" value="Exit" />
</language>
<!-- Spanish -->
<language name="es_ES" >
<!-- Menu -->
<string key="Timetrial mode" value="Contrarreloj" />
<string key="How to play" value="Ayuda" />
<string key="Exit" value="Salir" />
</language>
</languages>
We can retrieve localized strings in our project through the LanguagesManager class and its getString() method. It’s been implemented using the Singleton design pattern as we only need one instance accessible from, potentially, everywhere in the code. When we ask our manager for a certain string we will use its key, if it finds it within the current language, it’ll return it, otherwise it’ll return the key itself. That’s why using strings in a base language (English) as keys can be a good idea, those will be returned by default.
For now, it uses lazy initialization which means it’ll load the language the first time the getInstance() method is called but that might change in the future. It automatically detects the system language (no matter if we are on Android or a desktop environment) and it fallsback to English if the system language is not among the available ones in the media/languages.xml file. However, you can explicitly specify the language you want to load through the loadLanguage() method.
LanguagesManager lang;
lang = LanguagesManager.getInstance();
String option1 = lang.getString("Timetrial mode");
String option2 = lang.getString("How to play");
String option3 = lang.getString("Exit");
Freegemas libgdx is open source (GPL v3) as is this internationalization module which means you’re more than welcome to download it, use it and improve it. If you do the latest, make sure you distribute it the same way as me.
Getting started with libgdx, Freegemas!
0
I can’t believe it’s been almost three months since I started at Crytek UK, time has passed amazingly fast! Nevertheless, I’ve managed to get some stuff done game development wise. I’ve always wanted to jump into mobile and that’s what I’ve been doing during the last couple of weeks. May I present you Freegemas libgdx edition!
It’s basically a libgdx port of the original Freegemas, a simple Bejeweled like C++ Gosu puzzle game developed by José Tomás Tocino who I have to thank for the neat original code and the excellent art. This means you can run it on your desktop, Android phone and very soon on your browser through HTML5 sweetness.

Freegemas screen, neat art huh? Thank Jose for that!
Libgdx it’s an open source Java library that allows you to create multiplatform games (desktop, Android, HTML5) sharing the same code base. That alone is amazing enough, so kudos to Mario for the titanic work. The library uses OpenGL so the performance it’s quite good even though we’re talking about Java! It has so many features and associated tools that it’d take me a few days to cover them all. Plus the community is always very helpful, besides the forums there’s always someone on the IRC channel willing to save your ass. However, to be honest it’s a bit of a downside to me it’s lack of UFT-8 font rendering support. Maybe some other day I’ll talk with some more insight about libgdx.
This was a warm up project, bigger things are yet to come!
PS: I must not forget about the HTML5 version of the game, it’ll be available soon.
Recent projects and future changes
0Lots of stuff has happened since I last posted something here. Crazy Eramus life, you want to do everything: projects, social life, studying… So, logically, the blog has been a little bit left behind. I just wanted to post a quick update about the two university projects I’ve been working on recently:
- Laterdroid: Read it Later client for Android created using the official SDK.
- Urban Race: time attack racing game developed using C# and the XNA framework.
For further information please go to each project’s page, you’ll find a more detailed description, screenshots, videos and download links. I was thinking of making both projects open source and upload them to a Google Code repository but I guess that’ll have to wait until they’re graded by the professors.
And now for something completely different…
Huge events have taken place recently, the dream has come true. Unfortunately, I can’t make anything public yet, I’ve only told my family and friends. However, I’ll soon post something on that matter.
Google Music en Linux y Android desde España
11

Google anunció Music, su servicio de música gratuito a través de streamming en su evento I/O 2010 pero no fue hasta hace poco cuando se comenzaron a permitir registros para la fase beta. El problema es que sólo usuarios de Estados Unidos pueden solicitar la invitación y utilizar el cliente para Android. Afortunadamente hay un pequeño y sencillo procedimiento para poder saltarse esta barrera, sigue leyendo para saber cuál es. Gracias a mi buen amigo Javier por los enlaces y las pistas.
(more…)
Game Dev Story para Android
1

En el programa de los juegos del año independientes de Game Over hablaron de Game Dev Story, lo conocía desde hacía cierto tiempo pero fue entonces cuando el gusanillo me atacó con más fuerza así que acabé haciéndome con él para mi flamante HTC Desire HD. No puedo estar más satisfecho, pues me ha amenizado decenas de visitas al WC, viajes de autobús y esperas varias. En este artículo expondré mis impresiones sobre el simulador de empresa de videojuegos.
(more…)
Speedx 3D, velocidad extrema en Android
4

Durante las últimas semanas he estado probando varios juegos en Android y es sorprendente la cantidad que no sabe adaptarse a las características de un dispositivo móvil en términos de control. Speedx 3D es de los que más gratas sensaciones me ha producido por su sencillez y adictiva mecánica. A continuación sigue un breve comentario sobre el juego.
(more…)
PES 2011 para Android
1

Como ya he comentado, hace unas semanas me hice con un HTC Desire HD y desde entonces he estado matando las esperas de autobús con un buen puñado de juegos. En esta ocasión vengo a hablaros de Pro Evolution Soccer 2011 para Android. Durante los últimos años he preferido FIFA a PES aunque decidí darle una oportunidad, total, en un móvil no busco simulación sino una partida rápida.
(more…)
HTC Desire HD, eliminar aplicaciones de Vodafone
58

Cuando hace más de un año compré mi HTC Magic sólo había tres teléfonos Android en el mercado y todos del mismo fabricante. Alucinaba en colores con su conectividad, prestaciones y pantalla. ¡Tenía un teléfono más potente que mi primer ordenador! Como cualquier otro cacharro no tardó en quedarse anticuado y actualmente se resiente al trabajar casi con cualquier aplicación. Por ello he decidido renovarme y adquirir el HTC Desire HD, una auténtica bestia parda. Cuando pase cierto tiempo trasteando con ella dejaré caer un pequeño análisis personal, mientras tanto comento la forma de eliminar esas odiosas aplicaciones de Vodafone.
(more…)
Instalar Android 2.2 en HTC Magic 1.6
261

Uno de los mayores problemas de Android es la segmentación de versiones que sufre. No es raro ver usuarios con la 1.5 Cupcake instalada mientras que los más afortunados se encuentran en la 2.0 Froyo. Como seguramente sepas, esto se debe a numerosos factores como el retraso que imponen las operadoras o capas de interfaz que han de ser actualizadas aunque esto da contenido para otro artículo. Hace más de un año me hice con una HTC Magic a través de Vodafone y, desgraciadamente, aún estoy abandonado en la 1.6 Donut. Si no fuera por las ROMS cocinadas me vería condenado a no poder actualizar mi teléfono de por vida.
Llevaba cierto tiempo queriendo instalar una ROM modificada pero, al pensar que mi teléfono podría convertirse en un bonito posavasos tremendamente caro, me entraban escalofríos. En internet circulan centenares de confusos tutoriales con dependencias entre sí y conceptos que no tengo tiempo para investigar. ¿Acceso root, recovery mode, brick? ¡Qué narices es eso! No puedo perder una semana guerreando con el teléfono para poder usarlo en condiciones. Finalmente en una tarde de tiempo libre me lancé al vacío y, picando de varios sitios de internet, he dado con un sistema seguro y sencillo. Si eres de esos que quieres un tutorial para pasar una Magic de la versión Android 1.6 a la última 2.2, estás en el lugar acertado. No tengas miedo y adelante.
