initial commit, lordsawar source, slightly modified
[lordsawar] / src / editor / tileset-main.cpp
1 //  Copyright (C) 2008, 2009 Ben Asselstine
2 //
3 //  This program is free software; you can redistribute it and/or modify
4 //  it under the terms of the GNU General Public License as published by
5 //  the Free Software Foundation; either version 3 of the License, or
6 //  (at your option) any later version.
7 //
8 //  This program is distributed in the hope that it will be useful,
9 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
10 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 //  GNU Library General Public License for more details.
12 //
13 //  You should have received a copy of the GNU General Public License
14 //  along with this program; if not, write to the Free Software
15 //  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
16 //  02110-1301, USA.
17
18 #ifdef HAVE_CONFIG_H
19 #include <config.h>
20 #endif
21
22 #include <iostream>
23 #include <stdlib.h>
24 #include <time.h>
25 #include <gtkmm.h>
26
27 #include "Configuration.h"
28 #include "File.h"
29 #include "GraphicsCache.h"
30 #include "timing.h"
31
32 #include "tileset-window.h"
33
34 int max_vector_width;
35 int main(int argc, char* argv[])
36 {
37     srand(time(NULL));         // set the random seed
38
39     initialize_configuration();
40     Vector<int>::setMaximumWidth(1000);
41
42     setlocale(LC_ALL, Configuration::s_lang.c_str());
43     textdomain ("lordsawar");
44
45     // Check if tilesets are in the path (otherwise exit)
46     Tileset::scanSystemCollection();
47
48     // init GUI stuff
49     g_set_application_name(_("LordsAWar! Tileset Editor"));
50
51     TileSetWindow *tileset_window = NULL;
52     try
53     {
54         Gtk::Main kit(argc, argv);
55
56         if (argc > 1)
57           tileset_window = new TileSetWindow(argv[1]);
58         else
59           tileset_window = new TileSetWindow;
60         tileset_window->show();
61         
62         kit.run(tileset_window->get_window());
63         delete tileset_window;
64     }
65     catch (const Glib::Error &ex) {
66         std::cerr << ex.what() << std::endl;
67     }
68     
69     return EXIT_SUCCESS;
70 }