此代码有一个整洁的错误。
错误指出:Narrowing conversion from 'double' to 'float'
在xPos()内部显示x_pos;功能在底部。
有人可以解释这是为什么以及如何纠正吗?
//grab the current position
double x_pos = clownfish->xPos();
// move the fish 500pixels/sec in the right direction
// delta time is measured in milliseconds,so divide by 1000 and multiply
x_pos += 500 * (game_time.delta.count() / 1000.f);
// update the position of the clown fish
clownfish->xPos(x_pos);