Branimir Karadžić 8 years ago
parent
commit
965f8c91b2
2 changed files with 12 additions and 4 deletions
  1. 11 3
      examples/common/entry/cmd.cpp
  2. 1 1
      examples/common/entry/cmd.h

+ 11 - 3
examples/common/entry/cmd.cpp

@@ -4,8 +4,9 @@
  */
  */
 
 
 #include <bx/allocator.h>
 #include <bx/allocator.h>
-#include <bx/hash.h>
 #include <bx/commandline.h>
 #include <bx/commandline.h>
+#include <bx/hash.h>
+#include <bx/string.h>
 
 
 #include "dbg.h"
 #include "dbg.h"
 #include "cmd.h"
 #include "cmd.h"
@@ -104,7 +105,14 @@ void cmdAdd(const char* _name, ConsoleFn _fn, void* _userData)
 	s_cmdContext->add(_name, _fn, _userData);
 	s_cmdContext->add(_name, _fn, _userData);
 }
 }
 
 
-void cmdExec(const char* _cmd)
+void cmdExec(const char* _format, ...)
 {
 {
-	s_cmdContext->exec(_cmd);
+	char tmp[2048];
+
+	va_list argList;
+	va_start(argList, _format);
+	bx::vsnprintf(tmp, BX_COUNTOF(tmp), _format, argList);
+	va_end(argList);
+
+	s_cmdContext->exec(tmp);
 }
 }

+ 1 - 1
examples/common/entry/cmd.h

@@ -19,6 +19,6 @@ void cmdShutdown();
 void cmdAdd(const char* _name, ConsoleFn _fn, void* _userData = NULL);
 void cmdAdd(const char* _name, ConsoleFn _fn, void* _userData = NULL);
 
 
 ///
 ///
-void cmdExec(const char* _cmd);
+void cmdExec(const char* _format, ...);
 
 
 #endif // CMD_H_HEADER_GUARD
 #endif // CMD_H_HEADER_GUARD