An improved Vala Swell-foop has been summited for review

After almost two weeks of work on the bug, I’m very glad to show everyone the new Swell-foop video demo! It basically features the toolbar, the animation for score and the preference window. The code has been almost rewritten to follow the principle of Model-View-Controller (MVC). I’d like to take this chance to thank Bob very much for his reviews and his and many other contributors’ brilliant work on the other Vala games. They set me very good examples to follow, making my coding much easier.

This Vala game still has minor bugs. I’m not sure if it can be included in the coming release of Gnome-3.4.

Animated Vala Swell-foop!

Today I’m very glad to share my great joy of making Vala Swell-foop animated! Check this out.

It turns out Clutter is a very fun toolkit for desktop application animation. If you are new to program with Clutter, do remember that when you specify the geometric properties (like positions in animation), always use ‘float’ or ‘double’ values! ‘int’ value will make a lot of troubles!

My journey of JHBuild

To better support the latest feature of GTK+3, Gnome-games git master has recently bumped up GTK+ minimum requirement to 3.3.x. However my desktop Ubuntu only provides development packages up to GTK+3.2. As such my local build of Gnome-games was broken. I think it is a good time to try JHBuild.

Ubuntu’s official APT repo has JHBuild package but it is outdated. I gave it a try but ran into many build errors. Soon I switched to its git version and it turned out to be the way to go.

I don’t want to repeat what JHBuild website already has. I will just list what I have encountered in the process of making a working Gnome-games JHBuild build.

First, follow the instructions on JHBuild website until you have run


$ jhbuild build gnome-games

It’s gonna take a quite while to fetch source code from upstream git repos build  and install them. You can do it once and in future, as long as the library dependency is satisfied, we can type


$ jhbuild buildone gnome-games

to just update and build gnome-games itself.

If you already have your local clone of gnome-games, and you just want to install the broken libraries, you can just


$ jhbuild build gtk+

$ jhbuild build clutter

$ jhbuild build clutter-gtk

However, I noticed that the GTK+3 baked by JHBuild didn’t support SVG file which was wildly used in many game apps. It looked like gdk-pixbuf didn’t include the loader for SVG. The trick is


$ jhbuild build librsvg

After that you can check if the SVG loader libpixbufloader-svg.so is in $JHBUILDER_PREFIX/lib64/gdk-pixbuf-2.0/loaders.

Another annoying problem is when you run the games, you probably will see


GLib-GIO-Message: Using the 'memory' GSettings backend. Your settings will not be saved or shared with other applications.

The reason is that your system dconf is old, and the fix is to


$ jhbuild build dconf

All right. Hopefully this post can help you iron out all the glitches you have when you try to bake Gnome-games with JHBuild. Have fun!

How do I set up my Vala IDE in Vim

Today I want to share how I set my Vim for Vala coding. It is not a fully-loaded IDE but it works for me very well. Hopefully it will help you too. First I would like to show a screenshot of Vim session when I’m hacking GNOME Gnames: Gnomine.

It shows basically three awesome Vim plugins (Tagbar, Fuzzyfinder and Nerdtree) and the terminal multiplexer, Tmux. For those are not familiar with the plugins, Tagbar shows the class variables, functions, etc for easy jumping. Nerdtree is a file explorer. Fuzzyfinder is a nifty buffer switcher. Note that at the bottom of the screenshot, Tmux has three windows, named as ‘src’,’build’ and ‘bash’ and Vim is running in ‘src’ window now. Such a setting makes you quickly switch back and forth between ‘src’ window for editing and ‘build’ window for building, or ‘bash’ window for something else.

I guess most Vim users have already known these. So the real story I’m going to tell is how to make tagbar work with Vala code. Tagbar is based on  ctags however the official ctags doesn’t support Vala. Luckily I have found anjuta-tags is a ctags clone with Vala support. Type in commandline to see if you have anjuta-tags available. It should be installed along with Anjuta. Therefore I replaced the default ctags with anjuta-tags by copying anjuta-tags to a location before ctags in PATH and rename it as ctags. I guess another way is to add


let g:tagbar_ctags_bin = "anjuta-tags"

in your .vimrc file.

That is NOT enough yet. You can generate Vala tags with anjuta-tags but Tagbar still shows nothing. Now you need to edit $VIM/autoload/tagbar.vim by adding the following lines.


" Vala {{{3
 let type_vala = {}
 let type_vala.ctagstype = 'vala'
 let type_vala.kinds = [
 \ {'short' : 'c', 'long' : 'classes', 'fold' : 0},
 \ {'short' : 'd', 'long' : 'delegates', 'fold' : 0},
 \ {'short' : 'e', 'long' : 'enumerations', 'fold' : 0},
 \ {'short' : 'E', 'long' : 'error domains', 'fold' : 0},
 \ {'short' : 'f', 'long' : 'fields', 'fold' : 0},
 \ {'short' : 'i', 'long' : 'interfaces', 'fold' : 0},
 \ {'short' : 'm', 'long' : 'methods', 'fold' : 0},
 \ {'short' : 'p', 'long' : 'properties', 'fold' : 0},
 \ {'short' : 'r', 'long' : 'error codes', 'fold' : 0},
 \ {'short' : 's', 'long' : 'structures', 'fold' : 0},
 \ {'short' : 'S', 'long' : 'signals', 'fold' : 0},
 \ {'short' : 'v', 'long' : 'enumeration values', 'fold' : 0}
 \ ]
 let type_vala.sro = '.'
 let type_vala.kind2scope = {
 \ 'i' : 'interface',
 \ 'c' : 'class',
 \ 's' : 'structure',
 \ 'e' : 'enum'
 \ }
 let type_vala.scope2kind = {
 \ 'interface' : 'i',
 \ 'class' : 'c',
 \ 'struct' : 's',
 \ 'enum' : 'e'
 \ }
 let s:known_types.vala = type_vala

Also, remember to check out http://live.gnome.org/Vala/Vim for syntax highlighting:-)

Gnome Gnomine has a new look

I’m very glad today since My patch to the bug has been accepted which removes the status bar and put everything else into the toolbar. Hopefully in the coming Gnome release you will see a new look of Gnome Gnomine. Thanks for the reviews from Robert! Here is the preview:

GNOME OPW: the bi-weekly progress report

Hello everyone, I’ve seemed quiet during the past two weeks since I have been fighting with Vala, Javascript and Clutter. My short term goal is to port GNOME game Swell Foop from Javascript to Vala. After the first two weeks of warming up practices, this one is a tough one. There was a dark time to get started. Because both languages are new to me and Clutter is even newer, reading the Javascript code, understanding the logic and translating them to the equivalent Vala implementation was really a challenge. Anything seemed not working as you expected.  But I still think it would be better to make my hands dirty enough before throwing questions on IRC. Luckily Robert has provided a excellent case study(Lightsoff) to follow. Working through his code really made my life much easier. So today I’m very glad to show you my latest progress: a basic but running Swell Foop:

Vala version of Swell Foop

Did I just say running? It can run, load the theme and layout the actors but can’t response the mouse interaction at the moment. Anyway, I’m very excited to make it run. It is a tangible progress and will serve as my test field for adding the remaining functionality.

By playing around with Lightsoff and Swell Foop, I’ve been very impressed with the cool animation effects provided by Clutter. Comparing with these Clutter-powered games, other GNOME games look a little bit dull. I guess it might be a good idea to use Clutter more in other games. Maybe another round of game modernization?

GNOME OPW: the bi-weekly progress report

The first two weeks of GNOME OPW intership for GNOME Games is fantastic. Getting started takes time but everything is moving forward. I have to say the Game team and the whole GNOME community is very friendly and warmhearted.

I had a great time on GNOME IRC, asking questions and they were answered very quickly!

Before the internship I only used Git for personal code version control, so I missed many power features of Git for distributed coding collaboration. By working with the Game project, I have a great chance to learn them in a real scenario. Now I feel quite at home to do branching, formatting patch, submitting in Bugzilla etc. The tool I like most is gitk. I used it a lot to browse the history changes and read the comments. It is a very good resource to learn everything.

Robert Ancell compiled a very informative Games roadmap at https://live.gnome.org/GnomeGames/Modernisation. It is a great help for me to pick tasks that I can do and quickly contribute patches. It also provides clear overview about how far we are to the next milestone of Games.

Specifically, in the past two weeks I learned the Mallard document and Vala programming. I submitted patches for http://bugzilla.gnome.org/show_bug.cgi?id=618343http://bugzilla.gnome.org/show_bug.cgi?id=664953https://bugzilla.gnome.org/show_bug.cgi?id=664965https://bugzilla.gnome.org/show_bug.cgi?id=664966https://bugzilla.gnome.org/show_bug.cgi?id=664969https://bugzilla.gnome.org/show_bug.cgi?id=664968

I’m learning Clutter now since Swell-foop is written in Javascript  and Clutter. I will try to migrate it to Vala with Clutter.

Follow

Get every new post delivered to your Inbox.