/** * \brief Initializes the game engine. * \param argc number of arguments of the command line * \param argv command-line arguments */ MainLoop::MainLoop(int argc, char** argv): root_surface(NULL), lua_context(NULL), exiting(false), game(NULL), next_game(NULL) { // Initialize low-level features (audio, video, files...). System::initialize(argc, argv); // Read the quest general properties. QuestProperties quest_properties(*this); quest_properties.load(); // Read the quest resource list from file project_db.dat. QuestResourceList::initialize(); root_surface = new Surface(VideoManager::get_instance()->get_quest_size()); root_surface->increment_refcount(); lua_context = new LuaContext(*this); lua_context->initialize(); // Create the window now that we know the final outset size. VideoManager::get_instance()->create_window(); }
/** * \brief Initializes the game engine. * \param args Command-line arguments. */ MainLoop::MainLoop(const CommandLine& args): root_surface(NULL), lua_context(NULL), exiting(false), game(NULL), next_game(NULL) { // Initialize basic features (input, audio, video, files...). System::initialize(args); // Read the quest general properties. QuestProperties quest_properties(*this); quest_properties.load(); // Read the quest resource list from data. QuestResourceList::initialize(); // Create the quest surface. root_surface = Surface::create( Video::get_quest_size() ); root_surface->set_software_destination(false); // Accelerate this surface. RefCountable::ref(root_surface); // Run the Lua world. // Do this after the creation of the window, but before showing the window, // because Lua might change the video mode initially. lua_context = new LuaContext(*this); lua_context->initialize(); // Finally show the window. Video::show_window(); }