跨平台游戏开发与Silverlight项目迁移指南
1. 跨平台开发基础
在跨平台游戏开发中,针对不同平台的特性进行适配是关键。例如,在检查相机模式是否更新时,需要根据不同平台的输入方式进行判断。以下是相关代码:
bool toggleCamera = false;
#if WINDOWS_PHONE
// Has the user touched the screen?
TouchCollection tc = TouchPanel.GetState();
if (tc.Count == 1 && tc[0].State == TouchLocationState.Pressed) toggleCamera = true;
#else
// Was the mouse up last time, but is down now?
MouseState thisMouseState = Mouse.GetState();
if (lastMouseState.LeftButton == ButtonState.Released &&
thisMouseState.LeftButton == ButtonState.Pressed)
{
// Yes, so change camera
toggleCamera = true;
}
// Store the new mouse state for next time
la
超级会员免费看
订阅专栏 解锁全文
899

被折叠的 条评论
为什么被折叠?



