作者antirazin (今年是日星来台年~真嗨)
看板C_Sharp
标题Re: [问题] XNA Platform Starter kits 小改写後 ꬠ…
时间Tue Mar 17 21:13:11 2009
仅PO出修改部分,其他请参照Platform:
------------------------------------------------------------
在
public class PlatformerGame.cs
-> public class PlatformerGame : Microsoft.Xna.Framework.Game 加了:
public delegate void Callback(IntPtr text, int num, double score, IntPtr
command);
[DllImport("recordAndRecogDLL.dll")]
public static extern bool bInitEngine(char[] filename, double volth,
double scoreTh, double silFrame, Callback functionPtr, int deb);
[DllImport("recordAndRecogDLL.dll")]
public static extern bool bStartRecord();
[DllImport("recordAndRecogDLL.dll")]
public static extern bool bSetStop();
private static Process myProcess;
private static string temp2 = "";
在
同个cs档下public PlatformerGame()内加了:
Callback myCallBack = new Callback(PlatformerGame.Report);
char[] filename = new char[] { 'c', 'o', 'm', 'm', 'a', 'n', 'd', '.', 't', 'x', 't' };
bInitEngine(filename, 0, 50, 0.5, myCallBack, 0);
bStartRecord();
myProcess = new Process();
继续在
public class PlatformerGame : Microsoft.Xna.Framework.Game加入:
public static void ActionForRecog(string ActionPrm)
{
switch (ActionPrm)
{
case "action00": // 电脑简报 → 开启PowerPoint
myProcess.StartInfo.FileName = "POWERPNT";
myProcess.StartInfo.Arguments = "\"\"";
break;
case "action04": // 电脑上网 → 开启IE
myProcess.StartInfo.FileName = "iexplore";
break;
case "action09": // 电脑计算机 → 开启计算机
myProcess.StartInfo.FileName = "calc";
break;
default:
ActionPrm = "no command";
break;
}
}//这边觉得怪怪的请别介意我还没有改动作^^"
public static void Report(IntPtr text, int num, double score, IntPtr command)
{
temp2 = Marshal.PtrToStringAnsi(command);
ActionForRecog(temp2);
}
※ 引述《antirazin (今年是日星来台年~真嗨)》之铭言:
: 小的用的是VC# 2008,XNA GAME Studio 3.0
: 想请问各位大大一下,
: 我将XNA附的Platform范例中稍加一点东西
: (在public class PlatformerGame : Microsoft.Xna.Framework.Game下 加code),
: 之後按F5可以Run但是没有画面跳出来(有出现区域变数呼叫堆叠1秒左右就关上了),
: 请问可能是哪些方面的问题呢?
: 如需要CODE我再部分PO出(其实是不知道该PO哪一段= =")
: 先感谢了~
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.230.227.194
※ 编辑: antirazin 来自: 61.230.227.194 (03/17 22:35)