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)
#
# 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 glob
@ -16,6 +16,7 @@ def getFilesMulti(paths, pat):
filelist = []
for d in paths:
filelist += glob.glob( os.path.join(d,pat) )
filelist = [ f.replace(os.path.sep,'/') for f in filelist]
return filelist
## 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')]
INC_FILES = getFilesMulti(INC_DIRS, '*.hpp')
libsMap = { 'nt':('opengl32','glu32','openal32'),
libsMap = { 'nt':('opengl32','glu32',['openal32','alut']),
'posix':('GL','GLU','openal'),
'mac':('GL','GLU','openal')}
try:
@ -52,7 +53,7 @@ def BuildSuperHeader(target = None, source = None, env = None):
SuperHeaderAction = Action(BuildSuperHeader)
# Configure the environment (Check libraries):
env = Environment()
env = Environment(ENV = os.environ)
env.Append(CPPPATH='include', CPPFLAGS='-Wall')
env.ParseConfig('freetype-config --cflags')
# Configure

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// 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
#define PHOTON_APPLICATION_HPP
@ -305,6 +305,7 @@ public:
template<class StateT>
void setCurrentState();
#ifdef PHOTON_USE_OPENAL
// Group: AudioCore
public:
// Function: getAudioCore
@ -320,8 +321,10 @@ public:
// it via <getAudioCore>.
//
// Arguments:
// deviceName - Name for desired Audio device.
void initAudioCore(const std::string& deviceName);
// deviceName - Optional name for desired Audio device, will use default
// device if none specified.
void initAudioCore(const std::string& deviceName="");
#endif //PHOTON_USE_OPENAL
// API Initialization
private:
@ -414,7 +417,9 @@ private:
static std::vector<KeyCode> pressedKeys_;
// Cores
#ifdef PHOTON_USE_OPENAL
std::auto_ptr<audio::AudioCore> audioCore_;
#endif //PHOTON_USE_OPENAL
};
template<class StateT>

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// 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
@ -202,7 +202,8 @@ void Source<ResMgrT>::open(const std::string& name)
uint bufferID;
ResourceManaged<ResMgrT>::open(name);
resMgr_.getAudioData(getName(), bufferID);
ResourceManaged<ResMgrT>::resMgr_.getAudioData(
ResourceManaged<ResMgrT>::getName(), bufferID);
// attach buffer to source
alSourcei(sourceID_, AL_BUFFER, bufferID);
@ -222,7 +223,8 @@ Source<ResMgrT>& Source<ResMgrT>::operator=(const Source<ResMgrT>& rhs)
uint bufferID;
ResourceManaged<ResMgrT>::operator=(rhs);
resMgr_.getAudioData(getName(), bufferID);
ResourceManaged<ResMgrT>::resMgr_.getAudioData(
ResourceManaged<ResMgrT>::getName(), bufferID);
// attach buffer to source
alSourcei(sourceID_, AL_BUFFER, bufferID);
@ -335,13 +337,15 @@ template<class ResMgrT>
void Source<ResMgrT>::addResource(const std::string& name,
const std::string& path)
{
resMgr_.newResource(name, ResourceDescriptor(path));
ResourceManaged<ResMgrT>::resMgr_.newResource(name,
ResourceDescriptor(path));
}
template<class ResMgrT>
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
#define PHOTON_HPP
#include "Kernel.hpp"
#include "types.hpp"
#include "State.hpp"
#include "Application.hpp"
#include "Task.hpp"
#include "exceptions.hpp"
#include "photon.hpp"
#include "InputListener.hpp"
#include "entrypoint.hpp"
#include "LogSink.hpp"
#include "Log.hpp"
#include "ResourceManaged.hpp"
#include "ResourceManager.hpp"
#include "audio/SampleResourceManager.hpp"
#include "audio/Source.hpp"
#include "audio/AudioCore.hpp"
#include "math/math.hpp"
#include "math/Rect.hpp"
#include "math/Vector2.hpp"
#include "math/Circle.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/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/TextureResourceManager.hpp"
#include "video/Font.hpp"
#endif // PHOTON_HPP
#ifndef PHOTON_HPP
#define PHOTON_HPP
#include "Application.hpp"
#include "entrypoint.hpp"
#include "exceptions.hpp"
#include "InputListener.hpp"
#include "Kernel.hpp"
#include "Log.hpp"
#include "LogSink.hpp"
#include "photon.hpp"
#include "ResourceManaged.hpp"
#include "ResourceManager.hpp"
#include "State.hpp"
#include "Task.hpp"
#include "types.hpp"
#include "audio/AudioCore.hpp"
#include "audio/SampleResourceManager.hpp"
#include "audio/Source.hpp"
#include "math/Circle.hpp"
#include "math/math.hpp"
#include "math/Rect.hpp"
#include "math/Vector2.hpp"
#include "util/ConfigFile.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 "video/Color.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

View File

@ -5,14 +5,14 @@
// James Turk (jpt2433@rit.edu)
//
// 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
#define PHOTON_VIDEO_FONTRESOURCEMANAGER_HPP
#include "ResourceManager.hpp"
#include <ft2build.h>
#include "ft2build.h"
#include FT_FREETYPE_H
namespace photon

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// 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"
@ -386,6 +386,8 @@ double Application::getFramerate()
{
return 1/updateTask_->secPerFrame_;
}
// AudioCore ///////////////////////////////////////////////////////////////////
#ifdef PHOTON_USE_OPENAL
audio::AudioCore& Application::getAudioCore()
{
@ -411,6 +413,8 @@ void Application::initAudioCore(const std::string& deviceName)
}
}
#endif //PHOTON_USE_OPENAL
// API initialization //////////////////////////////////////////////////////////
util::VersionInfo Application::initPhysFS(const std::string& arg0)

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// 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
@ -133,12 +133,10 @@ util::VersionInfo AudioCore::initOpenAL(const std::string& deviceName)
// OpenAL needs a standard version string format badly
ss << alGetString(AL_VERSION);
#if defined(WINVER)
ss >> junks >> major >> junkc >> minor; // format is "OpenAL 1.0"
#elif defined(linux)
#if defined(linux)
ss >> major >> junkc >> minor >> junkc >> patch;
#else
#warning OpenAL only built on Windows/Linux, find out version on OSX
ss >> junks >> major >> junkc >> minor; // format is "OpenAL 1.0"
#endif
throwOpenALError("AudioCore::initOpenAL");

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// 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"
using namespace photon;
@ -187,7 +187,7 @@ int PhotonMain(const StrVec& args)
// create window
Application::getInstance().createDisplay(800,600,32,0,0,false);
// initialize audio core
Application::getInstance().initAudioCore("OSS");
Application::getInstance().initAudioCore();
// be sure to add FPSDisplayTask
Kernel::getInstance().addTask(TaskPtr(new FPSDisplayTask()));

View File

@ -1,11 +1,11 @@
[]
#config1.ini
[sec2]
fancy = 0
fancy2 = "james"
[sec]
int=3
float=3
string=three
[]
#config1.ini
[sec2]
fancy = 0
fancy2 = "james"
[sec]
int=3
float=3
string=three

View File

@ -1,9 +1,9 @@
[]
#config2.ini
[sec]
var = 0
hex = 0xff
[sec2]
var = 2
[]
#config2.ini
[sec]
var = 0
hex = 0xff
[sec2]
var = 2