Hi this works fine:
#include <SFML/Graphics.h>
sfVector2f sfVector2f_set(float x, float y){
sfVector2f vector2f;
vector2f.x = x;
vector2f.y = y;
return vector2f;
}
int main(){
sfVector2f vector;
vector.x = sfVector2f_set(1, 1).x;
}
But this throws error: request for member top in something not a structure or union
#include <SFML/Graphics.h>
sfFloatRect sfFloatRect_set(float top, float left, float width, float height){
sfFloatRect floatRect;
floatRect.top = top;
floatRect.left = left;
floatRect.width = width;
floatRect.height = height;
return floatRect;
}
int main(){
sfFloatRect floatRect;
// throws error: request for member top in something not a structure or union
floatRect.top = sfFloatRect_set(1,1,1,1).top;
}
I think it could be a basic c problem but i'm very thankful for a reason.