Add project files.

master
sigonasr2 2 years ago
parent c9fd829788
commit 242aeef167
  1. 31
      Example.sln
  2. 140
      Example/Example.vcxproj
  3. 30
      Example/Example.vcxproj.filters
  4. BIN
      Example/Hero.wav
  5. BIN
      Example/Sigg.wav
  6. BIN
      Example/WeatherChannel.wav
  7. 137
      Example/main.cpp
  8. 6895
      Example/olcPixelGameEngine.h
  9. 1968
      Example/olcSoundWaveEngine.h
  10. BIN
      Example/res/tiles.png

@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.33516.290
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Example", "Example\Example.vcxproj", "{C421608B-8317-4954-89AB-212E3826C3BC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C421608B-8317-4954-89AB-212E3826C3BC}.Debug|x64.ActiveCfg = Debug|x64
{C421608B-8317-4954-89AB-212E3826C3BC}.Debug|x64.Build.0 = Debug|x64
{C421608B-8317-4954-89AB-212E3826C3BC}.Debug|x86.ActiveCfg = Debug|Win32
{C421608B-8317-4954-89AB-212E3826C3BC}.Debug|x86.Build.0 = Debug|Win32
{C421608B-8317-4954-89AB-212E3826C3BC}.Release|x64.ActiveCfg = Release|x64
{C421608B-8317-4954-89AB-212E3826C3BC}.Release|x64.Build.0 = Release|x64
{C421608B-8317-4954-89AB-212E3826C3BC}.Release|x86.ActiveCfg = Release|Win32
{C421608B-8317-4954-89AB-212E3826C3BC}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3981479D-8997-4CB6-BE01-14211B2B833D}
EndGlobalSection
EndGlobal

@ -0,0 +1,140 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{c421608b-8317-4954-89ab-212e3826c3bc}</ProjectGuid>
<RootNamespace>Example</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="olcPixelGameEngine.h" />
<ClInclude Include="olcSoundWaveEngine.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="olcPixelGameEngine.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="olcSoundWaveEngine.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -0,0 +1,137 @@
#define OLC_PGE_APPLICATION
#include "olcPixelGameEngine.h"
#define OLC_SOUNDWAVE
#include "olcSoundWaveEngine.h"
using namespace olc;
enum SoundID {
SONG,
HERO,
SIGG
};
class Example : public olc::PixelGameEngine
{
public:
Example()
{
sAppName = "Custom GameSound System based on olcSoundWaveEngine";
}
sound::WaveEngine swe;
sound::Wave song,hero,sigg;
struct GameSound {
sound::PlayingWave sound;
SoundID id;
double duration;
float playTime;
bool paused = false;
};
std::vector<GameSound>playingSounds;
void PlayWaveform(SoundID id, sound::Wave* pWave, bool bLoop=false, double dSpeed=1.0) {
sound::PlayingWave playing_sound = swe.PlayWaveform(pWave, bLoop, dSpeed);
playingSounds.push_back({ playing_sound,id,playing_sound->dDuration });
}
void PauseSound(GameSound& sound) {
sound.paused = true;
sound::WaveInstance& wi = *sound.sound;
wi.bPaused = true;
}
void UnpauseSound(GameSound& sound) {
sound.paused = false;
sound::WaveInstance& wi = *sound.sound;
wi.bPaused = false;
}
void StopSound(SoundID id) {
for (std::vector<GameSound>::iterator it = playingSounds.begin(); it != playingSounds.end();) {
GameSound& sound = *it;
if (sound.id == id) {
swe.StopWaveform(sound.sound);
it=playingSounds.erase(it);
if (it == playingSounds.end()) {
break;
}
else {
continue;
}
}
++it;
}
}
public:
bool OnUserCreate() override
{
// Called once at the start, so create things here
//engine = &swe;
swe.InitialiseAudio();
song = sound::Wave("WeatherChannel.wav");
hero = sound::Wave("Hero.wav");
sigg = sound::Wave("Sigg.wav");
return true;
}
bool OnUserUpdate(float fElapsedTime) override
{
if (GetKey(A).bPressed) {
StopSound(SONG);
PlayWaveform(SONG,&song,true);
}
if (GetKey(S).bPressed) {
PlayWaveform(HERO, &hero, false);
}
if (GetKey(D).bPressed) {
PlayWaveform(SIGG, &sigg, false);
}
if (GetKey(SPACE).bPressed) {
StopSound(HERO);
StopSound(SIGG);
}
if (GetKey(P).bPressed) {
for (std::vector<GameSound>::iterator it = playingSounds.begin(); it != playingSounds.end(); ++it) {
GameSound& sound = *it;
PauseSound(sound);
}
}
if (GetKey(U).bPressed) {
for (std::vector<GameSound>::iterator it = playingSounds.begin(); it != playingSounds.end(); ++it) {
GameSound& sound = *it;
UnpauseSound(sound);
}
}
for (std::vector<GameSound>::iterator it = playingSounds.begin(); it != playingSounds.end(); ++it) {
GameSound& sound = *it;
if (!sound.paused) {
sound.playTime += fElapsedTime;
if (sound.playTime > sound.duration) {
it = playingSounds.erase(it);
if (it == playingSounds.end()) {
break;
}
}
}
}
// called once per frame
return true;
}
};
int main()
{
Example demo;
if (demo.Construct(256, 240, 4, 4))
demo.Start();
return 0;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Loading…
Cancel
Save