Compare commits
34
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
180b0f4b3f | ||
|
|
d7bd0d02ee | ||
|
|
720b4d45f2 | ||
|
|
8951795e9b | ||
|
|
4208265d21 | ||
|
|
5422b854e0 | ||
|
|
4f9469ead5 | ||
|
|
a07bdb6b99 | ||
|
|
24432f1b91 | ||
|
|
07fa2e7868 | ||
|
|
4fe14e341c | ||
|
|
c3ac30208b | ||
|
|
7fa7ece574 | ||
|
|
be0c83e766 | ||
|
|
4f4cca4109 | ||
|
|
7e3369d128 | ||
|
|
33e5a67e4d | ||
|
|
75d8032b5d | ||
|
|
013a27d0b3 | ||
|
|
8adb6bbaef | ||
|
|
5723371944 | ||
|
|
4272c12ec1 | ||
|
|
923ac33302 | ||
|
|
bc1a251842 | ||
|
|
8973b65954 | ||
|
|
132a9d63c0 | ||
|
|
fbc3be26e4 | ||
|
|
56d4651228 | ||
|
|
570816c0b5 | ||
|
|
90d44a1376 | ||
|
|
9a585cf24b | ||
|
|
728ab76571 | ||
|
|
a96e97f2a0 | ||
|
|
8204c6b556 |
Vendored
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>test</title>
|
<title>nigger</title>
|
||||||
<link rel="shortcut icon" type="image/png" href="./favicon.png">
|
<link rel="shortcut icon" type="image/png" href="./favicon.png">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
Generated
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "test",
|
"name": "nigger",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "test",
|
"name": "nigger",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"config": {
|
"config": {
|
||||||
|
|||||||
@@ -10,20 +10,47 @@ import game.ui.console.Console;
|
|||||||
|
|
||||||
class ConVar{
|
class ConVar{
|
||||||
static var CVarMap:Map<String, CVar> = [];
|
static var CVarMap:Map<String, CVar> = [];
|
||||||
public static inline function registerCVar(_name:String, _type:CVarType, _value, _callback:Void->Void,_callOnSet:Bool=false)
|
static var CCmdMap:Map<String, CCmd> = [];
|
||||||
|
/**
|
||||||
|
* Registers a new CVar
|
||||||
|
* @param _name The name of the CVar. This is the way it is called in the console or referred to in code.
|
||||||
|
* @param _type CVar type as defined in the CVarType enum.
|
||||||
|
* @param _value The default value for this CVar. This needs to be in line with its CVarType.
|
||||||
|
* @param _flags CVar flags as defined in the CVarFlags enum.
|
||||||
|
* @param _helpString Help string that gets printed out in console when no value is specified.
|
||||||
|
* @param _callback The function that gets called when the CVar is set. Calls empty Void when left undefined.
|
||||||
|
* @param _callOnCreate Whether the callback function gets called or not after registering.
|
||||||
|
* @param _bMin Specifies if the CVar has a minimum numeric value.
|
||||||
|
* @param _fMin Specifies the minimum numeric value.
|
||||||
|
* @param _fMax Specifies the maximum numeric value.
|
||||||
|
* @param _bMax Specifies if the CVar has a maximum numeric value.
|
||||||
|
*/
|
||||||
|
public static inline function registerCVar(_name:String, _type:CVarType, _value:Dynamic, ?_flags:CVarFlag, ?_helpString:String = "", ?_callback:Void->Void, ?_callOnCreate:Bool=false, _bMin:Bool=false, _fMin:Float=0, _fMax:Float=0, _bMax:Bool = false):CVar
|
||||||
{
|
{
|
||||||
if(CVarMap[_name]!=null){
|
if(CVarMap[_name]!=null || CCmdMap[_name]!=null){
|
||||||
|
Console.devMsg("Tried setting already defined convar: " + _name + ", returning null instead");
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
CVarMap[_name] = {
|
if(_bMin && _value < _fMin) _value = _fMin;
|
||||||
|
if(_bMax && _value > _fMax) _value = _fMax;
|
||||||
|
var cvar:CVar = CVarMap[_name] = {
|
||||||
name : _name,
|
name : _name,
|
||||||
type : _type,
|
type : _type,
|
||||||
value : _value,
|
value : _value,
|
||||||
|
flags: _flags,
|
||||||
|
helpString: _helpString,
|
||||||
|
bMin : _bMin,
|
||||||
|
fMin : _fMin,
|
||||||
|
fMax : _fMax,
|
||||||
|
bMax : _bMax,
|
||||||
callback : _callback == null ? ()->{} : _callback
|
callback : _callback == null ? ()->{} : _callback
|
||||||
}
|
}
|
||||||
|
if(_callback != null && _callOnCreate){
|
||||||
|
_callback();
|
||||||
}
|
}
|
||||||
public static inline function setCVar(_name:String, _value:Dynamic)
|
return cvar;
|
||||||
|
}
|
||||||
|
public static inline function registerCCmd(_name:String, ?_callback:Array<String>->Void):CCmd
|
||||||
{
|
{
|
||||||
if(CVarMap[_name]!=null || CCmdMap[_name]!=null){
|
if(CVarMap[_name]!=null || CCmdMap[_name]!=null){
|
||||||
Console.devMsg("Tried setting already defined command: " + _name + ", returning null instead");
|
Console.devMsg("Tried setting already defined command: " + _name + ", returning null instead");
|
||||||
@@ -77,7 +104,7 @@ class ConVar{
|
|||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
Console.consoleIndex.devMsg("trying to set null convar '"+_name+"'");
|
Console.devMsg("trying to set null convar '"+_name+"'");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,9 +11,11 @@ class Mode
|
|||||||
{
|
{
|
||||||
return Lib.application.window;
|
return Lib.application.window;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function setVideoMode(width:Int, height:Int, fs:Int = null){
|
public static function setVideoMode(width:Int, height:Int, fs:Int = null){
|
||||||
getWindow().resize(width,height);
|
getWindow().resize(width,height);
|
||||||
|
if(fs != null){
|
||||||
|
switchFsMode(fs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public static var cvMatSetVideoMode:CCmd = ConVar.registerCCmd("mat_setvideomode",(args:Array<String>)->{
|
public static var cvMatSetVideoMode:CCmd = ConVar.registerCCmd("mat_setvideomode",(args:Array<String>)->{
|
||||||
setVideoMode(Std.parseInt(args[0]), Std.parseInt(args[1]), Std.parseInt(args[2]));
|
setVideoMode(Std.parseInt(args[0]), Std.parseInt(args[1]), Std.parseInt(args[2]));
|
||||||
|
|||||||
Reference in New Issue
Block a user