how's this for a first comment attempt?
#include "SFML/Quickstart.h"
#include "SFML/String Conversion.h"
int CheckCategories[6];
int CheckMoney[30];
std::string Path;
sf::Sprite Other[6];
sf::Sprite Categories[6];
sf::Sprite Money[30];
sf::Sprite Question;
sf::Sprite Answer;
sf::Image other[6];
sf::Image categories[6];
sf::Image money[5];
sf::Image question;
sf::Image answer;
sf::Music Music[4];
//Function returning the current screen resolution's width
int GetDesktopWidth()
{
sf::VideoMode DesktopMode = sf::VideoMode::GetDesktopMode();
return DesktopMode.Width;
}
//Function returning the current screen resolution's height
int GetDesktopHeight()
{
sf::VideoMode DesktopMode = sf::VideoMode::GetDesktopMode();
return DesktopMode.Height;
}
std::string GetExeD()
{
GetModuleFileName(NULL, L"Path", 100);
return Path;
}
//Load images from subfolders of /Jeopardy
int LoadImages()
{
std::string base = "C:/Jeopardy/";
std::string end = ".bmp";
std::string middle;
std::string image;
for(int i = 0; i < 6; i++)
{
middle = Convert((i + 1));
image = base + "Other/Slide" + middle + end;
if (!other[i].LoadFromFile(image))
return -1;
image = base + "Categories/Slide" + middle + end;
if (!categories[i].LoadFromFile(image))
return -1;
};
for(int i = 0; i < 5; i++)
{
middle = Convert((i + 1));
image = base + "Money/Slide" + middle + end;
if (!money[i].LoadFromFile(image))
return -1;
};
return 1;
}
//Assign all loaded images to sprites
void LoadSprites()
{
for (int i = 0; i < 6; i++)
{
Other[i].SetImage(other[i]);
Categories[i].SetImage(categories[i]);
};
for (int i = 0; i < 5; i++)
{
Money[i].SetImage(money[i]);
Money[(i + 5)].SetImage(money[i]);
Money[(i + 10)].SetImage(money[i]);
Money[(i + 15)].SetImage(money[i]);
Money[(i + 20)].SetImage(money[i]);
Money[(i + 25)].SetImage(money[i]);
};
}
//Scale sprites to have each fit 1/6 of the screen resolution
void ScaleSprites()
{
int ScreenWidth = GetDesktopWidth();
int ScreenHeight = GetDesktopHeight();
float ImageWidth;
float ImageHeight;
for (int i = 0; i < 6; i++)
{
ImageWidth = other[i].GetWidth();
ImageHeight = other[i].GetHeight();
ImageWidth = (ScreenWidth / ImageWidth);
ImageHeight = (ScreenHeight / ImageHeight);
Other[i].Scale(ImageWidth, ImageHeight);
ImageWidth = categories[i].GetWidth();
ImageHeight = categories[i].GetHeight();
ImageWidth = ((ScreenWidth/6) / ImageWidth);
ImageHeight = ((ScreenHeight/6) / ImageHeight);
Categories[i].Scale(ImageWidth, ImageHeight);
};
for (int i = 0; i < 30; i++)
{
ImageWidth = money[0].GetWidth();
ImageHeight = money[0].GetHeight();
ImageWidth = ((ScreenWidth/6) / ImageWidth);
ImageHeight = ((ScreenHeight/6) / ImageHeight);
Money[i].Scale(ImageWidth, ImageHeight);
};
}
//Position sprites evenly across the screen in a 6 x 6 grid
void PositionSprites()
{
int ScreenWidth = GetDesktopWidth();
int ScreenHeight = GetDesktopHeight();
float xpos = (ScreenWidth/6);
float ypos = (ScreenHeight/6);
float x = 0;
float y = ypos;
for(int i = 0; i < 6; i++)
{
Categories[i].SetPosition(x, 0.0f);
x = x + xpos;
};
for(int i = 0; i < 5; i++)
{
Money[i].SetPosition(0, y);
Money[(i + 5)].SetPosition(xpos, y);
Money[(i + 10)].SetPosition((xpos * 2), y);
Money[(i + 15)].SetPosition((xpos * 3), y);
Money[(i + 20)].SetPosition((xpos * 4), y);
Money[(i + 25)].SetPosition((xpos * 5), y);
y = y + ypos;
};
}
//Load music
int LoadMusic()
{
if (!Music[0].OpenFromFile("C:/Jeopardy/Music/Opening.wav"))
return -1;
if (!Music[1].OpenFromFile("C:/Jeopardy/Music/Question.wav"))
return -1;
if (!Music[2].OpenFromFile("C:/Jeopardy/Music/Daily Double.wav"))
return -1;
if (!Music[3].OpenFromFile("C:/Jeopardy/Music/Final Jeopardy.wav"))
return -1;
return 1;
}
//Check to see if sprite has been clicked or not
void InitChecks()
{
for(int i = 0; i < 6; i++)
CheckCategories[i] = 1;
for(int i = 0; i < 30; i++)
CheckMoney[i] = 1;
}
//Execute all the functions above and play the Opening Music
int Load()
{
GetExeD();
LoadImages();
LoadSprites();
ScaleSprites();
PositionSprites();
LoadMusic();
InitChecks();
Music[0].Play();
return 1;
}