-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSAPITest.cpp
More file actions
49 lines (40 loc) · 930 Bytes
/
Copy pathSAPITest.cpp
File metadata and controls
49 lines (40 loc) · 930 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// SAPITest.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "SAPIEngine.h"
#include <chrono>
#include <iostream>
#include <thread>
bool g_Quit = false;
void sapiCallback(int matchedRuleID, const std::wstring& text)
{
if (text == L"quit")
{
g_Quit = true;
}
std::cout << matchedRuleID << ": ";
// This is a hacky method to output the wstring to regular std::cout
for (auto c : text)
{
std::cout << (char)c;
}
std::cout << std::endl;
}
int main()
{
SAPIEngine& sapi = SAPIEngine::getInstance();
sapi.initialize();
sapi.addCommand(L"quit");
sapi.addCommand(L"computer");
sapi.addCommand(L"hello computer");
sapi.addCommand(L"open the pod bay doors please hal");
sapi.addCommand(L"primary weapon");
sapi.addCommand(L"secondary weapon");
sapi.addCommand(L"tertiary weapon");
sapi.setCallback(sapiCallback);
while (!g_Quit)
{
sapi.update();
}
return 0;
}