cpp_photon/src/Application.cpp

76 lines
1.5 KiB
C++
Raw Normal View History

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-05-15 02:50:52 +00:00
// $Id: Application.cpp,v 1.8 2005/05/15 02:50:52 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>
2005-05-15 02:50:52 +00:00
#include <iostream>
2005-03-15 19:21:51 +00:00
#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-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;
new video::VideoCore;
2005-05-15 02:50:52 +00:00
new audio::AudioCore;
2005-02-27 07:43:37 +00:00
2005-03-15 19:21:51 +00:00
// StrVec args;
//
// for(int i=0; i < argc; ++i)
// {
// args.push_back(argv[i]);
// }
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();
video::VideoCore::destroy();
2005-05-15 02:50:52 +00:00
audio::AudioCore::destroy();
2005-03-15 19:21:51 +00:00
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());
PHYSFS_addToSearchPath(arg0_.c_str(),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
}