Modified:
trunk/po/AlThreat.pot
trunk/po/Makefile.am
trunk/po/Makefile.in
trunk/po/fr_FR/LC_MESSAGES/AlThreat.po
trunk/src/Configuration.cc
trunk/src/Menu.cc
trunk/src/Menu.h
trunk/src/Options.cc
trunk/src/lang.h
trunk/src/widgets/focuscontainer.cc
trunk/src/widgets/focuscontainer.h
trunk/src/widgets/liste.cc
trunk/src/widgets/liste.h
Log:
Add language choice in options.
Modified: trunk/po/AlThreat.pot
==============================================================================
--- trunk/po/AlThreat.pot (original)
+++ trunk/po/AlThreat.pot Fri Nov 9 15:03:37 2007
@@ -8,7 +8,7 @@
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: alth...@googlegroups.com\n"
-"POT-Creation-Date: 2007-11-09 20:15+0100\n"
+"POT-Creation-Date: 2007-11-10 00:00+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <L...@li.org>\n"
@@ -48,51 +48,51 @@
msgid " Energy: "
msgstr ""
-#: ../src/Menu.cc:28
+#: ../src/Menu.cc:77
msgid "Adventure"
msgstr ""
-#: ../src/Menu.cc:29
+#: ../src/Menu.cc:78
msgid "Training"
msgstr ""
-#: ../src/Menu.cc:30 ../src/MenuJeu.cc:14
+#: ../src/Menu.cc:79 ../src/MenuJeu.cc:14
msgid "Options"
msgstr ""
-#: ../src/Menu.cc:31
+#: ../src/Menu.cc:80
msgid "Credits"
msgstr ""
-#: ../src/Menu.cc:32
+#: ../src/Menu.cc:81
msgid "Quit"
msgstr ""
-#: ../src/Menu.cc:106 ../src/Options.cc:55
+#: ../src/Menu.cc:117 ../src/Options.cc:72
msgid "OK"
msgstr ""
-#: ../src/Menu.cc:135
+#: ../src/Menu.cc:146
msgid "Development: Skippy"
msgstr ""
-#: ../src/Menu.cc:136
+#: ../src/Menu.cc:147
msgid "Graphisms: Raz & Skippy"
msgstr ""
-#: ../src/Menu.cc:137
+#: ../src/Menu.cc:148
msgid "Music: Raz & Vavrek"
msgstr ""
-#: ../src/Menu.cc:138
+#: ../src/Menu.cc:149
msgid "-=( the3fold )=-"
msgstr ""
-#: ../src/Menu.cc:139
+#: ../src/Menu.cc:150
msgid "http://www.vavrek.com"
msgstr ""
-#: ../src/Menu.cc:140
+#: ../src/Menu.cc:151
msgid "http://the3fold.free.fr"
msgstr ""
@@ -124,39 +124,43 @@
msgid "Modify controls"
msgstr ""
-#: ../src/Options.cc:60
+#: ../src/Options.cc:55
+msgid "Language:"
+msgstr ""
+
+#: ../src/Options.cc:77
msgid "Cancel"
msgstr ""
-#: ../src/Options.cc:239
+#: ../src/Options.cc:258
msgid "Up"
msgstr ""
-#: ../src/Options.cc:239
+#: ../src/Options.cc:258
msgid "Down"
msgstr ""
-#: ../src/Options.cc:239
+#: ../src/Options.cc:258
msgid "Left"
msgstr ""
-#: ../src/Options.cc:239
+#: ../src/Options.cc:258
msgid "Right"
msgstr ""
-#: ../src/Options.cc:239
+#: ../src/Options.cc:258
msgid "Fire"
msgstr ""
-#: ../src/Options.cc:239
+#: ../src/Options.cc:258
msgid "Special weapon"
msgstr ""
-#: ../src/Options.cc:239
+#: ../src/Options.cc:258
msgid "Shield"
msgstr ""
-#: ../src/Options.cc:239
+#: ../src/Options.cc:258
msgid "Pause"
msgstr ""
Modified: trunk/po/Makefile.am
==============================================================================
--- trunk/po/Makefile.am (original)
+++ trunk/po/Makefile.am Fri Nov 9 15:03:37 2007
@@ -1,6 +1,6 @@
POFILES = $(top_srcdir)/po/fr_FR/LC_MESSAGES/AlThreat.po
-MOFILES = $(POFILES:.po=.mo)
+MOFILES = $(top_builddir)/po/fr_FR/LC_MESSAGES/AlThreat.mo
SRCFILES = $(top_srcdir)/src/AlThreat.cc \
$(top_srcdir)/src/Arme.cc \
@@ -63,7 +63,6 @@
$(MSGFMT) -o $@ $<
$(POFILES): $(POTFILE)
- echo $(MOFILES)
test -f $@ && $(MSGMERGE) $(MSGMERGE_OPTIONS) $@ $(POTFILE)
$(POTFILE): $(SRCFILES)
Modified: trunk/po/Makefile.in
==============================================================================
--- trunk/po/Makefile.in (original)
+++ trunk/po/Makefile.in Fri Nov 9 15:03:37 2007
@@ -174,7 +174,7 @@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
POFILES = $(top_srcdir)/po/fr_FR/LC_MESSAGES/AlThreat.po
-MOFILES = $(POFILES:.po=.mo)
+MOFILES = $(top_builddir)/po/fr_FR/LC_MESSAGES/AlThreat.mo
SRCFILES = $(top_srcdir)/src/AlThreat.cc \
$(top_srcdir)/src/Arme.cc \
$(top_srcdir)/src/Arme.h \
@@ -410,7 +410,6 @@
$(MSGFMT) -o $@ $<
$(POFILES): $(POTFILE)
- echo $(MOFILES)
test -f $@ && $(MSGMERGE) $(MSGMERGE_OPTIONS) $@ $(POTFILE)
$(POTFILE): $(SRCFILES)
Modified: trunk/po/fr_FR/LC_MESSAGES/AlThreat.po
==============================================================================
--- trunk/po/fr_FR/LC_MESSAGES/AlThreat.po (original)
+++ trunk/po/fr_FR/LC_MESSAGES/AlThreat.po Fri Nov 9 15:03:37 2007
@@ -8,7 +8,7 @@
msgstr ""
"Project-Id-Version: AlThreat 0.3\n"
"Report-Msgid-Bugs-To: alth...@googlegroups.com\n"
-"POT-Creation-Date: 2007-11-08 21:36+0100\n"
+"POT-Creation-Date: 2007-11-10 00:00+0100\n"
"PO-Revision-Date: 2007-11-07 22:38+0100\n"
"Last-Translator: <colin....@gmail.com>\n"
"Language-Team: French\n"
@@ -49,51 +49,51 @@
msgid " Energy: "
msgstr " Energie : "
-#: ../src/Menu.cc:28
+#: ../src/Menu.cc:77
msgid "Adventure"
msgstr "Aventure"
-#: ../src/Menu.cc:29
+#: ../src/Menu.cc:78
msgid "Training"
msgstr "Entrainement"
-#: ../src/Menu.cc:30 ../src/MenuJeu.cc:14
+#: ../src/Menu.cc:79 ../src/MenuJeu.cc:14
msgid "Options"
msgstr "Options"
-#: ../src/Menu.cc:31
+#: ../src/Menu.cc:80
msgid "Credits"
msgstr "Credits"
-#: ../src/Menu.cc:32
+#: ../src/Menu.cc:81
msgid "Quit"
msgstr "Quitter"
-#: ../src/Menu.cc:106 ../src/Options.cc:55
+#: ../src/Menu.cc:117 ../src/Options.cc:72
msgid "OK"
msgstr "OK"
-#: ../src/Menu.cc:135
+#: ../src/Menu.cc:146
msgid "Development: Skippy"
msgstr "Programmation : Skippy"
-#: ../src/Menu.cc:136
+#: ../src/Menu.cc:147
msgid "Graphisms: Raz & Skippy"
msgstr "Graphismes : Raz & Skippy"
-#: ../src/Menu.cc:137
+#: ../src/Menu.cc:148
msgid "Music: Raz & Vavrek"
msgstr "Musique : Raz & Vavrek"
-#: ../src/Menu.cc:138
+#: ../src/Menu.cc:149
msgid "-=( the3fold )=-"
msgstr ""
-#: ../src/Menu.cc:139
+#: ../src/Menu.cc:150
msgid "http://www.vavrek.com"
msgstr ""
-#: ../src/Menu.cc:140
+#: ../src/Menu.cc:151
msgid "http://the3fold.free.fr"
msgstr ""
@@ -125,39 +125,43 @@
msgid "Modify controls"
msgstr "Modifier les controles"
-#: ../src/Options.cc:60
+#: ../src/Options.cc:55
+msgid "Language:"
+msgstr "Langue"
+
+#: ../src/Options.cc:77
msgid "Cancel"
msgstr "Annuler"
-#: ../src/Options.cc:239
+#: ../src/Options.cc:258
msgid "Up"
msgstr "Haut"
-#: ../src/Options.cc:239
+#: ../src/Options.cc:258
msgid "Down"
msgstr "Bas"
-#: ../src/Options.cc:239
+#: ../src/Options.cc:258
msgid "Left"
msgstr "Gauche"
-#: ../src/Options.cc:239
+#: ../src/Options.cc:258
msgid "Right"
msgstr "Droite"
-#: ../src/Options.cc:239
+#: ../src/Options.cc:258
msgid "Fire"
msgstr "Feu"
-#: ../src/Options.cc:239
+#: ../src/Options.cc:258
msgid "Special weapon"
msgstr "Arme speciale"
-#: ../src/Options.cc:239
+#: ../src/Options.cc:258
msgid "Shield"
msgstr "Bouclier"
-#: ../src/Options.cc:239
+#: ../src/Options.cc:258
msgid "Pause"
msgstr "Pause"
Modified: trunk/src/Configuration.cc
==============================================================================
--- trunk/src/Configuration.cc (original)
+++ trunk/src/Configuration.cc Fri Nov 9 15:03:37 2007
@@ -17,7 +17,6 @@
joysticks = NULL;
char* locale = setlocale(LC_ALL, NULL);
- std::cout << "locale : " << locale << std::endl;
if(locale && strstr(locale, "fr"))
_lang = "fr_FR";
else
Modified: trunk/src/Menu.cc
==============================================================================
--- trunk/src/Menu.cc (original)
+++ trunk/src/Menu.cc Fri Nov 9 15:03:37 2007
@@ -23,28 +23,8 @@
fond = loadImage((configuration->getDataDir() + "images/Menu.png").c_str());
Selected = 0;
- nbChoix = 5;
- texte = new std::string[nbChoix];
- texte[0] = _("Adventure");
- texte[1] = _("Training");
- texte[2] = _("Options");
- texte[3] = _("Credits");
- texte[4] = _("Quit");
-
- SDL_Rect dest[nbChoix];
- MenuButton *choixBoutons[nbChoix];
menuLayer = new FocusContainer();
- for(int i = 0; i < nbChoix; i++)
- {
- dest[i].w = 180;
- dest[i].h = 40;
- dest[i].x = (Screen->w - dest[i].w) / 2;
- dest[i].y = (Screen->h - nbChoix * dest[i].h - (nbChoix - 1) *
dest[i].h / 2) / 2 + i * dest[i].h + (i - 1) * dest[i].h;
- choixBoutons[i] = new MenuButton(dest[i], texte[i], i, &Selected, &choisi);
- choixBoutons[i]->setFont((configuration->getDataDir()
+ "fonts/babelfish.ttf").c_str(), 30);
- menuLayer->addWidget(choixBoutons[i]);
- }
- menuLayer->focus(choixBoutons[0]);
+ init_text();
}
Menu::~Menu()
@@ -86,10 +66,41 @@
}
}
+void Menu::init_text()
+{
+ SDL_Surface *Screen = SDL_GetVideoSurface();
+ if(texte) delete[] texte;
+ if(menuLayer) menuLayer->deleteAll();
+
+ nbChoix = 5;
+ texte = new std::string[nbChoix];
+ texte[0] = _("Adventure");
+ texte[1] = _("Training");
+ texte[2] = _("Options");
+ texte[3] = _("Credits");
+ texte[4] = _("Quit");
+
+ SDL_Rect dest[nbChoix];
+ MenuButton *choixBoutons[nbChoix];
+ for(int i = 0; i < nbChoix; i++)
+ {
+ dest[i].w = 180;
+ dest[i].h = 40;
+ dest[i].x = (Screen->w - dest[i].w) / 2;
+ dest[i].y = (Screen->h - nbChoix * dest[i].h - (nbChoix - 1) *
dest[i].h / 2) / 2 + i * dest[i].h + (i - 1) * dest[i].h;
+ choixBoutons[i] = new MenuButton(dest[i], texte[i], i, &Selected, &choisi);
+ choixBoutons[i]->setFont((configuration->getDataDir()
+ "fonts/babelfish.ttf").c_str(), 30);
+ menuLayer->addWidget(choixBoutons[i]);
+ }
+
+ menuLayer->focus(choixBoutons[0]);
+}
+
void Menu::show_options()
{
Options *options = new Options(fond, musique,
configuration->getDataDir() + "sons/Menusong.ogg");
options->afficher();
+ init_text();
}
void Menu::show_credits()
Modified: trunk/src/Menu.h
==============================================================================
--- trunk/src/Menu.h (original)
+++ trunk/src/Menu.h Fri Nov 9 15:03:37 2007
@@ -19,6 +19,7 @@
unsigned char show(Game *&jeu);
~Menu();
void init();
+ void init_text();
private:
Menu();
Modified: trunk/src/Options.cc
==============================================================================
--- trunk/src/Options.cc (original)
+++ trunk/src/Options.cc Fri Nov 9 15:03:37 2007
@@ -51,25 +51,29 @@
control_bouton->setFont((configuration->getDataDir()
+ "fonts/vera.ttf").c_str(), 20);
SDL_Rect lang_label_pos;
- lang_label_pos.x = 70; lang_label_pos.y = 365; lang_label_pos.w =
250; lang_label_pos.h = 25;
+ lang_label_pos.x = 70; lang_label_pos.y = 380; lang_label_pos.w =
250; lang_label_pos.h = 25;
Label *lang_label = new Label(lang_label_pos, _("Language:"), T3F_LEFT);
lang_label->setFont((configuration->getDataDir()
+ "fonts/vera.ttf").c_str(), 20);
lang_label->setBorderSize(0);
SDL_Rect lang_pos;
- lang_pos.x = 330; lang_pos.y = 365; lang_pos.w = 300; lang_pos.h = 25;
+ lang_pos.x = 330; lang_pos.y = 380; lang_pos.w = 300; lang_pos.h = 100;
lang_list = new Liste(lang_pos);
lang_list->setFont((configuration->getDataDir()
+ "fonts/babelfish.ttf"), 30);
for(int i=0; i < sizeof(language_names)/sizeof(std::string); i++)
+ {
lang_list->addValue(new std::string(language_names[i]));
+ if(language_codes[i] == configuration->language())
+ lang_list->setValue(i);
+ }
SDL_Rect ok_pos;
- ok_pos.x = 100; ok_pos.y = 530; ok_pos.w = 80; ok_pos.h = 25;
+ ok_pos.x = 100; ok_pos.y = 530; ok_pos.w = 100; ok_pos.h = 25;
Switch *ok_bouton = new Switch(ok_pos, _("OK"), &ok);
ok_bouton->setFont((configuration->getDataDir()
+ "fonts/vera.ttf").c_str(), 20);
SDL_Rect cancel_pos;
- cancel_pos.x = 250; cancel_pos.y = 530; cancel_pos.w = 80;
cancel_pos.h = 25;
+ cancel_pos.x = 250; cancel_pos.y = 530; cancel_pos.w = 100;
cancel_pos.h = 25;
Switch *cancel_bouton = new Switch(cancel_pos, _("Cancel"), &cancel);
cancel_bouton->setFont((configuration->getDataDir()
+ "fonts/vera.ttf").c_str(), 20);
Modified: trunk/src/lang.h
==============================================================================
--- trunk/src/lang.h (original)
+++ trunk/src/lang.h Fri Nov 9 15:03:37 2007
@@ -21,7 +21,7 @@
#endif
-static std::string language_names[] = { "English", "Français" };
-static std::string language_codes[] = { "en_US", "fr_FR" };
+static std::string language_names[] = { "English", "Francais" };
+static std::string language_codes[] = { "C", "fr_FR" };
#endif
Modified: trunk/src/widgets/focuscontainer.cc
==============================================================================
--- trunk/src/widgets/focuscontainer.cc (original)
+++ trunk/src/widgets/focuscontainer.cc Fri Nov 9 15:03:37 2007
@@ -9,6 +9,12 @@
{
}
+void FocusContainer::deleteAll()
+{
+ focusedWidget = NULL;
+ Container::deleteAll();
+}
+
int FocusContainer::filtre(const SDL_Event *event)
{
if(event->type == SDL_KEYDOWN)
Modified: trunk/src/widgets/focuscontainer.h
==============================================================================
--- trunk/src/widgets/focuscontainer.h (original)
+++ trunk/src/widgets/focuscontainer.h Fri Nov 9 15:03:37 2007
@@ -15,6 +15,7 @@
void focusPrev();
bool focus(Widget *w);
virtual void addWidget(Widget *widget) { liste.push_back(widget);
widget->setContainer(this); };
+ virtual void deleteAll();
virtual int filtre(const SDL_Event *event);
virtual void onFocus(bool foc, bool nextIfUnactive = true);
Modified: trunk/src/widgets/liste.cc
==============================================================================
--- trunk/src/widgets/liste.cc (original)
+++ trunk/src/widgets/liste.cc Fri Nov 9 15:03:37 2007
@@ -10,7 +10,7 @@
focusborder = (SDL_Color) {150, 150, 150, 255};
focusbg = (SDL_Color) {0, 0, 0, 255};
focusfg = (SDL_Color) {255, 255, 0, 255};
- focusselect = (SDL_Color) {80, 80, 80, 255};
+ focusselect = (SDL_Color) {180, 180, 180, 255};
unactiveborder = (SDL_Color) {150, 150, 150, 255};
unactivebg = (SDL_Color) {0, 0, 0, 255};
unactivefg = (SDL_Color) {175, 175, 175, 255};
@@ -259,4 +259,28 @@
else
container->focusPrev();
}
+}
+
+void Liste::setValue(int element)
+{
+ int i=0;
+ std::list<std::string*>::iterator it = choix.begin();
+ while(it != choix.end())
+ {
+ if(i == element)
+ val = *it;
+ i++;
+ it++;
+ }
+}
+
+void Liste::setValue(std::string value)
+{
+ std::list<std::string*>::iterator it = choix.begin();
+ while(it != choix.end())
+ {
+ if(*(*it) == value)
+ val = *it;
+ it++;
+ }
}
Modified: trunk/src/widgets/liste.h
==============================================================================
--- trunk/src/widgets/liste.h (original)
+++ trunk/src/widgets/liste.h Fri Nov 9 15:03:37 2007
@@ -35,8 +35,8 @@
bool *getUnactivePtr() { return &unactive; };
void nextValue();
void prevValue();
- // TODO : setValue
- // void setValue(std::string value) { *val = value; };
+ void setValue(std::string value);
+ void setValue(int value);
virtual void onFocus(bool foc, bool nextIfUnactive = true);
virtual void afficher(SDL_Surface *Screen);