in other words i guess i should just learn pure c++ before trying to use sfml?
Not necessarily. It depends on what you mean by getting a headache from not knowing what they are doing in their code.
Are you referring to parts of code like pointers, references, functions:
int *ptrNum = nullptr; // a null pointer
double someNumber = 24.3;
double numberChanger(double &num)
{
++num;
return num;
}
// or the more complex things like
template <typename Type>
Type max(Type tX, Type tY)
{
return (tX > tY) ? tX : tY;
}
double testNumber = max(24.2, 45.6);
Or do you mean the logic of what they are trying to do in the code (pulled from Allegro Wiki):
// collision detection code
int bounding_box_collision(int b1_x, int b1_y, int b1_w, int b1_h, int b2_x, int b2_y, int b2_w, int b2_h)
{
if ((b1_x > b2_x + b2_w - 1) || // is b1 on the right side of b2?
(b1_y > b2_y + b2_h - 1) || // is b1 under b2?
(b2_x > b1_x + b1_w - 1) || // is b2 on the right side of b1?
(b2_y > b1_y + b1_h - 1)) // is b2 under b1?
{
// no collision
return 0;
}
// collision
return 1;
}
Or the calls for using a library (pulled from SFML sprite tutorial):
// position
sprite.setPosition(sf::Vector2f(10, 50)); // absolute position
sprite.move(sf::Vector2f(5, 10)); // offset relative to the current position
// rotation
sprite.setRotation(90); // absolute angle
sprite.rotate(15); // offset relative to the current angle
// scale
sprite.setScale(sf::Vector2f(0.5f, 2.f)); // absolute scale factor
sprite.scale(sf::Vector2f(1.5f, 3.f)); // factor relative to the current scale