• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include "proto/tuningfork_extensions.pb.h"
2 #include <iostream>
3 #include "mocktuningfork.h"
4 
5 using ::com::google::tuningfork::Annotation;
6 using ::com::google::tuningfork::Settings;
7 using ::com::google::tuningfork::FidelityParams;
8 
9 using ::google::protobuf::internal::EnumTypeTraits;
10 
11 FidelityParams fparams;
12 
fidelityParamsCallback(const FidelityParams & p)13 void fidelityParamsCallback(const FidelityParams& p) {
14   fparams = p;
15   std::cout << "Game got fidelity parameters from TF: "
16             << fparams.DebugString() << std::endl;
17 }
18 
runWithNoGameEngine()19 void runWithNoGameEngine() {
20   Settings settings;
21   mocktuningfork::init(settings, fidelityParamsCallback);
22   Annotation ann;
23   ann.SetExtension(boss_alive, true);
24   for(size_t i=1; i<5; ++i) {
25     ann.SetExtension(car, (EnumTypeTraits<Car, Car_IsValid>::ConstType)(i));
26     mocktuningfork::set(ann);
27     mocktuningfork::tick(SYS_CPU);
28   }
29 }
30 
main(int,char * [])31 int main(int /*argc*/, char * /*argv*/[]) {
32   GOOGLE_PROTOBUF_VERIFY_VERSION;
33 
34   std::cout << "** Without Game engine ** \n";
35   runWithNoGameEngine();
36 
37   return 0;
38 }
39