Posts

Showing posts from 2016

How to make a map of variant in C++

Image
This code is used by RainbruRPG to store any scalar types in a single class instance. It's already in use since revision 254 to save game states values when switching fullscreen or changing screen resolution.
The map class It's basically a map of boost::variant using std::string as map key. I decided to use function template setter and getter to have a standardized exception-based error handling, but you could have multiple parameter-based specialized getter/setter (void set(bool), void set(int)...).

RainbruRPG switched to revision 254

Image
RainbruRPG v0.0.5-253 is over, a client-only work. Since the last release announcement, two revisions later, many client improvements have been implemented :

We added a FPS-related statistics geometry buffer to the MainMenu;The Alt+Enter key binding adds a real time full screen switch feature;You can take a .png screenshot using the F11 key. All these improvements are possible thanks to the game state handling of the client. You can download this release at github.
Next release will focus on new client improvements and a better Ogre3D reconfiguration mechanism. This will let us handle new keybindings for real time resolution change and maybe start to implement the Options game state.

List items conversion to string in python

Image
My last post about string handling was written in ruby. This time it's a one-liner I use for a private python-powered project.
It is inspired by two StackOverflow answers : how to convert all items in a list to floats
and how to change any data type into a string in python.

If you mix the two answers, the result code is [str(i) for i in <list name>]. Now let's see how to use in an interactive shell and in a PyQt4 example.

How RainbruRPG will handle game states

Image
This design-related post will try to explain how we're implementing RainbruRPG's game states.

As stated in the last announcement, we now have to handle multiple states : main menu and local test. The game states will allow us to have multiple screens, one at a time.

RainbruRPG switched to revision 252

Image
This post follows the revision 251 announcement. With this new revision, we added a (ugly) logo, a version overlay and started to implement a Not Yet Implemented dialog.
This version also fixes several client segfaults.

The next revision will have to fully handle the NyiDialog (based on the brand new CeguiDialog class) and maybe start to implement local test, a way to test the game without an external server.

You can download this release here.

How to generate a pkg-config file with cmake

pkg-config is a great way to get compiler flags for a given library. Since I'm currently implementing the rainbrurpg's meta as a library (see libwsmeta's annoucement and repository) I would like to generate a pkg-config file using cmake.

Introducing libwsmeta

I would like to speak about a new project : libwsmeta, a C metaserver library intended to be used for several projects including rainbrurpg and rainbrurph.

This library will have to search for a server list. I've designed it to be included in cmake-based project.

RainbruRPG switched to revision 251

Image
RainbruRPG's revision 250 is over and the CEGUI part of the client is back.


The main change in is this revision is the dependencies : the client now depends on CEGUI 0.8, not 0.7. That's a major dependency upgrade and unfortunately this version isn't available as official Debian package, so you have to manually build it.

The next revision will have to handle GUI events from layout files and fix some segfaults, especially due to the OGRE configuration.

You can download this release here.


Using a JQuery datepicker in meteorjs

Image
Today's work on mrt-manager was to add a JQuery datepicker widget to the news addition modal dialog.

Introducting the todoSummarizer's help viewer

Image
Today's commit was about a help viewer for todoSummarizer. All this code resides in the lib/MainWindow.rb

Since this project uses GTK, I decided to use an external help viewer : yelp.

The project already have a texinfo manual, so it's all about generating HTML from info and pass the corrcet URI to yelp.
Generating HTML manual To generate HTML from an info file you only need to run the following command :
makeinfo --html todoSummarizer.texinfo It will create a new directory containing some HTML files.
Calling yelp from ruby I also have some issues with Dir.pwd() so I didn't use it. Instead I used the __dir__ ruby function.

Appart for the error checking code, calling yelp from ruby is only three lines away :
yelp = find_executable("yelp") uri = "file://#{dir.to_path}/../doc/todoSummarizer/index.html" Thread.new { cmd = system("#{yelp} #{uri}") } Result You now have a great manual/help viewer for your GTK-based GUI application :

How to make a clickable label in Gtk2/ruby

Image
Sometimes, you need a Gtk label, styled like a web link that opens an URL when you click. I need this widget for the todo-summarizer Gtk2 GUI and I don't like the look and feel of the Gtk LinkButton widget.

So, I wrote a custom ClickableLabel widget that handle the URL, opens your system's default web browser, shows the destination URL either in a tooltip or a status label and change the mouse cursor change when you hover it.

RainbruRPG switched to revision 250

The rainbrurpg's revision 249 is over and the building part of the transition to cmake is done.

During this revision, all sources moved to a single top-level src/ directory. The build process is now cmake-powered and after configuration, building only takes a 'make'.

Next revision will also be focused on the switch to git/cmake. For example, the translation files aren't correctly handled at this time (the msgmerge step is missing) and the continuous integration builds are still failing on clang compiler. We also have to build unit tests using cmake.

You can download this release here.

How to use sdl2 on travis-ci

Image
If you're using Continuous Integration to improve your code quality, maybe you're using travis-ci.org to test each commit and report errors.

To build rainbrurph, I need SDL2 libraries and headers, unfortunately, the build fail with the following error message :
E: Unable to locate package libsd2-dev

How to search for the readline library with cmake

I'm currently using GNU readline for a RainbruRPG's server tool. Unfortunately, this library isn't shipped with a pkg-config file. We have to create our own cmake file.

How to remove the first character of a ruby string

Recently, I had to remove the first character of string in a private nanoc-powered project. I easily found a quick and elegant way to achieve this and according to this stackoverflow answer it seems the fastest.

path="_theString" path[1..-1] # => "theString"
And to complete this post, if you plan to use this often, you may want to override the String class to remove the first n characters :
class String def removeFirstChars!(how_many = 1) self.replace self[how_many..-1] end end
The stackoverflow answer also gives the code and benchmark results to achieve this with an Array.

RainbruRPG's client is now in src/

Like this previous post, today's commit #826 is also on code reorganization.

This time, the client binary code was moved from the client/ subdirectory to the new src/ development tree.


This change includes C++ source code and  Ogre3D configuration files templates (.cfg.in files) , used  by cmake to generate plugins.cfg and resources.cfg. The m4-based autotools  files were deleted while the remaining files, including TODO and ChangeLog, were moved to the OLD/client directory.

To make the whole project consistent, the last to-be-moved directory is services/.

Rainbrurph switch to revision 9

The revision 8 of rainbrurph is over : today, I switched to revision 9. It's not a major switch, the way I'm handling revision makes it even less than a minor version. Here is the changelog of this revision.

The whole revision was about segfault fixing and I failed. Issues are in the module handling and I can't fix these for instance so I postponed for further informations.

I  decided to publish it at github, so it becomes a free project, free as in publicly available.

I enabled Continuous Integration via travis-ci.org.  This should help me with code quality and regressions.

The next revision's goal is to have a at least one working client's launcher with options/renderer selection.


Introducing rainbrurph

Today, I'm freeing another private project : rainbrurph. It's a side project of RainbruRPG and a complete rewrite in ANSI C.


RainbruRPG's logger moved to OLD/ directory

Today's work (commits #821 and #822) is about code reorganization and the logger library.

Since I decided to switch to cmake and run integration tests, the multi-project layout was a mess.

Before the switch, every single binary/library has its own sub-directory and build system. The result is a bunch of different autotools scritps, each whith its own dependencies.

Building rigs of rods on Debian

Today, I tried to build Rigs Of Rods from sources.While building dependencies with the official wiki documentation worked but I had a strange issue with the cmake . command :

Building openmw on Debian Jessie

openmw is an open source project rewritting Morrowind's engine, you'll need the original game to play. It's difficult to build openmw on Debian because we can't find all dependencies in official apt-get repositories. Here is my solution.

I'll not list all depndencies needed to manually build openmw, many of these libraries (Qt4,...) can be found using official packages manager (aptitude, synaptic). But some libraries can't be found.

How to use syntax highlighting with Blogger

Here is a development-themed blog, so I need a way to show you code fragments. The solution I would to test is code-prettify.

Before you modify the blogger's template, go to the template tab and download a complete backup of the current one. Modify the HTML code and add this line just before the </head> tag.

You have to choose options before inserting loader code, because you'll have to change the URL. The base URL is https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js then, if you want to change the skin you have tp append ?skin=sons-of-obsidian to the URL. Please read official documentation for more informations and examples.

Adding a screenshot in a github's README.md

Today's work is about a ruby project hosted at github.com : todo-summarizer, a tool I use to compute weekly statistics on my development tree, and the task is to enhance project documentation.

The github-flavored markdown-based README is already quite explicit but it tends to show this tool only has a terminal output, but since todo-summarizer also offers a GTK-based GUI, I'd like to add some screenshots of the running application.

Mrt-manager and the meteor update process

This day was finally lost; dedicated to a side project called mrt-manager, my first public project written in meteor, a javascript framework.

The first thing in a meteor day is to see if it need an update using the meteor list command. If some packages version are followed by an asterisk (*), I generally issue a  meteor update one. Today, this command failed.