private static void RegisterClientOnlyCvars(EngineConfiguration configuration) { // cl - Client. ScriptingInterface.RegisterCvarInt("cl_fps", "Amount of client frames per second", CvarFlag.None, 1000, 1, 1000); ScriptingInterface.RegisterCvarCallback <int>("cl_fps", cl_fpsCallback); // fs - File system. ScriptingInterface.RegisterCvarString("fs_client", "Client DLL location", CvarFlag.ReadOnly, configuration.ClientDLL); // r - Renderer. ScriptingInterface.RegisterCvarEnum <Vsync>("r_vsync", "Vsync mode", CvarFlag.None, Vsync.On); // snd - Sound system. ScriptingInterface.RegisterCvarString("snd_device", "Name of the sound device to use", CvarFlag.None, "default"); ScriptingInterface.RegisterCvarInt("snd_freq", "Sound frequency", CvarFlag.ReadOnly, 44100); ScriptingInterface.RegisterCvarInt("snd_bufferSize", "Sound buffer size in samples", CvarFlag.None, 147, 1, 44100); ScriptingInterface.RegisterCvarInt("snd_bufferCount", "Amount of preprocessed buffers", CvarFlag.None, 2, 1, 100); ScriptingInterface.RegisterCvarBool("snd_shutdownRequested", "Determines if a sound system shutdown is requested", CvarFlag.WriteProtected, false); ScriptingInterface.RegisterCvarBool("snd_noSound", "Disable sound", CvarFlag.None, false); ScriptingInterface.RegisterCvarFloat("snd_distanceModel_exp_bias", "Bias for the exponential distance model", CvarFlag.None, 2f, 1f, 100f); ScriptingInterface.RegisterCvarFloat("snd_distanceModel_invExp_bias", "Bias for the inverse exponential distance model", CvarFlag.None, 2f, 1f, 100f); ScriptingInterface.RegisterCvarEnum <DistanceModel>("snd_distanceModel", "Distance model for positional audio", CvarFlag.None, DistanceModel.Linear); // w - Window, client should set the appropriate values during initialization. ScriptingInterface.RegisterCvarString("w_className", "Window class name", CvarFlag.ReadOnly, "DarkTech-Engine"); ScriptingInterface.RegisterCvarString("w_title", "Window title", CvarFlag.None, "DarkTech Engine"); ScriptingInterface.RegisterCvarInt("w_x", "Window x location", CvarFlag.None, 0, 0, 65536); ScriptingInterface.RegisterCvarInt("w_y", "Window y location", CvarFlag.None, 0, 0, 65536); ScriptingInterface.RegisterCvarInt("w_width", "Window width", CvarFlag.None, 1280, 1, 65536); ScriptingInterface.RegisterCvarInt("w_height", "Window height", CvarFlag.None, 720, 1, 65536); ScriptingInterface.RegisterCvarBool("w_noBorder", "Remove window border", CvarFlag.None, false); }
private static void GameLoop() { float tsClient = 1.0f / ScriptingInterface.GetCvarValue <int>("cl_fps"); float tsServer = 1.0f / ScriptingInterface.GetCvarValue <int>("sv_fps"); float tsDebug = 1.0f; clientTimer = new DeltaTimer(Timer, tsClient); serverTimer = new DeltaTimer(Timer, tsServer); debugTimer = new DeltaTimer(Timer, tsDebug); while (!ShutdownRequested) { if (HasServer) { ServerFrame(); } if (HasClient) { ClientFrame(); } DebugFrame(); } }
public override void SetUp() { base.SetUp(); myDB = myMockery.NewMock <IDatabaseSC>(); var serviceProvider = new ServiceProvider(); serviceProvider.RegisterService("TOM Database", myDB); myScriptingInterface = new ScriptingInterface(); myScriptingInterface.Init(serviceProvider); // prepare data mySchema = CreateSchema("test1"); myMgr = myScriptingInterface.GetManager(mySchema); myMgr.CreateTable(); // add some data ScopedTable table = myMgr.Query(0); AddRow(table, 0, 0, new DateTime(2001, 1, 1), 1); AddRow(table, 0, 0, new DateTime(2002, 1, 1), 2); AddRow(table, 0, 1, new DateTime(2002, 1, 1), 12); AddRow(table, 0, 0, new DateTime(2003, 1, 1), 3); AddRow(table, 0, 1, new DateTime(2003, 1, 1), 13); AddRow(table, 0, 2, new DateTime(2003, 1, 1), 23); AddRow(table, 0, 0, new DateTime(2004, 1, 1), 4); AddRow(table, 0, 1, new DateTime(2005, 1, 1), 15); table = myMgr.Query(1); AddRow(table, 1, 1, new DateTime(2002, 1, 1), 112); }
private static void RegisterSharedCvars(EngineConfiguration configuration) { // sys - System. sys_model = ScriptingInterface.RegisterCvarEnum <EngineModel>("sys_model", "Model of the engine", CvarFlag.WriteProtected, configuration.Model); // fs - File system. ScriptingInterface.RegisterCvarString("fs_root", "Root of the file system", CvarFlag.ReadOnly, configuration.RootDirectory); }
private void UnlinkScriptingInterface(ScriptingInterface scriptingInterface) { if (scriptingInterface == null) { return; } scriptingInterface.OnLog -= AddLog; scriptingInterface.OnLogError -= AddErrorLog; scriptingInterface.OnException -= AddException; }
private static void RegisterCommands() { ScriptingInterface.RegisterCommand("quit", "Closes the engine and returns to the desktop", false, quit); // r - Renderer. ScriptingInterface.RegisterCommand("r_restart", "Restart the renderer", false, r_restart); // snd - Sound system. ScriptingInterface.RegisterCommand("snd_restart", "Restart the sound system", false, snd_restart); }
private static void RegisterServerOnlyCvars(EngineConfiguration configuration) { // fs - File system. ScriptingInterface.RegisterCvarString("fs_server", "Server DLL location", CvarFlag.ReadOnly, configuration.ServerDLL); // sv - Server. sv_cheats = ScriptingInterface.RegisterCvarBool("sv_cheats", "Enable cheats", CvarFlag.WriteProtected, false); ScriptingInterface.RegisterCvarInt("sv_fps", "Amount of server frames per second", CvarFlag.WriteProtected, 20, 1, 1000); ScriptingInterface.RegisterCvarCallback <int>("sv_fps", sv_fpsCallback); }
public static ScriptingInterface TomScripting( this ServiceProvider serviceProvider ) { if ( !serviceProvider.RegisteredServices.Contains( typeof( ScriptingInterface ).ToString() ) ) { ScriptingInterface service = new ScriptingInterface(); service.Init( serviceProvider ); serviceProvider.RegisterService( typeof( ScriptingInterface ), service ); } return serviceProvider.GetService<ScriptingInterface>(); }
private static T LoadDLL <T>(string pathCvar) { string dllPath = ScriptingInterface.GetCvarValue <string>(pathCvar); T result; if (!AssemblyUtils.LoadType <T>(dllPath, out result)) { throw new InitializeException("Failed to load dll {0}", dllPath); } return(result); }
public override void SetUp() { base.SetUp(); myDB = myMockery.NewMock<IDatabaseSC>(); var serviceProvider = new ServiceProvider(); serviceProvider.RegisterService( "TOM Database", myDB ); myScriptingInterface = new ScriptingInterface(); myScriptingInterface.Init( serviceProvider ); myIsPersistent = false; }
public override void SetUp() { base.SetUp(); myDB = myMockery.NewMock <IDatabaseSC>(); var serviceProvider = new ServiceProvider(); serviceProvider.RegisterService("TOM Database", myDB); myScriptingInterface = new ScriptingInterface(); myScriptingInterface.Init(serviceProvider); myIsPersistent = false; }
public override void SetUp() { base.SetUp(); var serviceProvider = new ServiceProvider(); serviceProvider.RegisterService( "TOM Database", myDB ); myScriptingInterface = new ScriptingInterface(); myScriptingInterface.Init( serviceProvider ); myIsPersistent = true; // use transactions for performance reasons only myTrans = new TransactionScope(); }
public override void SetUp() { base.SetUp(); var serviceProvider = new ServiceProvider(); serviceProvider.RegisterService("TOM Database", myDB); myScriptingInterface = new ScriptingInterface(); myScriptingInterface.Init(serviceProvider); myIsPersistent = true; // use transactions for performance reasons only myTrans = new TransactionScope(); }
public override void SetUp() { base.SetUp(); myDataAccess = myMockery.NewMock<IDatabaseSC>(); myServiceProvider = Engine.ServiceProvider; myServiceProvider.RegisterService( "TOM Database", myDataAccess ); myServiceProvider.RegisterService( typeof( IEntityRepositoryFactory ), new FakeEntityRepositoryFactory() ); myServiceProvider.ConfigurationSC().Import( Path.Combine( MauiHome, "config" ), true ); ScriptingInterface tomScripting = new ScriptingInterface(); tomScripting.Init( myServiceProvider ); myServiceProvider.RegisterService( typeof( ScriptingInterface ), tomScripting ); myInterpreter = new Interpreter(); myInterpreter.Init( myServiceProvider ); //myInterpreter.DumpErrorToConsole = true; myInterpreter.Start(); }
public override void SetUp() { base.SetUp(); myDataAccess = myMockery.NewMock <IDatabaseSC>(); myServiceProvider = Engine.ServiceProvider; myServiceProvider.RegisterService("TOM Database", myDataAccess); myServiceProvider.RegisterService(typeof(IEntityRepositoryFactory), new FakeEntityRepositoryFactory()); myServiceProvider.ConfigurationSC().Import(Path.Combine(MauiHome, "config"), true); ScriptingInterface tomScripting = new ScriptingInterface(); tomScripting.Init(myServiceProvider); myServiceProvider.RegisterService(typeof(ScriptingInterface), tomScripting); myInterpreter = new Interpreter(); myInterpreter.Init(myServiceProvider); //myInterpreter.DumpErrorToConsole = true; myInterpreter.Start(); }
public override void SetUp() { base.SetUp(); myDB = myMockery.NewMock<IDatabaseSC>(); var serviceProvider = new ServiceProvider(); serviceProvider.RegisterService( "TOM Database", myDB ); myScriptingInterface = new ScriptingInterface(); myScriptingInterface.Init( serviceProvider ); // prepare data mySchema = CreateSchema( "test1" ); myMgr = myScriptingInterface.GetManager( mySchema ); myMgr.CreateTable(); // add some data ScopedTable table = myMgr.Query( 0 ); AddRow( table, 0, 0, new DateTime( 2001, 1, 1 ), 1 ); AddRow( table, 0, 0, new DateTime( 2002, 1, 1 ), 2 ); AddRow( table, 0, 1, new DateTime( 2002, 1, 1 ), 12 ); AddRow( table, 0, 0, new DateTime( 2003, 1, 1 ), 3 ); AddRow( table, 0, 1, new DateTime( 2003, 1, 1 ), 13 ); AddRow( table, 0, 2, new DateTime( 2003, 1, 1 ), 23 ); AddRow( table, 0, 0, new DateTime( 2004, 1, 1 ), 4 ); AddRow( table, 0, 1, new DateTime( 2005, 1, 1 ), 15 ); table = myMgr.Query( 1 ); AddRow( table, 1, 1, new DateTime( 2002, 1, 1 ), 112 ); }
private static void r_restart(ArgList args) { CvarBool r_restartRequested = ScriptingInterface.GetCvar <CvarBool>("r_restartRequested"); r_restartRequested.Value = true; }
private void OnDestroy() { scriptingInterface = null; instance = null; }