Move the wxwidgets stuff to one directory
[lsnes.git] / platform / wxwidgets / main-wxwidgets.cpp
blob456353fbc60cabd97225a725f49ec13f1fa92a7f
1 #include "lsnes.hpp"
2 #include <snes/snes.hpp>
3 #include <ui-libsnes/libsnes.hpp>
4 #include <wx/wx.h>
5 #include <wx/event.h>
6 #include <wx/control.h>
7 #include <wx/combobox.h>
8 #include <cassert>
9 #include "rom.hpp"
10 #include "avsnoop.hpp"
11 #include "rrdata.hpp"
12 #include "framerate.hpp"
13 #include "zip.hpp"
14 #include <boost/lexical_cast.hpp>
15 #include "misc.hpp"
16 #include "window.hpp"
17 #include "lua.hpp"
18 #include "rom_select_window.hpp"
19 #include "messages_window.hpp"
20 #include "status_window.hpp"
22 class lsnes_app : public wxApp
24 public:
25 virtual bool OnInit();
26 virtual int OnExit();
29 IMPLEMENT_APP(lsnes_app)
31 bool lsnes_app::OnInit()
33 set_random_seed();
36 std::ostringstream x;
37 x << snes_library_id() << " (" << SNES::Info::Profile << " core)";
38 bsnes_core_version = x.str();
40 window::init();
41 init_lua();
43 messages << "BSNES version: " << bsnes_core_version << std::endl;
44 messages << "lsnes version: lsnes rr" << lsnes_version << std::endl;
46 std::string cfgpath = get_config_path();
47 messages << "Saving per-user data to: " << get_config_path() << std::endl;
49 wx_messages_window* msgs = new wx_messages_window();
50 window1 = msgs;
51 msgs->Show();
53 wx_rom_select_window* romwin = new wx_rom_select_window();
54 romwin->Show();
56 return true;
59 int lsnes_app::OnExit()
61 av_snooper::_end();
62 rrdata::close();
63 window::quit();
64 return 0;
67 void window::notify_message() throw(std::bad_alloc, std::runtime_error)
69 if(wx_messages_window::ptr)
70 wx_messages_window::ptr->notify_message();