Okay sometimes people want Windows

windows
BraydonKains 3 years ago
parent 22bf2ab963
commit a64108a331

@ -22,32 +22,32 @@
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{C6900ECF-254F-4751-A968-DDA699CCD5A6}</ProjectGuid>
<RootNamespace>TrustFall</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
<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>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
@ -144,9 +144,6 @@
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="cursor.cpp" />
<ClCompile Include="game.cpp" />
@ -166,16 +163,19 @@
<ClInclude Include="screen.h" />
<ClInclude Include="start_screen.h" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\packages\AllegroDeps.1.7.0.0\build\native\AllegroDeps.targets" Condition="Exists('..\packages\AllegroDeps.1.7.0.0\build\native\AllegroDeps.targets')" />
<Import Project="..\packages\Allegro.5.2.4.0\build\native\Allegro.targets" Condition="Exists('..\packages\Allegro.5.2.4.0\build\native\Allegro.targets')" />
<Import Project="..\packages\AllegroDeps.1.12.0\build\native\AllegroDeps.targets" Condition="Exists('..\packages\AllegroDeps.1.12.0\build\native\AllegroDeps.targets')" />
<Import Project="..\packages\Allegro.5.2.7\build\native\Allegro.targets" Condition="Exists('..\packages\Allegro.5.2.7\build\native\Allegro.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\AllegroDeps.1.7.0.0\build\native\AllegroDeps.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\AllegroDeps.1.7.0.0\build\native\AllegroDeps.targets'))" />
<Error Condition="!Exists('..\packages\Allegro.5.2.4.0\build\native\Allegro.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Allegro.5.2.4.0\build\native\Allegro.targets'))" />
<Error Condition="!Exists('..\packages\AllegroDeps.1.12.0\build\native\AllegroDeps.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\AllegroDeps.1.12.0\build\native\AllegroDeps.targets'))" />
<Error Condition="!Exists('..\packages\Allegro.5.2.7\build\native\Allegro.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Allegro.5.2.7\build\native\Allegro.targets'))" />
</Target>
</Project>

@ -32,9 +32,6 @@
<UniqueIdentifier>{b26b82a2-f4cd-444a-923f-82aad7c96345}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
<Filter>Source Files</Filter>
@ -84,4 +81,7 @@
<Filter>Header Files\Screens</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
</Project>

@ -33,13 +33,16 @@ void Game::init() {
sprites.insert(pair<string, ALLEGRO_BITMAP*>("MusicOff", al_load_bitmap("music_off.bmp")));
al_reserve_samples(4);
samples.insert(pair<string, ALLEGRO_SAMPLE*>("Theme", al_load_sample("rasputin.wav")));
samples.insert(pair<string, ALLEGRO_SAMPLE*>("Move", al_load_sample("move.wav")));
samples.insert(pair<string, ALLEGRO_SAMPLE*>("Catch", al_load_sample("catch.wav")));
samples.insert(pair<string, ALLEGRO_SAMPLE*>("Fall", al_load_sample("fall.wav")));
samples.insert(pair<string, ALLEGRO_SAMPLE*>("Place", al_load_sample("place.wav")));
samples.insert(pair<string, ALLEGRO_SAMPLE*>("LevelUp", al_load_sample("level.wav")));
themes.insert(pair<string, ALLEGRO_SAMPLE*>("Rasputin", al_load_sample("rasputin.wav")));
themes.insert(pair<string, ALLEGRO_SAMPLE*>("Guile", al_load_sample("guile.wav")));
themes.insert(pair<string, ALLEGRO_SAMPLE*>("Mine", al_load_sample("customtheme.wav")));
font = al_create_builtin_font();
}
@ -50,7 +53,7 @@ void Game::reset() {
//Run the game state machine
void Game::run() {
//Load screens
GameScreen game_screen(sprites, samples);
GameScreen game_screen(sprites, samples, themes);
StartScreen start_screen(sprites);
ResultScreen result_screen(sprites, 0, 0, Easy);
int difficulty = 1; //Difficulty to run
@ -112,4 +115,8 @@ void Game::run() {
for (it2 = samples.begin(); it2 != samples.end(); it2++) {
al_destroy_sample(it2->second);
}
map<string, ALLEGRO_SAMPLE*>::iterator it3;
for (it3 = themes.begin(); it3 != themes.end(); it3++) {
al_destroy_sample(it3->second);
}
}

@ -25,6 +25,7 @@ public:
std::map<std::string, ALLEGRO_BITMAP*> sprites;
std::map<std::string, ALLEGRO_SAMPLE*> samples;
std::map<std::string, ALLEGRO_SAMPLE*> themes;
Game();

@ -18,9 +18,10 @@ using std::ostringstream;
using std::map;
using std::pair;
GameScreen::GameScreen(std::map<std::string, ALLEGRO_BITMAP*> _sprites, std::map<std::string, ALLEGRO_SAMPLE*> _samples) {
GameScreen::GameScreen(std::map<std::string, ALLEGRO_BITMAP*> _sprites, std::map<std::string, ALLEGRO_SAMPLE*> _samples, std::map<std::string, ALLEGRO_SAMPLE*> _themes) {
sprites = _sprites;
samples = _samples;
themes = _themes;
srand(time(NULL)); //Seed random number generator with current time so sequence is unique each run
}
@ -75,14 +76,21 @@ void GameScreen::run(ALLEGRO_FONT* font) {
//Create map of sample instances. This is more memory efficient than play samples over and over again individually,
//and allows the anti-overlap functionality implemented above.
map<string, ALLEGRO_SAMPLE_INSTANCE*> instances;
map<string, ALLEGRO_SAMPLE_INSTANCE*> theme_instances;
map<string, ALLEGRO_SAMPLE*>::iterator it;
for (it = samples.begin(); it != samples.end(); it++) {
instances.insert(pair<string, ALLEGRO_SAMPLE_INSTANCE*>(it->first, al_create_sample_instance(it->second)));
al_attach_sample_instance_to_mixer(instances[it->first], al_get_default_mixer());
}
for (it = themes.begin(); it != themes.end(); it++) {
theme_instances.insert(pair<string, ALLEGRO_SAMPLE_INSTANCE*>(it->first, al_create_sample_instance(it->second)));
al_attach_sample_instance_to_mixer(theme_instances[it->first], al_get_default_mixer());
}
al_set_sample_instance_playmode(instances["Theme"], ALLEGRO_PLAYMODE_LOOP);
play(instances["Theme"]);
map<string, ALLEGRO_SAMPLE_INSTANCE*>::iterator theme_it = theme_instances.begin();
std::advance(theme_it, rand() % (theme_instances.size()));
al_set_sample_instance_playmode(theme_it->second, ALLEGRO_PLAYMODE_LOOP);
play(theme_it->second);
int ticks = 0; //Counts the number of ticks, this is used to determine when to move the lines
bool exit_screen = false;
@ -106,6 +114,7 @@ void GameScreen::run(ALLEGRO_FONT* font) {
for (in_it = instances.begin(); in_it != instances.end(); in_it++) {
al_stop_sample_instance(in_it->second);
}
al_stop_sample_instance(theme_it->second);
al_play_sample_instance(instances["Fall"]);
exit_screen = true;
al_clear_to_color(al_map_rgb(0, 0, 0));
@ -157,10 +166,10 @@ void GameScreen::run(ALLEGRO_FONT* font) {
//Toggle music
if (ctrl) {
if (music) {
al_stop_sample_instance(instances["Theme"]);
al_stop_sample_instance(theme_it->second);
}
else {
al_play_sample_instance(instances["Theme"]);
al_play_sample_instance(theme_it->second);
}
music = !music;
}

@ -7,6 +7,7 @@ class GameScreen : public Screen {
public:
std::map<std::string, ALLEGRO_BITMAP*> sprites;
std::map<std::string, ALLEGRO_SAMPLE*> samples;
std::map<std::string, ALLEGRO_SAMPLE*> themes;
std::vector<Line> lines;
unsigned int selected;
int max_catchers;
@ -15,7 +16,7 @@ public:
int difficulty;
bool music;
GameScreen(std::map<std::string, ALLEGRO_BITMAP*> _sprites, std::map<std::string, ALLEGRO_SAMPLE*> _samples);
GameScreen(std::map<std::string, ALLEGRO_BITMAP*> _sprites, std::map<std::string, ALLEGRO_SAMPLE*> _samples, std::map<std::string, ALLEGRO_SAMPLE*> _themes);
void reset(int _lines, int _max_catchers, int _difficulty);
void run(ALLEGRO_FONT* font);

Binary file not shown.

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Allegro" version="5.2.4.0" targetFramework="native" />
<package id="AllegroDeps" version="1.7.0.0" targetFramework="native" />
<package id="Allegro" version="5.2.7" targetFramework="native" />
<package id="AllegroDeps" version="1.12.0" targetFramework="native" />
</packages>
Loading…
Cancel
Save