Actually, I discovered something else. The programs will compile fine without linking the sfml-audio framework.... however, once I link that framework is when the RenderTarget::Clear function thing pops up and causes the white screen of infinite loop death. Any thoughts on why this might be the case?
EDIT: I also just linked the sndfile framework to it as well, but to no avail. Still does the same thing.... displays EXC_BAD_ACCESS with RenderTarget::Clear() showing as the thread it's stopped at. lolll Does this mean I can't link to the audio framework anymore? XD
EDIT 2: I have a feeling it's all related to the fact that my RenderWindow is global, perhaps, and it's causing some sort of problems. Or at least I'm trying something new. But I tried altering my functions so that they will take an Input argument. However, I'm not exactly sure how I can go about doing this. How do I pass this:
const sf::Input& Input
to a function properly? This is what I made and I'll write the errors as well:
// Function prototype
void getInput(int&, int&, int&, int&, sf::Clock&, sf::Clock&, sf::RenderWindow&, const sf::Input);
*
*
*
// Function call
// Process input
getInput(Player1.y, Player1.boty, Player2.y, Player2.boty, Player1.PaddleTimer, Player2.PaddleTimer, App, Input);
*
*
*
// Beginning of the actual function implementation
// Process inputs and move players accordingly
void getInput(int &y1, int &boty1, int &y2, int &boty2, sf::Clock &Pad1, sf::Clock &Pad2, sf::RenderWindow App, const sf::Input& Input)
{
App.GetInput();
if ((Input.IsKeyDown(sf::Key::Up)) && (Pad1.GetElapsedTime() >= 0.01))
{
if (y1 > 0)
{
y1--;
boty1--;
}
Pad1.Reset();
}
Errors:
warning: synthesized method 'sf::Input::Input(const sf::Input&)' first required here
warning: initializing argument 8 of 'void getInput(int&, int&, int&, int&, sf::Clock&, sf::Clock&, sf::RenderWindow&, sf::Input)'
Those were both on the line where the function gets called.
I'm familiar with functions and passing by value and by reference but I don't know how to do it with the Input construct, as it seems a little different. Guidance would be much appreciated, and perhaps my theory could then solve the problem :] Thanks a lot!