= Color(0, 0, 0, 255) is the default argument. You may call clear(...) with or without the parameter. If it is called without the default argument is used.
From a graphics standpoint:
most but not all graphics code will work with RGBA format when you see 4 variables.
That is, Red/Green/Blue/ alpha (transparency or other effects control).
This looks like a clear to solid black.
Up to now you have probably seen function declarations like: void foo( type name );
Typical use is probably a variation of:
1 2
type bar;
foo( bar );
This time there are the extra bits: void foo( type name = value );
You can still do:
1 2
type bar;
foo( bar );
but you can do also: foo();
and the compiler, after failing to find a foo() that takes no arguments, settles on
replacing your foo(); with a foo( value );
In this case the value is Color(0,0,0,255).
Type Color must have a constructor must have constructor that accepts 4 integers.
You might have used it: Color bar( 0, 0, 0, 255 );
or Color* fubar = new Color( 0, 0, 0, 255 );
You could write:
1 2
Color bar( 0, 0, 0, 255 );
clear( bar );
The bar is a named variable. It exists to the end of the scope and it can be used multiple times.
Now this: clear( Color( 0, 0, 0, 255 ) );
An unnamed Color object is created and passed to the clear(). The lifetime of the object is limited to the duration of the function call and it cannot be used elsewhere.
It's a default argument that will be used if you don't pass in anything to the function. That clear function is most likely somewhere in your render and is being called every frame. The purpose of such function is to clear the previous frame and draw the current (updated) one. As you can see, the function takes in a Color value (I assume it's a vec4 struct RGBA), so if you want your screen to be cleared using a certain color, say blue for example, then you would do something like this:
sf::RenderTarget::clear(Color(0, 255, 0, 255));
If you don't supply the clear function with anything, then the default argument will be used.