PlayerIndex pix = PlayerIndex.Two;
string ps = pix.ToString(); // "Two"
int pi = (int)pix; // 1
pix = (PlayerIndex) Enum.Parse(typeof (PlayerIndex), "Three");
ps = pix.ToString(); // "Three"
pi = (int) pix; // 2
pi = 0;
pix = (PlayerIndex) pi;// "One"
Microsoft technologies related information. Windows Store Development, CSharp, C#, SQLServer, Visual Studio, MonoGame, BI.....
Saturday, March 29, 2008
Converting XNA PlayerIndex to string and int
It might be obvious, but I needed it today for the networking stuff to pass player data around. I wanted to convert the current Playerindex to a string or int and vice versa.:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment