0
두 개의 볼륨 아이콘을 창에 그려야하는이 코드가 있지만 작동하지 않습니다. 여기에 관련 코드는 다음과 같습니다XNA는 내가 말한 것을 그려 내지 않습니다
Texture2D vol_max;
Vector2 vol_max_vect;
Texture2D vol_min;
Vector2 vol_min_vect;
...
protected override void LoadContent()
{
// Create a new SpriteBatch, which can be used to draw textures.
spriteBatch = new SpriteBatch(GraphicsDevice);
vol_max = Content.Load<Texture2D>("[email protected]");
vol_min = Content.Load<Texture2D>("[email protected]");
}
protected override void Update(GameTime gameTime)
{
thisKeyboard = Keyboard.GetState(PlayerIndex.One);
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed ||
thisKeyboard.IsKeyDown(Keys.Escape))
{
this.Exit();
}
// Update window vectors
vol_max_vect = new Vector2(
(float)(Window.ClientBounds.Right - 20),
(float)(Window.ClientBounds.Bottom - 20));
vol_min_vect = new Vector2(
(float)(Window.ClientBounds.Right - 140),
(float)(Window.ClientBounds.Bottom - 20));
prevKeyboard = thisKeyboard;
base.Update(gameTime);
}
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
spriteBatch.Begin();
spriteBatch.Draw(
vol_max,
vol_max_vect,
Color.White);
spriteBatch.Draw(
vol_min,
vol_min_vect,
Color.White);
spriteBatch.End();
base.Draw(gameTime);
}
예! 감사! –