2012-02-26 3 views
1

SomeClass.cs 지우기 화면

public void clearscreen() 
{ 
    main.GraphicsDevice.Clear(Color.Black); 
} 

이유는 다른 클래스에서이 메소드에 호출하여 화면을 지울 수 없습니다?

protected override void Draw(GameTime gameTime) 
{ 
    GraphicsDevice.Clear(Color.Black); 
    spriteBatch.Begin(); 
    mainMenu.MenuDraw(); 
    spriteBatch.Draw(cursorTexture, cursorPosition, Color.White); 
    spriteBatch.End(); 
    base.Draw(gameTime); 
} 

clearscreen 메서드가 mainMenu.Draw() 내에서 호출되고 있습니다. 당신의 그리기 방법

+0

시도하면 어떻게됩니까? –

+0

해당 메서드를 호출하기 전에 화면에 이미지를 그렸습니다. 메소드 호출 후 이미지는 화면에 그대로 남아 있습니다. – KeyHeart

+0

Draw (GameTime gametime) 메서드에서이 메서드를 호출 하시겠습니까? Draw 메서드 코드를 표시 할 수 있습니까? ?? –

답변

1

당신은 당신의 GraphicsDeviceManager을 통과해야 클래스에 (대부분 '그래픽'라는 이름)하고 그렇게 부른다.

graphics.GraphicsDevice.Clear(Color.Black); 
2

사용이 :

protected override void Draw(GameTime cGameTime) 
{ 
     GraphicsDevice.SetRenderTarget(null); 
     GraphicsDevice.Clear(Color.Black); 
     .... 
     .... 
     ....