MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/PhysX / addCmd

Method addCmd

physx/samples/samplebase/SampleConsole.cpp:389–418  ·  view source on GitHub ↗

Add a command

Source from the content-addressed store, hash-verified

387
388// Add a command
389void Console::addCmd(const char* full_cmd, void (*function)(Console*, const char *, void*))
390{
391 if(!full_cmd) return; // Command must be defined
392 if(!function) return; // Function must be defines
393 if(strlen(full_cmd)>=CONSOLE_MAX_COMMAND_LENGTH) return;
394 if(mNbCmds==CONSOLE_MAX_COMMAND_NB) return;
395 mNbCmds++;
396
397 int HashIndex = full_cmd[0];
398 HashIndex = tolower(HashIndex);
399
400 ConsoleCommand* pcmd = mCmds[HashIndex];
401 if(!pcmd)
402 {
403 mCmds[HashIndex] = SAMPLE_NEW(ConsoleCommand);
404 pcmd = mCmds[HashIndex];
405 }
406 else
407 {
408 while(pcmd->next)
409 {
410 pcmd = pcmd->next;
411 }
412 pcmd->next = SAMPLE_NEW(ConsoleCommand);
413 pcmd = pcmd->next;
414 }
415 strcpy(pcmd->fullcmd, full_cmd);
416 pcmd->function = function;
417 pcmd->next = NULL;
418}
419
420bool Console::render(Renderer* rnd)
421{

Callers 4

onInitMethod · 0.80
onInitMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected