Okay Ive manage to somehow get it working
by somehow I mean that the values are completely off
for example if the scroll factor is set to 1 the layer remains static (always on screen)
0 follows camera , -1 double speed, -2 triple speed etc..
is it because Im using tiles for rendering my background layers??
offset_x = current_layer.Position.X + (Camera.Location.X - Dimensions.Center.X) * current_layer.Depth;
offset_y = current_layer.Position.Y;
if (current_layer.Tileable)
{
for (float idx = offset_x; idx <= Dimensions.Width + Math.Abs(offset_x); idx += current_layer.Texture.Width)
{
if (idx >= start_pos_x && idx <= end_pos_x) // could be further optimized by checking the y-coordinate
{
SBatch.Draw(current_layer.Texture, new Vector2(idx, offset_y), Color.White);
draw_calls++;
}
}
}