update
This commit is contained in:
@@ -92,26 +92,28 @@ class Input{
|
||||
{
|
||||
bindMap[input] = action;
|
||||
}
|
||||
private static var bind:CCmd = ConVar.registerCCmd("bind", (cArgs:Array<String>)->{
|
||||
cArgs[0] = cArgs[0].toUpperCase();
|
||||
if(cArgs.length == 2){
|
||||
if(keyCodeMap[cArgs[0]]!= null) {
|
||||
if(cArgs[1].indexOf('"') == 0 && cArgs[1].lastIndexOf('"') == cArgs[1].length-1){
|
||||
bindKey(cArgs[0], cArgs[1].substring(1,cArgs[1].length-1));
|
||||
@:concmd("bind")
|
||||
private static function bind(args:Array<String>):Void
|
||||
{
|
||||
args[0] = args[0].toUpperCase();
|
||||
if(args.length == 2){
|
||||
if(keyCodeMap[args[0]]!= null) {
|
||||
if(args[1].indexOf('"') == 0 && args[1].lastIndexOf('"') == args[1].length-1){
|
||||
bindKey(args[0], args[1].substring(1,args[1].length-1));
|
||||
}
|
||||
else{
|
||||
bindKey(cArgs[0], cArgs[1]);
|
||||
bindKey(args[0], args[1]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else if(cArgs.length == 1){
|
||||
Console.devMsg(bindMap[cArgs[0]]);
|
||||
else if(args.length == 1){
|
||||
Console.devMsg(bindMap[args[0]]);
|
||||
}
|
||||
else{
|
||||
Console.devMsg("usage: bind <key> <command>");
|
||||
}
|
||||
});
|
||||
};
|
||||
public static function onEnterFrame()
|
||||
{
|
||||
if( keys[Kb.BACKQUOTE]){
|
||||
|
||||
@@ -42,10 +42,13 @@ class Console extends Sprite {
|
||||
public static var scvar_mat_consolebg:CVar;
|
||||
|
||||
public var cvar_mat_consolebg:CVar;
|
||||
|
||||
public var ccmd_visible:CCmd = ConVar.registerCCmd("toggleconsole", (cArgs:Array<String>) -> {
|
||||
// public function cCmdToggleConsole(args:Array<String>) {
|
||||
// toggle();
|
||||
// }
|
||||
@:concmd("toggleconsole")
|
||||
public function ccmd_toggleconsole(cArgs:Array<String>) {
|
||||
toggle();
|
||||
});
|
||||
};
|
||||
|
||||
public function new() {
|
||||
super();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package game.video;
|
||||
|
||||
import game.ui.console.Console;
|
||||
import engine.ConVar;
|
||||
import engine.typedefs.console.CCmd;
|
||||
import openfl.Lib;
|
||||
@@ -14,22 +15,26 @@ class Mode
|
||||
|
||||
public static function setVideoMode(width:Int, height:Int, fs:Int = null){
|
||||
getWindow().resize(width,height);
|
||||
if(fs == null){
|
||||
return;
|
||||
}
|
||||
switchFsMode(fs);
|
||||
}
|
||||
@:concmd("mat_setvideomode")
|
||||
public static function cCmdMatSetVideoMode(args:Array<String>){
|
||||
Console.devMsg("Setting video mode to: "+args[0]+"x"+args[1]+"x"+args[2]);
|
||||
Mode.setVideoMode(Std.parseInt(args[0]), Std.parseInt(args[1]), Std.parseInt(args[2]));
|
||||
}
|
||||
public static function switchFsMode(toState:Int = 0){
|
||||
Console.devMsg("Switching fullscreen mode to: "+toState);
|
||||
if(toState == 0){
|
||||
if(Lib.current.stage.displayState != StageDisplayState.FULL_SCREEN_INTERACTIVE){
|
||||
Lib.current.stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
|
||||
}
|
||||
else{
|
||||
Lib.current.stage.displayState = StageDisplayState.NORMAL;
|
||||
}
|
||||
Lib.current.stage.displayState = StageDisplayState.FULL_SCREEN;
|
||||
}
|
||||
else if(toState == 1){
|
||||
Lib.current.stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
|
||||
}
|
||||
else{
|
||||
|
||||
Lib.current.stage.displayState = StageDisplayState.NORMAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user