1
我嘗試發送一些對象到一個函數,但似乎C#不喜歡那樣。這是代碼。發送Texture2d對象到函數
string[] bkgrSource = new string[12];
Texture2D[] bkgrBANK = new Texture2D[12];
其中bkgrSource[0]
是文件名的陣列,並且bkgrBANK[0]
是Texture2D
陣列。
此功能不起作用。 bkgrBANK[0]
將保持爲空。任何幫助?
commonImageLoader(bkgrSource[0], bkgrBANK[0]);
private void commonImageLoader(string source, Texture2D destination) {
if (!string.IsNullOrEmpty(source)) {
fileName = source;
using (fileStream = new FileStream(@fileName, FileMode.Open)) {
destination = Texture2D.FromStream(GraphicsDevice, fileStream);
}
}
}
... tnx! ...現在起作用了。 :),, – 2012-08-05 18:03:35