Code: Select all
// DEFINES
#define IMAGE_BACKGROUND "\\content\\images\\background.bmp"
#define FONT_MAIN "\\content\\fonts\\sai.ttf"
Code: Select all
int main(int argc, char* args[])
{
Moderator: Coders of Rage
Code: Select all
// DEFINES
#define IMAGE_BACKGROUND "\\content\\images\\background.bmp"
#define FONT_MAIN "\\content\\fonts\\sai.ttf"
Code: Select all
int main(int argc, char* args[])
{
Code: Select all
string s = args[0];
Code: Select all
// DEFINES
#define IMAGE_BACKGROUND "\\content\\images\\background.bmp"
#define FONT_MAIN "\\content\\fonts\\sai.ttf"
#define EXECUTABLE_NAME_STRING_LENGTH 13 // how many characters are in the executable name
/* GLOBAL VARIABLES */
string globalString;
Code: Select all
bool load_Files(char* args[])
{
//Load the images
background = load_image( getStringFileName(args, IMAGE_BACKGROUND));
//Open the font
font = TTF_OpenFont( getFontFileName(args, FONT_MAIN), FONT_SIZE );
// Check for error loading font.
if( font == NULL )
{
return false;
}
return true;
}
Code: Select all
string getStringFileName(char* args[], string s)
{
globalString = args[0];
globalString.erase(globalString.length()-(EXECUTABLE_NAME_STRING_LENGTH+6)); //the +1 is for the / in the directory we add in, 6 for the debug folder.
globalString.append("Schmetris");
globalString.append(s);
return globalString;
}
const char * getFontFileName(char * args[], string s)
{
globalString = args[0];
globalString.erase(globalString.length()-(EXECUTABLE_NAME_STRING_LENGTH+6)); //the +1 is for the / in the directory we add in, 6 for the debug folder.
globalString.append("Schmetris");
globalString.append(s);
return (const char *) globalString.c_str();
}
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
Code: Select all
// DEFINES
#define IMAGE_BACKGROUND ".\\content\\images\\background.png"
#define IMAGE_BLUEBLOCK ".\\content\\images\\blueblock.png"
#define FONT_MAIN ".\\content\\fonts\\sai.ttf"