Windows build changes / OpenAL fixes

This commit is contained in:
James Turk 2005-08-08 21:39:40 +00:00
parent c6aa2a8e82
commit e328885f76
10 changed files with 93 additions and 80 deletions

View File

@ -5,7 +5,7 @@
# James Turk (jpt2433@rit.edu) # James Turk (jpt2433@rit.edu)
# #
# Version: # Version:
# $Id: SConstruct,v 1.18 2005/07/18 05:14:18 cozman Exp $ # $Id: SConstruct,v 1.19 2005/08/08 21:39:40 cozman Exp $
import os,os.path import os,os.path
import glob import glob
@ -16,6 +16,7 @@ def getFilesMulti(paths, pat):
filelist = [] filelist = []
for d in paths: for d in paths:
filelist += glob.glob( os.path.join(d,pat) ) filelist += glob.glob( os.path.join(d,pat) )
filelist = [ f.replace(os.path.sep,'/') for f in filelist]
return filelist return filelist
## config variables ## ## config variables ##
@ -26,7 +27,7 @@ INC_DIRS = ["include/%s" % d for d in SUB_DIRS]
SRC_FILES = [f.replace('src','build') for f in getFilesMulti(SRC_DIRS, '*.cpp')] SRC_FILES = [f.replace('src','build') for f in getFilesMulti(SRC_DIRS, '*.cpp')]
INC_FILES = getFilesMulti(INC_DIRS, '*.hpp') INC_FILES = getFilesMulti(INC_DIRS, '*.hpp')
libsMap = { 'nt':('opengl32','glu32','openal32'), libsMap = { 'nt':('opengl32','glu32',['openal32','alut']),
'posix':('GL','GLU','openal'), 'posix':('GL','GLU','openal'),
'mac':('GL','GLU','openal')} 'mac':('GL','GLU','openal')}
try: try:
@ -52,7 +53,7 @@ def BuildSuperHeader(target = None, source = None, env = None):
SuperHeaderAction = Action(BuildSuperHeader) SuperHeaderAction = Action(BuildSuperHeader)
# Configure the environment (Check libraries): # Configure the environment (Check libraries):
env = Environment() env = Environment(ENV = os.environ)
env.Append(CPPPATH='include', CPPFLAGS='-Wall') env.Append(CPPPATH='include', CPPFLAGS='-Wall')
env.ParseConfig('freetype-config --cflags') env.ParseConfig('freetype-config --cflags')
# Configure # Configure

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu) // James Turk (jpt2433@rit.edu)
// //
// Version: // Version:
// $Id: Application.hpp,v 1.15 2005/08/08 19:19:24 cozman Exp $ // $Id: Application.hpp,v 1.16 2005/08/08 21:39:41 cozman Exp $
#ifndef PHOTON_APPLICATION_HPP #ifndef PHOTON_APPLICATION_HPP
#define PHOTON_APPLICATION_HPP #define PHOTON_APPLICATION_HPP
@ -305,6 +305,7 @@ public:
template<class StateT> template<class StateT>
void setCurrentState(); void setCurrentState();
#ifdef PHOTON_USE_OPENAL
// Group: AudioCore // Group: AudioCore
public: public:
// Function: getAudioCore // Function: getAudioCore
@ -320,8 +321,10 @@ public:
// it via <getAudioCore>. // it via <getAudioCore>.
// //
// Arguments: // Arguments:
// deviceName - Name for desired Audio device. // deviceName - Optional name for desired Audio device, will use default
void initAudioCore(const std::string& deviceName); // device if none specified.
void initAudioCore(const std::string& deviceName="");
#endif //PHOTON_USE_OPENAL
// API Initialization // API Initialization
private: private:
@ -414,7 +417,9 @@ private:
static std::vector<KeyCode> pressedKeys_; static std::vector<KeyCode> pressedKeys_;
// Cores // Cores
#ifdef PHOTON_USE_OPENAL
std::auto_ptr<audio::AudioCore> audioCore_; std::auto_ptr<audio::AudioCore> audioCore_;
#endif //PHOTON_USE_OPENAL
}; };
template<class StateT> template<class StateT>

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu) // James Turk (jpt2433@rit.edu)
// //
// Version: // Version:
// $Id: Source.hpp,v 1.3 2005/07/18 05:14:18 cozman Exp $ // $Id: Source.hpp,v 1.4 2005/08/08 21:39:41 cozman Exp $
#ifdef PHOTON_USE_OPENAL #ifdef PHOTON_USE_OPENAL
@ -202,7 +202,8 @@ void Source<ResMgrT>::open(const std::string& name)
uint bufferID; uint bufferID;
ResourceManaged<ResMgrT>::open(name); ResourceManaged<ResMgrT>::open(name);
resMgr_.getAudioData(getName(), bufferID); ResourceManaged<ResMgrT>::resMgr_.getAudioData(
ResourceManaged<ResMgrT>::getName(), bufferID);
// attach buffer to source // attach buffer to source
alSourcei(sourceID_, AL_BUFFER, bufferID); alSourcei(sourceID_, AL_BUFFER, bufferID);
@ -222,7 +223,8 @@ Source<ResMgrT>& Source<ResMgrT>::operator=(const Source<ResMgrT>& rhs)
uint bufferID; uint bufferID;
ResourceManaged<ResMgrT>::operator=(rhs); ResourceManaged<ResMgrT>::operator=(rhs);
resMgr_.getAudioData(getName(), bufferID); ResourceManaged<ResMgrT>::resMgr_.getAudioData(
ResourceManaged<ResMgrT>::getName(), bufferID);
// attach buffer to source // attach buffer to source
alSourcei(sourceID_, AL_BUFFER, bufferID); alSourcei(sourceID_, AL_BUFFER, bufferID);
@ -335,13 +337,15 @@ template<class ResMgrT>
void Source<ResMgrT>::addResource(const std::string& name, void Source<ResMgrT>::addResource(const std::string& name,
const std::string& path) const std::string& path)
{ {
resMgr_.newResource(name, ResourceDescriptor(path)); ResourceManaged<ResMgrT>::resMgr_.newResource(name,
ResourceDescriptor(path));
} }
template<class ResMgrT> template<class ResMgrT>
void Source<ResMgrT>::addResource(const std::string& path) void Source<ResMgrT>::addResource(const std::string& path)
{ {
resMgr_.newResource(path, ResourceDescriptor(path)); ResourceManaged<ResMgrT>::resMgr_.newResource(path,
ResourceDescriptor(path));
} }
} }

View File

@ -1,39 +1,40 @@
#ifndef PHOTON_HPP #ifndef PHOTON_HPP
#define PHOTON_HPP #define PHOTON_HPP
#include "Kernel.hpp"
#include "types.hpp"
#include "State.hpp"
#include "Application.hpp" #include "Application.hpp"
#include "Task.hpp"
#include "exceptions.hpp"
#include "photon.hpp"
#include "InputListener.hpp"
#include "entrypoint.hpp" #include "entrypoint.hpp"
#include "LogSink.hpp" #include "exceptions.hpp"
#include "InputListener.hpp"
#include "Kernel.hpp"
#include "Log.hpp" #include "Log.hpp"
#include "LogSink.hpp"
#include "photon.hpp"
#include "ResourceManaged.hpp" #include "ResourceManaged.hpp"
#include "ResourceManager.hpp" #include "ResourceManager.hpp"
#include "State.hpp"
#include "Task.hpp"
#include "types.hpp"
#include "audio/AudioCore.hpp"
#include "audio/SampleResourceManager.hpp" #include "audio/SampleResourceManager.hpp"
#include "audio/Source.hpp" #include "audio/Source.hpp"
#include "audio/AudioCore.hpp" #include "math/Circle.hpp"
#include "math/math.hpp" #include "math/math.hpp"
#include "math/Rect.hpp" #include "math/Rect.hpp"
#include "math/Vector2.hpp" #include "math/Vector2.hpp"
#include "math/Circle.hpp"
#include "util/ConfigFile.hpp" #include "util/ConfigFile.hpp"
#include "util/VersionInfo.hpp"
#include "util/Singleton.hpp"
#include "util/RandGen.hpp"
#include "util/Timer.hpp"
#include "util/FileBuffer.hpp" #include "util/FileBuffer.hpp"
#include "util/RandGen.hpp"
#include "util/Singleton.hpp"
#include "util/Timer.hpp"
#include "util/VersionInfo.hpp"
#include "util/filesys/filesys.hpp" #include "util/filesys/filesys.hpp"
#include "video/Pen.hpp"
#include "video/Image.hpp"
#include "video/FontResourceManager.hpp"
#include "video/Texture.hpp"
#include "video/Color.hpp" #include "video/Color.hpp"
#include "video/TextureResourceManager.hpp"
#include "video/Font.hpp" #include "video/Font.hpp"
#include "video/FontResourceManager.hpp"
#include "video/Image.hpp"
#include "video/Pen.hpp"
#include "video/Texture.hpp"
#include "video/TextureResourceManager.hpp"
#include "video/VideoCore.hpp"
#endif // PHOTON_HPP #endif // PHOTON_HPP

View File

@ -5,14 +5,14 @@
// James Turk (jpt2433@rit.edu) // James Turk (jpt2433@rit.edu)
// //
// Version: // Version:
// $Id: FontResourceManager.hpp,v 1.4 2005/07/18 07:19:48 cozman Exp $ // $Id: FontResourceManager.hpp,v 1.5 2005/08/08 21:39:41 cozman Exp $
#ifndef PHOTON_VIDEO_FONTRESOURCEMANAGER_HPP #ifndef PHOTON_VIDEO_FONTRESOURCEMANAGER_HPP
#define PHOTON_VIDEO_FONTRESOURCEMANAGER_HPP #define PHOTON_VIDEO_FONTRESOURCEMANAGER_HPP
#include "ResourceManager.hpp" #include "ResourceManager.hpp"
#include <ft2build.h> #include "ft2build.h"
#include FT_FREETYPE_H #include FT_FREETYPE_H
namespace photon namespace photon

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu) // James Turk (jpt2433@rit.edu)
// //
// Version: // Version:
// $Id: Application.cpp,v 1.19 2005/08/08 19:19:21 cozman Exp $ // $Id: Application.cpp,v 1.20 2005/08/08 21:39:41 cozman Exp $
#include "Application.hpp" #include "Application.hpp"
@ -386,6 +386,8 @@ double Application::getFramerate()
{ {
return 1/updateTask_->secPerFrame_; return 1/updateTask_->secPerFrame_;
} }
// AudioCore ///////////////////////////////////////////////////////////////////
#ifdef PHOTON_USE_OPENAL
audio::AudioCore& Application::getAudioCore() audio::AudioCore& Application::getAudioCore()
{ {
@ -411,6 +413,8 @@ void Application::initAudioCore(const std::string& deviceName)
} }
} }
#endif //PHOTON_USE_OPENAL
// API initialization ////////////////////////////////////////////////////////// // API initialization //////////////////////////////////////////////////////////
util::VersionInfo Application::initPhysFS(const std::string& arg0) util::VersionInfo Application::initPhysFS(const std::string& arg0)

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu) // James Turk (jpt2433@rit.edu)
// //
// Version: // Version:
// $Id: AudioCore.cpp,v 1.12 2005/08/08 07:00:46 cozman Exp $ // $Id: AudioCore.cpp,v 1.13 2005/08/08 21:39:41 cozman Exp $
#ifdef PHOTON_USE_OPENAL #ifdef PHOTON_USE_OPENAL
@ -133,12 +133,10 @@ util::VersionInfo AudioCore::initOpenAL(const std::string& deviceName)
// OpenAL needs a standard version string format badly // OpenAL needs a standard version string format badly
ss << alGetString(AL_VERSION); ss << alGetString(AL_VERSION);
#if defined(WINVER) #if defined(linux)
ss >> junks >> major >> junkc >> minor; // format is "OpenAL 1.0"
#elif defined(linux)
ss >> major >> junkc >> minor >> junkc >> patch; ss >> major >> junkc >> minor >> junkc >> patch;
#else #else
#warning OpenAL only built on Windows/Linux, find out version on OSX ss >> junks >> major >> junkc >> minor; // format is "OpenAL 1.0"
#endif #endif
throwOpenALError("AudioCore::initOpenAL"); throwOpenALError("AudioCore::initOpenAL");

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu) // James Turk (jpt2433@rit.edu)
// //
// Version: // Version:
// $Id: Audio_test.cpp,v 1.11 2005/08/08 19:24:30 cozman Exp $ // $Id: Audio_test.cpp,v 1.12 2005/08/08 21:39:41 cozman Exp $
#include "photon.hpp" #include "photon.hpp"
using namespace photon; using namespace photon;
@ -187,7 +187,7 @@ int PhotonMain(const StrVec& args)
// create window // create window
Application::getInstance().createDisplay(800,600,32,0,0,false); Application::getInstance().createDisplay(800,600,32,0,0,false);
// initialize audio core // initialize audio core
Application::getInstance().initAudioCore("OSS"); Application::getInstance().initAudioCore();
// be sure to add FPSDisplayTask // be sure to add FPSDisplayTask
Kernel::getInstance().addTask(TaskPtr(new FPSDisplayTask())); Kernel::getInstance().addTask(TaskPtr(new FPSDisplayTask()));