2005-02-07 02:00:48 +00:00
|
|
|
//This file is part of Photon (http://photon.sourceforge.net)
|
|
|
|
//Copyright (C) 2004-2005 James Turk
|
|
|
|
//
|
|
|
|
// Author:
|
|
|
|
// James Turk (jpt2433@rit.edu)
|
|
|
|
//
|
|
|
|
// Version:
|
2005-07-19 18:35:20 +00:00
|
|
|
// $Id: Application.cpp,v 1.13 2005/07/19 18:35:20 cozman Exp $
|
2005-02-07 02:00:48 +00:00
|
|
|
|
2005-02-13 22:12:02 +00:00
|
|
|
#include "Application.hpp"
|
2005-02-07 02:00:48 +00:00
|
|
|
|
|
|
|
#include "physfs.h"
|
2005-04-21 19:30:19 +00:00
|
|
|
#include "GL/gl.h"
|
2005-03-15 19:21:51 +00:00
|
|
|
|
|
|
|
#include <boost/lexical_cast.hpp>
|
|
|
|
#include "exceptions.hpp"
|
|
|
|
#include "Log.hpp"
|
|
|
|
#include "Kernel.hpp"
|
|
|
|
#include "AppCore.hpp"
|
|
|
|
#include "video/VideoCore.hpp"
|
2005-05-15 02:50:52 +00:00
|
|
|
#include "audio/AudioCore.hpp"
|
2005-06-11 05:28:41 +00:00
|
|
|
#include "util/filesys/filesys.hpp"
|
|
|
|
|
2005-02-07 02:00:48 +00:00
|
|
|
|
|
|
|
namespace photon
|
|
|
|
{
|
|
|
|
|
2005-02-16 04:26:22 +00:00
|
|
|
Application::Application() :
|
|
|
|
photonVer_(0,0,1) // this is the current version
|
2005-02-07 02:00:48 +00:00
|
|
|
{
|
2005-02-13 22:12:02 +00:00
|
|
|
util::VersionInfo physfsReq(1,0,0); // requires PhysFS 1.0.0
|
2005-03-15 19:21:51 +00:00
|
|
|
|
|
|
|
// create the singletons
|
|
|
|
new Kernel;
|
|
|
|
new AppCore;
|
2005-02-27 07:43:37 +00:00
|
|
|
|
2005-05-15 02:50:52 +00:00
|
|
|
util::ensureVersion("PhysFS", initPhysFS(), physfsReq);
|
2005-02-07 02:00:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Application::~Application()
|
|
|
|
{
|
|
|
|
PHYSFS_deinit(); //shutdown PhysFS
|
2005-03-15 19:21:51 +00:00
|
|
|
|
|
|
|
// destroy the singletons
|
|
|
|
AppCore::destroy();
|
|
|
|
Kernel::destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Application::setInitOptions(const char* arg0)
|
|
|
|
{
|
|
|
|
arg0_ = arg0;
|
2005-02-13 22:12:02 +00:00
|
|
|
}
|
|
|
|
|
2005-05-15 02:50:52 +00:00
|
|
|
util::VersionInfo Application::initPhysFS()
|
2005-02-13 22:12:02 +00:00
|
|
|
{
|
|
|
|
PHYSFS_Version ver;
|
2005-05-15 02:50:52 +00:00
|
|
|
PHYSFS_init(arg0_.c_str());
|
2005-06-11 05:28:41 +00:00
|
|
|
PHYSFS_addToSearchPath(PHYSFS_getBaseDir(),0);
|
2005-02-13 22:12:02 +00:00
|
|
|
PHYSFS_getLinkedVersion(&ver);
|
|
|
|
return util::VersionInfo(ver.major, ver.minor, ver.patch);
|
|
|
|
}
|
|
|
|
|
2005-03-15 19:21:51 +00:00
|
|
|
std::string Application::arg0_;
|
2005-02-16 04:26:22 +00:00
|
|
|
|
2005-02-07 02:00:48 +00:00
|
|
|
}
|