Use macro to register ccmds
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package engine;
|
||||
|
||||
import game.video.Mode;
|
||||
import haxe.macro.Expr.Field;
|
||||
import engine.typedefs.console.CVar;
|
||||
import engine.typedefs.console.CCmd;
|
||||
import engine.enums.console.CVarType;
|
||||
import engine.enums.console.CVarFlag;
|
||||
import engine.macros.CCmdDecorator;
|
||||
import game.ui.console.Console;
|
||||
|
||||
@:keep
|
||||
// @:build(engine.macros.CCmdDecorator.build()) // No longer needed because we added the build macro to the project.xml
|
||||
class ConVars_Engine {
|
||||
|
||||
@:command("list")
|
||||
public static function listCommands(args:Array<String>) {
|
||||
var CVarMap:Map<String, CVar> = ConVar.getCVarMap();
|
||||
var keys:Array<String> = ConVar.getCVarNames();
|
||||
for(key in keys){
|
||||
if(CVarMap[key] != null){
|
||||
Console.devMsg(key+" "+ CVarMap[key].value);
|
||||
}
|
||||
else{
|
||||
Console.devMsg(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@:command("test")
|
||||
public static function testCommand() {
|
||||
// Command implementation
|
||||
trace("Test Output");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user