I've been trying hard and I've done my homework, can you please help me with what I have?
The problem currently is that when I uncomment _NGE_COMPILE_WITH_IRRKLANG_ I get compilation errors. It should be like irrlicht's DirectX/OpenGL so you won't need the libs/.h files to compile if you choose so.
What's wrong with that:
Code: Select all
// Copyright (c) 2007-2008 Tomer Nosrati
// This file is part of the "NUSoftware Game Engine".
// For conditions of distribution and use, see copyright notice in nge.h
#ifndef __I_AUDIO_DEVICE_H__
#define __I_AUDIO_DEVICE_H__
#include "../NGE_CompileConfig.h"
#include "irrlicht.h"
using namespace irr;
#ifdef _NGE_COMPILE_WITH_IRRKLANG_
#include "irrKlang.h"
using namespace irrklang;
#endif
enum E_AUDIO_DEVICE {EAD_IRRKLANG, EAD_FMOD};
class IAudioDevice : public virtual IReferenceCounted
{
public:
virtual ~IAudioDevice() {}
#ifdef _NGE_COMPILE_WITH_IRRKLANG_
virtual ISoundEngine* getSoundEngine() const = 0;
#endif
};
IAudioDevice* createAudioDevice(E_AUDIO_DEVICE AudioDeviceType, ILogger* irrLogger);
#endif // __I_AUDIO_DEVICE_H__Code: Select all
// Copyright (c) 2007-2008 Tomer Nosrati
// This file is part of the "NUSoftware Game Engine".
// For conditions of distribution and use, see copyright notice in nge.h
#ifndef __I_AUDIO_DEVICE_STUB_H__
#define __I_AUDIO_DEVICE_STUB_H__
#include "IAudioDevice.h"
class CAudioDeviceStub : public IAudioDevice
{
public:
virtual ~CAudioDeviceStub() {}
};
#endif // __I_AUDIO_DEVICE_STUB_H__Code: Select all
// Copyright (c) 2007-2008 Tomer Nosrati
// This file is part of the "NUSoftware Game Engine".
// For conditions of distribution and use, see copyright notice in nge.h
#include "CAudioDeviceStub.h"
#ifdef _NGE_COMPILE_WITH_IRRKLANG_
#include "CIrrKlangDevice.h"
#endif
IAudioDevice* createAudioDevice(E_AUDIO_DEVICE AudioDeviceType, ILogger* irrLogger)
{
IAudioDevice* AudioDevice = 0;
switch(AudioDeviceType)
{
break;
case EAD_IRRKLANG:
#ifdef _NGE_COMPILE_WITH_IRRKLANG_
AudioDevice = new CIrrKlangDevice();
if(!AudioDevice)
irrLogger->log("Could not create IrrKlang device", ELL_ERROR);
break;
#endif
irrLogger->log("IrrKlang device was not compiled into this lib. Try another one.", ELL_ERROR);
break;
}
return AudioDevice;
}Code: Select all
// Copyright (c) 2007-2008 Tomer Nosrati
// This file is part of the "NUSoftware Game Engine".
// For conditions of distribution and use, see copyright notice in nge.h
#ifndef __C_IRRKLANG_DEVICE_H__
#define __C_IRRKLANG_DEVICE_H__
#include "CAudioDeviceStub.h"
#ifdef _NGE_COMPILE_WITH_IRRKLANG_
#include "irrKlang.h"
#if GAME_COMPILER == COMPILER_MSVC
# pragma message ("Linking irrKlang")
# pragma comment(lib, "irrKlang.lib")
#endif
using namespace irrklang;
class CIrrKlangDevice : public CAudioDeviceStub
{
public:
CIrrKlangDevice();
virtual ~CIrrKlangDevice();
virtual ISoundEngine* getSoundEngine() const;
private:
ISoundEngine* m_pSoundEngine;
};
#endif // _NGE_COMPILE_WITH_IRRKLANG_
#endif // __C_IRRKLANG_DEVICE_H__Code: Select all
// Copyright (c) 2007-2008 Tomer Nosrati
// This file is part of the "NUSoftware Game Engine".
// For conditions of distribution and use, see copyright notice in nge.h
#include "CIrrKlangDevice.h"
CIrrKlangDevice::CIrrKlangDevice()
{
m_pSoundEngine = createIrrKlangDevice();
}
CIrrKlangDevice::~CIrrKlangDevice()
{
if(m_pSoundEngine)
{
m_pSoundEngine->drop();
m_pSoundEngine = 0;
}
}
ISoundEngine* CIrrKlangDevice::getSoundEngine() const
{
return m_pSoundEngine;
}My question is how to design it wisely so I'll be able to uncomment and get the expected behavior (Which is like compiling irrlicht without DX8 and typing it as the desired device - getting a console msg and quitting).
Thanks!

