如何在窗口中获得固定位置
本文关键字:定位 位置 窗口 | 更新日期: 2023-09-27 18:35:13
如何在窗口中获取固定位置?我使用2D相机,如果移动,分数就会留在我身后。我试过这个,但它不起作用:
spriteBatch.DrawString(font, "Score: "+ score,//here i have to put the parameters of the position , Color.Gold);
使用 2D 相机时,您需要为固定图形使用其他SpriteBatch
,否则您绘制的所有内容都会在屏幕上滑动。
spriteBatch.Begin();
spriteBatch.DrawString(font, "Score: "+ score, new Vector2(x, y), color);
spriteBatch.End();