3 * The mainline driver for PoopmUp.
5 * Copyright 2008, 2010 Stephen M. Webb <stephenw@poopmup.org>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include <poopmup/application.h>
25 #include <SDL/SDL_main.h>
32 * A class that futzes around wit cerr to force-redirect it to a log file.
33 * This is mostly for use on windows or under a GUI where stderr is not
34 * normally seen except by gooroos.
39 // Redirects stderr into a log file.
40 LogFutzer(std::ostream
& stream
, const std::string
& fname
)
42 , m_errbuf(std::cerr
.rdbuf())
43 , m_logfile(fname
.c_str())
45 m_stream
.rdbuf(m_logfile
.rdbuf());
51 m_stream
.rdbuf(m_errbuf
);
55 std::ostream
& m_stream
;
56 std::streambuf
* m_errbuf
;
57 std::ofstream m_logfile
;
59 } // anonymous namespace
63 * @brief The main entyry point for the game.
65 int main(int argc
, char* argv
[])
68 LogFutzer
out(std::cout
, "poopmup.out");
69 LogFutzer
err(std::cerr
, "poopmup.err");
72 // Create and run the application.
73 Poopmup::Application
application(argc
, argv
);
74 return application
.exec();