Skip to content

Commit

Permalink
fixed aspect ratio, fixed exit pre-intro
Browse files Browse the repository at this point in the history
  • Loading branch information
picardrulez committed Aug 5, 2014
1 parent 7076041 commit 709a108
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 20 deletions.
29 changes: 16 additions & 13 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,23 @@ int main(int argc, char* args[])
gameRunning = false;
}
}
g_menu->menuMusic(false);
int gameStatus = g_game->intro();
cout << "gameStatus is " << gameStatus << endl;
if (gameStatus == 0)
if (menuStatus != 0)
{
gameRunning = false;
return 0;
}
cout << "starting level" << endl;
gameStatus = g_game->level();
if (gameStatus == 0)
{
gameRunning = false;
return 0;
g_menu->menuMusic(false);
int gameStatus = g_game->intro();
cout << "gameStatus is " << gameStatus << endl;
if (gameStatus == 0)
{
gameRunning = false;
return 0;
}
cout << "starting level" << endl;
gameStatus = g_game->level();
if (gameStatus == 0)
{
gameRunning = false;
return 0;
}
}
}
delete g_menu;
Expand Down
15 changes: 9 additions & 6 deletions menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ mainMenu::mainMenu()
mMusic = Mix_LoadMUS("audio/mainMenu1.mp3");
gSelect = Mix_LoadWAV("audio/select.wav");
Mix_Volume(2, currentSVolume);
StarT.x = 110;
StarT.y = 335;
StarT.w = 114;
StarT.x = (SCREEN_WIDTH / 4 - StarT.w) + SCREEN_WIDTH / 8;
StarT.h = 49;
OptionS.x = 350;
OptionS.y = 335;
OptionS.w = 165;
OptionS.h = 57;
OptionS.x = (SCREEN_WIDTH / 4 + SCREEN_WIDTH / 2 - OptionS.w / 2) - SCREEN_WIDTH / 8;

}

Expand Down Expand Up @@ -205,16 +205,19 @@ int mainMenu::loadOptions()
SDL_QueryTexture(settingBar, NULL, NULL, &iW, &iH);
SbaR.w = iW;
SbaR.h = iH;
int mStop = currentMVolume * 4.2;
for (int i = 100; i < mStop; i += 10)
cout << "current volume is " << currentMVolume << endl;
cout << "current volume / 128 is " << (float)currentMVolume / 128 << endl;
cout << "current volume percentage is " << (((float)currentMVolume / 128) * 100) << endl;
int mStop = (SCREEN_WIDTH / 3) + ((SCREEN_WIDTH / 3) * ((float)currentMVolume / 128));
for (int i = SCREEN_WIDTH / 3; i < mStop; i += 10)
{
SbaR.x = i;
SbaR.y = 200;
SDL_RenderCopy(renderer, settingBar, NULL, &SbaR);
}
int sStop = currentSVolume * 4.2;
int sStop = (SCREEN_WIDTH / 3) + ((SCREEN_WIDTH / 3) * ((float)currentSVolume / 128));
SDL_RenderCopy(renderer, Svolume, NULL, &SvolumE);
for (int i = 100; i < sStop; i += 10)
for (int i = SCREEN_WIDTH / 3; i < sStop; i += 10)
{
SbaR.x = i;
SbaR.y = 330;
Expand Down
2 changes: 1 addition & 1 deletion sdlGraphics.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "sdlGraphics.h"
const int SCREEN_WIDTH = 640;
const int SCREEN_WIDTH = 854;
const int SCREEN_HEIGHT = 480;
const char* WINDOW_TITLE = "Baldr";
int currentMVolume = 70;
Expand Down

0 comments on commit 709a108

Please sign in to comment.