Ported services and sound, now just GUI left
This commit is contained in:
@@ -417,6 +417,12 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath=".\src\include\DataModelV3\SelectionService.h">
|
RelativePath=".\src\include\DataModelV3\SelectionService.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\include\DataModelV3\SoundInstance.h">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\include\DataModelV3\SoundService.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\include\DataModelV3\WorkspaceInstance.h">
|
RelativePath=".\src\include\DataModelV3\WorkspaceInstance.h">
|
||||||
</File>
|
</File>
|
||||||
@@ -524,12 +530,6 @@
|
|||||||
<Filter
|
<Filter
|
||||||
Name="DataModelV2"
|
Name="DataModelV2"
|
||||||
Filter="">
|
Filter="">
|
||||||
<File
|
|
||||||
RelativePath=".\src\source\DataModelV2\BaseButtonInstance.cpp">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\src\source\DataModelV2\BaseGuiInstance.cpp">
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\source\DataModelV2\DataModelInstance.cpp">
|
RelativePath=".\src\source\DataModelV2\DataModelInstance.cpp">
|
||||||
<FileConfiguration
|
<FileConfiguration
|
||||||
@@ -560,12 +560,6 @@
|
|||||||
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\src\source\DataModelV2\GuiRootInstance.cpp">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\src\source\DataModelV2\ImageButtonInstance.cpp">
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\source\DataModelV2\Instance.cpp">
|
RelativePath=".\src\source\DataModelV2\Instance.cpp">
|
||||||
<FileConfiguration
|
<FileConfiguration
|
||||||
@@ -638,15 +632,9 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath=".\src\source\DataModelV2\SoundService.cpp">
|
RelativePath=".\src\source\DataModelV2\SoundService.cpp">
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\src\source\DataModelV2\TextButtonInstance.cpp">
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\ThumbnailGeneratorInstance.cpp">
|
RelativePath=".\ThumbnailGeneratorInstance.cpp">
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\src\source\DataModelV2\ToggleImageButtonInstance.cpp">
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\source\DataModelV2\WorkspaceInstance.cpp">
|
RelativePath=".\src\source\DataModelV2\WorkspaceInstance.cpp">
|
||||||
<FileConfiguration
|
<FileConfiguration
|
||||||
@@ -662,9 +650,31 @@
|
|||||||
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<Filter
|
||||||
RelativePath=".\src\source\XplicitNgine\XplicitNgine.cpp">
|
Name="Gui"
|
||||||
</File>
|
Filter="">
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\source\DataModelV2\BaseButtonInstance.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\source\DataModelV2\BaseGuiInstance.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\source\DataModelV2\GuiRootInstance.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\source\DataModelV2\ImageButtonInstance.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\source\DataModelV2\TextButtonInstance.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\source\DataModelV2\ToggleImageButtonInstance.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\source\XplicitNgine\XplicitNgine.cpp">
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Helpers">
|
Name="Helpers">
|
||||||
@@ -730,6 +740,36 @@
|
|||||||
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\source\DataModelV3\SoundInstance.cpp">
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\source\DataModelV3\SoundService.cpp">
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\source\DataModelV3\WorkspaceInstance.cpp">
|
RelativePath=".\src\source\DataModelV3\WorkspaceInstance.cpp">
|
||||||
</File>
|
</File>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ using namespace B3D;
|
|||||||
//#include "GuiRootInstance.h"
|
//#include "GuiRootInstance.h"
|
||||||
//#include "ThumbnailGeneratorInstance.h"
|
//#include "ThumbnailGeneratorInstance.h"
|
||||||
#include "XplicitNgine/XplicitNgine.h"
|
#include "XplicitNgine/XplicitNgine.h"
|
||||||
//#include "SoundService.h"
|
#include "SoundService.h"
|
||||||
#include "LightingInstance.h"
|
#include "LightingInstance.h"
|
||||||
|
|
||||||
// Libraries
|
// Libraries
|
||||||
@@ -32,7 +32,7 @@ namespace B3D {
|
|||||||
LevelInstance* getLevel();
|
LevelInstance* getLevel();
|
||||||
XplicitNgine* getEngine();
|
XplicitNgine* getEngine();
|
||||||
// ThumbnailGeneratorInstance* getThumbnailGenerator();
|
// ThumbnailGeneratorInstance* getThumbnailGenerator();
|
||||||
// SoundService* getSoundService();
|
SoundService* getSoundService();
|
||||||
LightingInstance* getLighting();
|
LightingInstance* getLighting();
|
||||||
|
|
||||||
std::string message;
|
std::string message;
|
||||||
@@ -55,7 +55,7 @@ namespace B3D {
|
|||||||
SelectionService* selectionService;
|
SelectionService* selectionService;
|
||||||
// ThumbnailGeneratorInstance* thumbnailGenerator;
|
// ThumbnailGeneratorInstance* thumbnailGenerator;
|
||||||
XplicitNgine* xplicitNgine;
|
XplicitNgine* xplicitNgine;
|
||||||
// SoundService* soundService;
|
SoundService* soundService;
|
||||||
LightingInstance* lightingInstance;
|
LightingInstance* lightingInstance;
|
||||||
bool running;
|
bool running;
|
||||||
|
|
||||||
|
|||||||
30
src/include/DataModelV3/SoundInstance.h
Normal file
30
src/include/DataModelV3/SoundInstance.h
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "Instance.h"
|
||||||
|
namespace B3D{
|
||||||
|
class SoundInstance : public Instance
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SoundInstance(void);
|
||||||
|
~SoundInstance(void);
|
||||||
|
|
||||||
|
// Getters
|
||||||
|
float getSoundVolume();
|
||||||
|
std::string getSoundId();
|
||||||
|
bool isPlayedOnRemove();
|
||||||
|
bool isLooped();
|
||||||
|
|
||||||
|
// Setters
|
||||||
|
void setSoundVolume(float newVolume);
|
||||||
|
void setSoundId(std::string newSoundId);
|
||||||
|
void setIsPlayedOnRemove(bool isPlayed);
|
||||||
|
void setIsLooped(bool isLooped);
|
||||||
|
|
||||||
|
// Functions
|
||||||
|
void play();
|
||||||
|
private:
|
||||||
|
float soundVolume;
|
||||||
|
std::string soundId;
|
||||||
|
bool playOnRemove;
|
||||||
|
bool looped;
|
||||||
|
};
|
||||||
|
}
|
||||||
17
src/include/DataModelV3/SoundService.h
Normal file
17
src/include/DataModelV3/SoundService.h
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "Instance.h"
|
||||||
|
#include "SoundInstance.h"
|
||||||
|
namespace B3D
|
||||||
|
{
|
||||||
|
class SoundService : public Instance
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SoundService(void);
|
||||||
|
~SoundService(void);
|
||||||
|
|
||||||
|
float getMusicVolume();
|
||||||
|
void playSound(Instance* sound);
|
||||||
|
private:
|
||||||
|
float musicVolume;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -12,7 +12,7 @@ DataModelInstance::DataModelInstance(void)
|
|||||||
//guiRoot = new GuiRootInstance();
|
//guiRoot = new GuiRootInstance();
|
||||||
level = new LevelInstance();
|
level = new LevelInstance();
|
||||||
//thumbnailGenerator = new ThumbnailGeneratorInstance();
|
//thumbnailGenerator = new ThumbnailGeneratorInstance();
|
||||||
//soundService = new SoundService();
|
soundService = new SoundService();
|
||||||
lightingInstance = new LightingInstance();
|
lightingInstance = new LightingInstance();
|
||||||
|
|
||||||
selectionService = new SelectionService();
|
selectionService = new SelectionService();
|
||||||
@@ -25,7 +25,7 @@ DataModelInstance::DataModelInstance(void)
|
|||||||
// Parent stuff
|
// Parent stuff
|
||||||
workspace->setParent(this);
|
workspace->setParent(this);
|
||||||
level->setParent(this);
|
level->setParent(this);
|
||||||
//soundService->setParent(this);
|
soundService->setParent(this);
|
||||||
lightingInstance->setParent(this);
|
lightingInstance->setParent(this);
|
||||||
|
|
||||||
running = false;
|
running = false;
|
||||||
@@ -326,11 +326,11 @@ LevelInstance* DataModelInstance::getLevel()
|
|||||||
return thumbnailGenerator;
|
return thumbnailGenerator;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
//TODO implement
|
|
||||||
/*SoundService* DataModelInstance::getSoundService()
|
SoundService* DataModelInstance::getSoundService()
|
||||||
{
|
{
|
||||||
return soundService;
|
return soundService;
|
||||||
}*/
|
}
|
||||||
|
|
||||||
//TODO implement
|
//TODO implement
|
||||||
LightingInstance* DataModelInstance::getLighting()
|
LightingInstance* DataModelInstance::getLighting()
|
||||||
|
|||||||
53
src/source/DataModelV3/SoundInstance.cpp
Normal file
53
src/source/DataModelV3/SoundInstance.cpp
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
#include "DataModelV3/SoundInstance.h"
|
||||||
|
#include "DataModelV3/DataModelInstance.h"
|
||||||
|
|
||||||
|
using namespace B3D;
|
||||||
|
|
||||||
|
SoundInstance::SoundInstance()
|
||||||
|
{
|
||||||
|
name = "Sound";
|
||||||
|
|
||||||
|
soundVolume = 0.5;
|
||||||
|
soundId = "";
|
||||||
|
playOnRemove = false;
|
||||||
|
looped = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
SoundInstance::~SoundInstance(void)
|
||||||
|
{
|
||||||
|
if(isPlayedOnRemove())
|
||||||
|
play();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Functions
|
||||||
|
void SoundInstance::play()
|
||||||
|
{
|
||||||
|
parentDataModel->getSoundService()->playSound(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Getters
|
||||||
|
float SoundInstance::getSoundVolume()
|
||||||
|
{
|
||||||
|
return soundVolume;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SoundInstance::isPlayedOnRemove()
|
||||||
|
{
|
||||||
|
return playOnRemove;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string SoundInstance::getSoundId()
|
||||||
|
{
|
||||||
|
return soundId;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SoundInstance::isLooped()
|
||||||
|
{
|
||||||
|
return looped;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setters
|
||||||
|
void SoundInstance::setSoundId(std::string newSoundId)
|
||||||
|
{
|
||||||
|
soundId = newSoundId;
|
||||||
|
}
|
||||||
113
src/source/DataModelV3/SoundService.cpp
Normal file
113
src/source/DataModelV3/SoundService.cpp
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
#include "DataModelV3/SoundService.h"
|
||||||
|
#include "StringFunctions.h"
|
||||||
|
#include "AudioPlayer.h"
|
||||||
|
|
||||||
|
using namespace B3D;
|
||||||
|
SoundService::SoundService()
|
||||||
|
{
|
||||||
|
Instance::Instance("SoundService");
|
||||||
|
name = "SoundService";
|
||||||
|
musicVolume = 0.3f;
|
||||||
|
canDelete = false;
|
||||||
|
|
||||||
|
// Create stock sounds
|
||||||
|
SoundInstance* stockSound = new SoundInstance();
|
||||||
|
|
||||||
|
// Victory
|
||||||
|
stockSound = new SoundInstance();
|
||||||
|
stockSound->setName("Victory");
|
||||||
|
stockSound->setSoundId("/content/sounds/victory.wav");
|
||||||
|
stockSound->setParent(this);
|
||||||
|
|
||||||
|
// Boing
|
||||||
|
stockSound = new SoundInstance();
|
||||||
|
stockSound->setName("Boing");
|
||||||
|
stockSound->setSoundId("/content/sounds/bass.wav");
|
||||||
|
stockSound->setParent(this);
|
||||||
|
|
||||||
|
// Bomb
|
||||||
|
stockSound = new SoundInstance();
|
||||||
|
stockSound->setName("Bomb");
|
||||||
|
stockSound->setSoundId("/content/sounds/collide.wav");
|
||||||
|
stockSound->setParent(this);
|
||||||
|
|
||||||
|
// Ping
|
||||||
|
stockSound = new SoundInstance();
|
||||||
|
stockSound->setName("Ping");
|
||||||
|
stockSound->setSoundId("/content/sounds/electronicpingshort.wav");
|
||||||
|
stockSound->setParent(this);
|
||||||
|
|
||||||
|
// Break
|
||||||
|
stockSound = new SoundInstance();
|
||||||
|
stockSound->setName("Break");
|
||||||
|
stockSound->setSoundId("/content/sounds/glassbreak.wav");
|
||||||
|
stockSound->setParent(this);
|
||||||
|
|
||||||
|
// Splat
|
||||||
|
stockSound = new SoundInstance();
|
||||||
|
stockSound->setName("Splat");
|
||||||
|
stockSound->setSoundId("/content/sounds/splat.wav");
|
||||||
|
stockSound->setParent(this);
|
||||||
|
|
||||||
|
// Swoosh
|
||||||
|
stockSound = new SoundInstance();
|
||||||
|
stockSound->setName("Swoosh");
|
||||||
|
stockSound->setSoundId("/content/sounds/swoosh.wav");
|
||||||
|
stockSound->setParent(this);
|
||||||
|
|
||||||
|
// Snap
|
||||||
|
stockSound = new SoundInstance();
|
||||||
|
stockSound->setName("Snap");
|
||||||
|
stockSound->setSoundId("/content/sounds/snap.wav");
|
||||||
|
stockSound->setParent(this);
|
||||||
|
|
||||||
|
// Page
|
||||||
|
stockSound = new SoundInstance();
|
||||||
|
stockSound->setName("Page");
|
||||||
|
stockSound->setSoundId("/content/sounds/pageturn.wav");
|
||||||
|
stockSound->setParent(this);
|
||||||
|
|
||||||
|
// Click
|
||||||
|
stockSound = new SoundInstance();
|
||||||
|
stockSound->setName("Click");
|
||||||
|
stockSound->setSoundId("/content/sounds/switch.wav");
|
||||||
|
stockSound->setParent(this);
|
||||||
|
|
||||||
|
// Clock
|
||||||
|
stockSound = new SoundInstance();
|
||||||
|
stockSound->setName("Clock");
|
||||||
|
stockSound->setSoundId("/content/sounds/clickfast.wav");
|
||||||
|
stockSound->setParent(this);
|
||||||
|
|
||||||
|
// Step
|
||||||
|
stockSound = new SoundInstance();
|
||||||
|
stockSound->setName("Step");
|
||||||
|
stockSound->setSoundId("/content/sounds/SWITCH3.wav");
|
||||||
|
stockSound->setParent(this);
|
||||||
|
|
||||||
|
// StepOn
|
||||||
|
stockSound = new SoundInstance();
|
||||||
|
stockSound->setName("StepOn");
|
||||||
|
stockSound->setSoundId("/content/sounds/flashbulb.wav");
|
||||||
|
stockSound->setParent(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
SoundService::~SoundService(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void SoundService::playSound(Instance* sound)
|
||||||
|
{
|
||||||
|
// Try to dynamic_cast it to SoundInstance
|
||||||
|
SoundInstance* sndInst = dynamic_cast<SoundInstance*>(sound);
|
||||||
|
if(sndInst != NULL)
|
||||||
|
{
|
||||||
|
std::string soundId = sndInst->getSoundId();
|
||||||
|
AudioPlayer::playSound(GetFileInPath(soundId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
float SoundService::getMusicVolume()
|
||||||
|
{
|
||||||
|
return musicVolume;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user