MCPcopy Create free account
hub / github.com/bulletphysics/bullet3 / main

Function main

examples/SharedMemory/main.cpp:52–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50#endif //_WIN32
51
52int main(int argc, char* argv[])
53{
54#ifndef _WIN32
55 struct sigaction action;
56 memset(&action, 0x0, sizeof(action));
57 action.sa_handler = cleanup;
58 static const int signos[] = {SIGHUP, SIGINT, SIGQUIT, SIGABRT, SIGSEGV, SIGPIPE, SIGTERM};
59 for (int ii(0); ii < sizeof(signos) / sizeof(*signos); ++ii)
60 {
61 if (0 != sigaction(signos[ii], &action, NULL))
62 {
63 err(EXIT_FAILURE, "signal %d", signos[ii]);
64 }
65 }
66#endif
67
68 b3CommandLineArgs args(argc, argv);
69
70 DummyGUIHelper noGfx;
71
72 CommonExampleOptions options(&noGfx);
73
74 args.GetCmdLineArgument("shared_memory_key", gSharedMemoryKey);
75 args.GetCmdLineArgument("sharedMemoryKey", gSharedMemoryKey);
76
77 // options.m_option |= PHYSICS_SERVER_ENABLE_COMMAND_LOGGING;
78 // options.m_option |= PHYSICS_SERVER_REPLAY_FROM_COMMAND_LOG;
79
80 example = (SharedMemoryCommon*)PhysicsServerCreateFuncBullet2(options);
81
82 example->initPhysics();
83
84 while (example->isConnected() && !(example->wantsTermination() || interrupted))
85 {
86 example->stepSimulation(1.f / 60.f);
87 }
88
89 example->exitPhysics();
90
91 delete example;
92
93 return 0;
94}

Callers

nothing calls this directly

Calls 8

sigactionClass · 0.70
GetCmdLineArgumentMethod · 0.45
initPhysicsMethod · 0.45
isConnectedMethod · 0.45
wantsTerminationMethod · 0.45
stepSimulationMethod · 0.45
exitPhysicsMethod · 0.45

Tested by

no test coverage detected