-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from Team-Fennec/feat/engine-tools
Feat/engine tools
- Loading branch information
Showing
108 changed files
with
4,113 additions
and
2,149 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,4 +74,4 @@ | |
"SliderGrab" "IcyTrans" | ||
"SliderGrabActive" "Icy" | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
"EngineTools" | ||
{ | ||
// no tools currently | ||
} | ||
"dll" "console" | ||
"dll" "modeleditor" | ||
"dll" "materialeditor" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
"Lang" { | ||
"Lang" | ||
{ | ||
"Language" "english" | ||
"tokens" { | ||
// none: for now | ||
"tokens" | ||
{ | ||
"GameMenu_StartTest" "Start Test Scene" | ||
"GameMenu_Quit" "Quit" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,22 @@ | ||
using System; | ||
using System.Diagnostics; | ||
|
||
namespace WinterEngine.Core; | ||
|
||
[Flags] | ||
public enum CmdFlags | ||
{ | ||
None, | ||
Cheat, | ||
Development, | ||
Debug | ||
} | ||
|
||
#if HAS_MACROS | ||
//#macro ConsoleCommand(name, desc, fn) internal sealed class nameConCommand : ConCmd {\ | ||
public override string Command => "name";\ | ||
public override string Description => desc;\ | ||
public override CmdFlags Flags => CmdFlags.None;\ | ||
public override void Exec(string[] args)\ | ||
fn\ | ||
} | ||
#endif | ||
|
||
public abstract class ConCmd | ||
{ | ||
public abstract string Command { get; } | ||
public abstract string Description { get; } | ||
public abstract CmdFlags Flags { get; } | ||
|
||
public abstract void Exec(string[] args); | ||
} | ||
using System; | ||
using System.Diagnostics; | ||
|
||
namespace WinterEngine.Core; | ||
|
||
[Flags] | ||
public enum CmdFlags | ||
{ | ||
None, | ||
Cheat, | ||
Development, | ||
Debug | ||
} | ||
|
||
public abstract class ConCmd | ||
{ | ||
public abstract string Command { get; } | ||
public abstract string Description { get; } | ||
public abstract CmdFlags Flags { get; } | ||
|
||
public abstract void Exec(string[] args); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
using System.IO; | ||
using ValveKeyValue; | ||
using Veldrid; | ||
|
||
namespace WinterEngine.Core; | ||
|
||
public struct ConVar | ||
{ | ||
public string Key { get; } | ||
public Type Type { get; } | ||
public object Value; | ||
public object DefaultValue { get; } | ||
|
||
public ConVar(string key, object value) | ||
{ | ||
Key = key; | ||
Type = value.GetType(); | ||
Value = value; | ||
DefaultValue = value; | ||
} | ||
} | ||
|
||
public static class ConfigManager | ||
{ | ||
private static readonly ILog m_Log = LogManager.GetLogger("Config"); | ||
|
||
private static List<ConVar> m_ConVars = new List<ConVar>(); | ||
private static Dictionary<string, ConVar> m_CVars = new Dictionary<string, ConVar>(); | ||
|
||
public static void Init() | ||
{ | ||
m_Log.Info("Initializing ConfigManager"); | ||
} | ||
|
||
public static void SaveConfig() | ||
{ | ||
string path = Path.Combine(Engine.GameDir, "cfg", "config.cfg"); | ||
Datamodel.Datamodel configDmx = new Datamodel.Datamodel("config", 1); | ||
configDmx.Root = new Datamodel.Element(configDmx, "DmeConfig"); | ||
|
||
foreach (string key in m_CVars.Keys) | ||
{ | ||
//configDmx.Root.Add(key, m_CVars[]) | ||
} | ||
} | ||
|
||
public static void RegisterCVar(string key, object value) | ||
{ | ||
if (m_ConVars.Where(i => i.Key == key).ToList().Count > 0) | ||
{ | ||
m_Log.Error($"Convar {key} aready exists!"); | ||
} | ||
else | ||
{ | ||
m_ConVars.Add(new ConVar(key, value)); | ||
} | ||
} | ||
|
||
public static ConVar? GetCVar(string key) | ||
{ | ||
foreach (ConVar cvar in m_ConVars) | ||
{ | ||
if (cvar.Key == key) | ||
{ | ||
return cvar; | ||
} | ||
} | ||
|
||
m_Log.Error($"No convar by key {key}"); | ||
return null; | ||
} | ||
|
||
public static void SetValue(string key, object value) | ||
{ | ||
// no you can't null check this variable, it's typed. (CS0019,CS0037) | ||
// you also can't make it nullable, that makes it readonly. (CS0200) | ||
ConVar cvar = m_ConVars.Where(i => i.Key == key).First(); | ||
try | ||
{ | ||
cvar.Value = value; | ||
} | ||
catch | ||
{ | ||
m_Log.Error($"No convar by key {key}"); | ||
} | ||
} | ||
|
||
public static void SetValue<T>(string key, T value) | ||
{ | ||
// no you can't null check this variable, it's typed. (CS0019,CS0037) | ||
// you also can't make it nullable, that makes it readonly. (CS0200) | ||
ConVar cvar = m_ConVars.Where(i => i.Key == key).First(); | ||
try | ||
{ | ||
if (cvar.Type == typeof(T)) | ||
cvar.Value = value; | ||
else | ||
m_Log.Error($"Convar {key} is not of type {typeof(T)}"); | ||
} | ||
catch | ||
{ | ||
m_Log.Error($"No convar by key {key}"); | ||
} | ||
} | ||
|
||
public static object? GetValue(string key) | ||
{ | ||
foreach (ConVar cvar in m_ConVars) | ||
{ | ||
if (cvar.Key == key) | ||
{ | ||
return cvar.Value; | ||
} | ||
} | ||
|
||
m_Log.Error($"No convar by key {key}"); | ||
return null; | ||
} | ||
public static T? GetValue<T>(string key) => (T)GetValue(key); | ||
} |
Oops, something went wrong.