A "Theme" is a method to change the data which Tuxtyping uses. While this could be used to change the game about Tux and fish, to a game about a Cat and mice, more likely you are interested in making Tuxtyping work in another language. (if you are intersted in creating a new graphical theme like "Racecars" or ... that is cool too, but if things don't act right, please contact us).
I will walk through how I created the "French" theme in boxes in this text.
In Tuxtyping 1.0, to create a theme, you needed to recreate every image file that was used by the game. This means you had to include every image even if you didn't change it. Plus all the text in the game were actually pre-created graphics, and the game could only use A-Z.
In Tuxtyping 1.5, you can can include changes to the image files, but if you don't include one, we will just use the default image included with the default theme (English). Also instead of all the text in the game being pre-created, it is all rendered, so you can change the font and/or the text very easily. Plus, you can change it so you include numbers, or anything else you can type!
Changes since 1.5.0 Theming Howto:
|
Themes are located in the data directory of Tuxtyping 2. This will be different depending on which operating system you are using. If you have trouble finding where the data directory is for your system, contact us. I will refer to this directory containing themes as data/themes/
Each theme has its own directory in the data/themes/ directory. For instance if you are creating a French theme, you would create a directory called french in the themes directory, so you have data/themes/french. All of the data for your theme will be located in this directory.
Now if you go into the game, you should see a new entry in the "Setup Languages" menu for your theme.
cd data/themes mkdir french |
You may need to find a truetype font for your language. The included font may work for many languages (Danish, French, ...) that are based on latin characters. Languages such as Armenian will need to have a different font!
We actually allow you to specify two different fonts. One font menu.ttf is the main font used everywhere in the program except for the the game objects (for instance the letters on the fish or comets or in the tutor game). If you don't need a different font for two usages, just copy the font to both menu.ttf and letters.ttf
Since the non A-Z characters in French are in the default fonts, I didn't need to do the following:
cd data/themes/french mkdir fonts cd fonts cp /home/jdandr2/frenchfont.ttf menu.ttf cp /home/jdandr2/frenchfont.ttf letters.ttf |
To change the words that are within the menus and other parts of the game, you will need to create and edit a lang.po file. We have created a master lang.po file that is located in the data/themes directory. To start with, you should copy this file into your theme's directory.
cd data/themes cp lang.po french/lang.po |
This files is your your standard "gettext" type .po file. It is comprised of a sequence of msgid & msgstr pairs. The msgid is the string of words in English, what you will need to do is after edit each msgstr in the file so it corresponds to the msgid right about it.
For instance my data/themes/french/lang.po has the following lines:
msgid "Fish" msgstr "le Fish" msgid "Lives" msgstr "le Lives" msgid "Level" msgstr "le Level" msgid "Alphabet" msgstr "le Alphabet" Since I do not know french, but if I did, I may have had the following in the file: msgid "Fish" msgstr "Poissons" |
Now you need to setup what characters (like ABCDEFGHIJKLMNOPQRSTUVWXYZ), you are going to have the player hit within the game. There are several things you need to specify. First let me explain with an example. In the English version, we don't mind if the user hit "A" or "a", we want it to mean the same thing "A" (we choose uppercase (capital) letters since they are easier to read). We also need to specify that the player would normally use the "0" finger to hit the key (see image)
So you need to create a keyboard.lst file. This file will contain all the characters that you wish to be in your alphabet. The format for the file is:
First you list the finger(s) that the player should use to press this letter, then a seperator |, then the letter(s) that the users can press that mean the same thing. If your language has both upper & lower case, then you should put both here, since by default you probably don't care if they presed 'A' or 'a'. (in the future, there will be an option to turn on/off this ability on the fly). Tuxtyping generates the alphabet from this file, and it will use whatever letter you put first here. So if you want upper case to be the default, then your file would look as follows:
cd data/themes/french vi keyboard.lstThen I add the following lines to the keyboard.lst file: 0|Aa 3|Bb 2|Cc 2|Dd 2|Ee 3|Ffand so on for each letter including non A-Z characters if needed! |
This is where you create the words that the player will have to type within the game. The word lists reside within the directory words in your theme's directory. Create this directory now.
cd data/themes/french mkdir words |
Then all that is left to be done is to create these word lists (soon this will be able to do this from within the game!) The first line of each wordlist should be the title of the wordlist. After that, list all the words (one on each line). For instance data/themes/french/words/words1.txt is:
Jesse's French Words LIV POISSION |
The only thing you need to remember is that each word can only be up to 8 characters long. Also the game ignores ANYTHING after the first space. If this is an issue, please let us know!
You should send this file into the TuxTyping group so that it can be included in the distribution. That way anyone who downloads Tuxtyping can use your theme without having to download your theme as well! (Someone please do a REAL french theme!!!)
Q: Why do I need both menu.ttf and letters.ttf?
A: There are times when you may need a different font for the menus and for the text that the player will have to type. For instance if you create an American Sign Language (ASL) theme, you will probably want the letters font to be a truetype font that has the hands/fingers in the proper positions.