스크롤하는 배경을 만드는 데 문제가 있습니다. 저는 2 년 전 C++을 C++로 번역하려고 시도하고 있습니다. 'newb'(그대로)로 문제가 있습니다.스크롤 배경 만들기 (위에서 아래로 스크롤)
다음은 현재 사용하고있는 변수 및 개체입니다.
//ScrollingBackground Inits from the Contructor/Main Method
_screenHeight = Graphics::GetViewportHeight();
_screenWidth = Graphics::GetViewportWidth();
//ScrollingBackground Content from the Load Content Method
_backgroundPosition = new Vector2(_screenWidth/2, _screenHeight/2);
_origin = new Vector2(_backgroundTexture->GetHeight()/2, 0);
_textureSize = new Vector2(0, _backgroundTexture->GetHeight());
_backgroundTexture->Load("background.dds", false);
이것은 스크롤이 발생하는 곳을 만드는 방법입니다. 이것에
여전히void Player::Scrolling(float deltaX)
{
//This is where the scrolling happens
_backgroundPosition->X += deltaX;
_backgroundPosition->X = _backgroundPosition->X % _textureSize->Y;
}
비교적 새로운 그래서 나는 막연 해요 경우에 저를 용서 나 나는 내가 무슨 말 단서가없는 같은 소리하시기 바랍니다.
많은 감사,
Ryan.
내가, LOL 잘못되어 가고 내 사과 ... 무슨 설명하지 않는 습관을 유지 _backgroundPosition-> X = _backgroundPosition-> X % _textureSize-> Y; '% : 불법, 왼쪽 피연산자 유형이'float '이고 오른쪽 피연산자와 동일합니다. –