MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / makeScriptCall

Method makeScriptCall

Engine/source/T3D/gameTSCtrl.cpp:75–97  ·  view source on GitHub ↗

---------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

73
74//---------------------------------------------------------------------------
75void GameTSCtrl::makeScriptCall(const char *func, const GuiEvent &evt) const
76{
77 // write screen position
78 char *sp = Con::getArgBuffer(32);
79 dSprintf(sp, 32, "%d %d", evt.mousePoint.x, evt.mousePoint.y);
80
81 // write world position
82 char *wp = Con::getArgBuffer(32);
83 Point3F camPos;
84 mLastCameraQuery.cameraMatrix.getColumn(3, &camPos);
85 dSprintf(wp, 32, "%g %g %g", camPos.x, camPos.y, camPos.z);
86
87 // write click vector
88 char *vec = Con::getArgBuffer(32);
89 Point3F fp(evt.mousePoint.x, evt.mousePoint.y, 1.0);
90 Point3F ray;
91 unproject(fp, &ray);
92 ray -= camPos;
93 ray.normalizeSafe();
94 dSprintf(vec, 32, "%g %g %g", ray.x, ray.y, ray.z);
95
96 Con::executef( (SimObject*)this, func, sp, wp, vec );
97}
98
99void GameTSCtrl::onMouseDown(const GuiEvent &evt)
100{

Callers

nothing calls this directly

Calls 5

getArgBufferFunction · 0.85
dSprintfFunction · 0.85
executefFunction · 0.85
getColumnMethod · 0.80
normalizeSafeMethod · 0.45

Tested by

no test coverage detected