Add project files.
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
#include "cMusic.hpp"
|
||||
|
||||
using AudioEngine::cMusic;
|
||||
|
||||
cMusic::cMusic()
|
||||
{}
|
||||
|
||||
/* Copy constructor */
|
||||
cMusic::cMusic(const cMusic& copy)
|
||||
{
|
||||
copy;
|
||||
}
|
||||
|
||||
cMusic::~cMusic()
|
||||
{}
|
||||
|
||||
///Functions
|
||||
/* Plays the music if loaded */
|
||||
void cMusic::PlayMusic()
|
||||
{}
|
||||
|
||||
/* Fades in the music for time */
|
||||
void cMusic::FadeIn(const unsigned int time /*= 1000*/) const
|
||||
{
|
||||
time;
|
||||
}
|
||||
|
||||
/* Fades out the music for time */
|
||||
void cMusic::FideOut(const unsigned int time /*= 1000*/) const
|
||||
{
|
||||
time;
|
||||
}
|
||||
|
||||
/* private:*/
|
||||
///Functions
|
||||
void cMusic::LoadMusic()
|
||||
{}
|
||||
|
||||
void cMusic::UnloadMusic()
|
||||
{}
|
||||
@@ -0,0 +1,47 @@
|
||||
#ifndef _CMUSIC_HPP_
|
||||
#define _CMUSIC_HPP_
|
||||
|
||||
/*** SDL Header Files ***/
|
||||
#include <SDL.h>
|
||||
#include <SDL_mixer.h>
|
||||
|
||||
/*** Custom Header Files ***/
|
||||
//#include "cAudio.hpp"
|
||||
|
||||
/*** DLL Header File ***/
|
||||
#include "dllExport.h"
|
||||
|
||||
#include "cSound.hpp"
|
||||
|
||||
namespace AudioEngine {
|
||||
class EXPORT_FROM_MYDLL cMusic
|
||||
{
|
||||
public:
|
||||
cMusic();
|
||||
/* Copy constructor */
|
||||
cMusic( const cMusic& copy );
|
||||
~cMusic();
|
||||
|
||||
///Functions
|
||||
/* Plays the music if loaded */
|
||||
void PlayMusic();
|
||||
/* Fades in the music for time */
|
||||
void FadeIn( const unsigned int time = 1000 ) const;
|
||||
/* Fades out the music for time */
|
||||
void FideOut( const unsigned int time = 1000 ) const;
|
||||
|
||||
private:
|
||||
///Functions
|
||||
void LoadMusic();
|
||||
void UnloadMusic();
|
||||
|
||||
private:
|
||||
///Variables
|
||||
Mix_Music* mp_music;
|
||||
|
||||
unsigned char m_volume;// = 255
|
||||
|
||||
|
||||
};/// END CLASS DEFINITION cMusic
|
||||
}/// END NAMESPACE DEFINITION AudioEngine
|
||||
#endif/// END IFNDEF _CMUSIC_HPP_
|
||||
@@ -0,0 +1,132 @@
|
||||
#include "cUtility.hpp"
|
||||
|
||||
/*** SDL Header Files ***/
|
||||
#include <SDL.h>
|
||||
#include <SDL_ttf.h>
|
||||
#include <SDL_image.h>
|
||||
#include <SDL_mixer.h>
|
||||
#include <SDL_net.h>
|
||||
|
||||
using UtilityEngine::cUtility;
|
||||
|
||||
/*static*/ cUtility* cUtility::sp_inst = nullptr;
|
||||
|
||||
//private:
|
||||
cUtility::cUtility()
|
||||
{}
|
||||
|
||||
cUtility::~cUtility()
|
||||
{}
|
||||
|
||||
//public:
|
||||
// cUtility& cUtility::operator=( const cUtility& copy )
|
||||
// {
|
||||
// if (this != ©)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// return *this;
|
||||
// }
|
||||
|
||||
///Functions
|
||||
/*static*/ cUtility& cUtility::Inst()
|
||||
{
|
||||
if (sp_inst == nullptr)
|
||||
sp_inst = new cUtility();
|
||||
return *sp_inst;
|
||||
}
|
||||
|
||||
/*static*/ void cUtility::Delete()
|
||||
{
|
||||
delete sp_inst;
|
||||
sp_inst = nullptr;
|
||||
}
|
||||
|
||||
void cUtility::Message( const cString& msg, const cString& debugInfo /*= ""*/, const eTypeSDL typeSDL /*= eTypeSDL::None*/ ) const
|
||||
{
|
||||
cString sdlerror;
|
||||
switch (typeSDL)
|
||||
{
|
||||
case NONE:
|
||||
break;
|
||||
case SDL:
|
||||
sdlerror = SDL_GetError();
|
||||
break;
|
||||
case TTF:
|
||||
sdlerror = TTF_GetError();
|
||||
break;
|
||||
case IMAGE:
|
||||
sdlerror = IMG_GetError();
|
||||
break;
|
||||
case MIXER:
|
||||
sdlerror = Mix_GetError();
|
||||
break;
|
||||
case NET:
|
||||
sdlerror = SDLNet_GetError();
|
||||
break;
|
||||
case GFX:
|
||||
sdlerror = SDL_GetError();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
SDL_ClearError();
|
||||
if (debugInfo.size() > 0)
|
||||
fprintf(stderr, "Error in %s %s %s \n", debugInfo.substr((1 + debugInfo.char_find('\\')), debugInfo.length()).c_str(), msg.c_str(), sdlerror.c_str());
|
||||
else
|
||||
fprintf(stderr, "%s\n", msg.c_str());
|
||||
}
|
||||
|
||||
void cUtility::PrintVersion( const eTypeSDL typeSDL /*= eTypeSDL::ALL*/ ) const
|
||||
{
|
||||
SDL_version compiled_version;
|
||||
SDL_version running_version;
|
||||
|
||||
cString type = "";
|
||||
|
||||
switch (typeSDL)
|
||||
{
|
||||
case ALL:
|
||||
for ( int num = SDL; num <= NET; num++)
|
||||
PrintVersion((eTypeSDL)num);
|
||||
break;
|
||||
case SDL:
|
||||
SDL_VERSION(&compiled_version);
|
||||
SDL_GetVersion(&running_version);
|
||||
type = "SDL";
|
||||
break;
|
||||
case TTF:
|
||||
SDL_TTF_VERSION(&compiled_version);
|
||||
running_version = *TTF_Linked_Version();
|
||||
type = "SDL_TTF";
|
||||
break;
|
||||
case IMAGE:
|
||||
SDL_IMAGE_VERSION(&compiled_version);
|
||||
running_version = *IMG_Linked_Version();
|
||||
type = "SDL_IMAGE";
|
||||
break;
|
||||
case MIXER:
|
||||
SDL_MIXER_VERSION(&compiled_version);
|
||||
running_version = *Mix_Linked_Version();
|
||||
type = "SDL_MIXER";
|
||||
break;
|
||||
case NET:
|
||||
SDL_NET_VERSION(&compiled_version);
|
||||
running_version = *SDLNet_Linked_Version();
|
||||
type = "SDL_NET";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (typeSDL != ALL) {
|
||||
VersionParser("Compiled", compiled_version, type);
|
||||
VersionParser("Running", running_version, type);
|
||||
}
|
||||
}
|
||||
|
||||
///Private:
|
||||
///Functions
|
||||
void cUtility::VersionParser( const cString& runCompiled, const SDL_version& version, const cString& type ) const
|
||||
{
|
||||
fprintf(stderr, "%s with %s version: %u.%u.%u \n", runCompiled.c_str(), type.c_str(), version.major, version.minor, version.patch);
|
||||
}
|
||||
Reference in New Issue
Block a user