~ubuntu-branches/ubuntu/natty/lordsawar/natty

« back to all changes in this revision

Viewing changes to src/editor/main.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Barry deFreese
  • Date: 2007-09-27 21:27:07 UTC
  • Revision ID: james.westby@ubuntu.com-20070927212707-w1qzmylq1rx8ofod
Tags: upstream-0.0.3
ImportĀ upstreamĀ versionĀ 0.0.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//  This program is free software; you can redistribute it and/or modify
 
2
//  it under the terms of the GNU General Public License as published by
 
3
//  the Free Software Foundation; either version 2 of the License, or
 
4
//  (at your option) any later version.
 
5
//
 
6
//  This program is distributed in the hope that it will be useful,
 
7
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
8
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
9
//  GNU Library General Public License for more details.
 
10
//
 
11
//  You should have received a copy of the GNU General Public License
 
12
//  along with this program; if not, write to the Free Software
 
13
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
14
#ifdef HAVE_CONFIG_H
 
15
#include <config.h>
 
16
#endif
 
17
 
 
18
#include <iostream>
 
19
#include <stdlib.h>
 
20
#include <time.h>
 
21
#include <gtkmm/main.h>
 
22
 
 
23
#include "../Configuration.h"
 
24
#include "../File.h"
 
25
#include "../GraphicsCache.h"
 
26
#include "../timing.h"
 
27
 
 
28
#include "main-window.h"
 
29
 
 
30
 
 
31
sigc::connection on_timer_registered(Timing::timer_slot s, int msecs_interval)
 
32
{
 
33
    return Glib::signal_timeout().connect(s, msecs_interval);
 
34
}
 
35
 
 
36
int main(int argc, char* argv[])
 
37
{
 
38
    srand(time(NULL));         // set the random seed
 
39
 
 
40
    initialize_configuration();
 
41
 
 
42
    setlocale(LC_ALL, Configuration::s_lang.c_str());
 
43
#ifndef __WIN32__
 
44
    bindtextdomain ("lordsawar",PO_PATH);
 
45
#else
 
46
    bindtextdomain ("lordsawar","./locale/");
 
47
#endif
 
48
    textdomain ("lordsawar");
 
49
 
 
50
    // Check if armysets are in the path (otherwise exit)
 
51
    File::scanArmysets();
 
52
 
 
53
    // init GUI stuff
 
54
    g_set_application_name(_("LordsAWar! Map Editor"));
 
55
    Timing::instance().timer_registered.connect(
 
56
        sigc::ptr_fun(on_timer_registered));
 
57
 
 
58
    try
 
59
    {
 
60
        Gtk::Main kit(argc, argv);
 
61
 
 
62
        std::auto_ptr<MainWindow> main_window(new MainWindow);
 
63
        main_window->init(640, 480);
 
64
    
 
65
        main_window->sdl_initialized.connect(
 
66
            sigc::mem_fun(main_window.get(), &MainWindow::show_initial_map));
 
67
        main_window->show();
 
68
        
 
69
        kit.run(main_window->get_window());
 
70
    }
 
71
    catch (const Glib::Error &ex) {
 
72
        std::cerr << ex.what() << std::endl;
 
73
    }
 
74
    
 
75
    return EXIT_SUCCESS;
 
76
}