Inheritance: ScriptableObject
        public void Init()
        {
            _game = new SampleGame();
            this._config = new EngineConfig();

            if(Engine.Instance!=null) // if there exists already an engine instance, dispose it first.
                Engine.Instance.Dispose();

            this._engine = new Engine(this._game, this._config);
            this._chunkStorage = new ChunkStorage(_game);
            this._chunk = new Chunk(new Vector2Int(0, 0));
        }
Exemple #2
0
        private static Engine _instance; // the memory instance.

        #endregion Fields

        #region Constructors

        public Engine(Game game, EngineConfig config)
        {
            if (_instance != null)
                throw new Exception("You can not instantiate the Engine more than once.");

            _instance = this;

            this.Game = game;
            this.Configuration = config;

            config.Validate(); // validate the config.
        }
Exemple #3
0
        /// <summary>
        ///		Loads default resource configuration if one exists.
        /// </summary>
        private void _setupResources()
        {
            string resourceConfigPath = Path.GetFullPath( CONFIG_FILE );

            if ( File.Exists( resourceConfigPath ) )
            {
                EngineConfig config = new EngineConfig();

                // load the config file
                // relative from the location of debug and releases executables
                config.ReadXml( CONFIG_FILE );

                // interrogate the available resource paths
                foreach ( EngineConfig.FilePathRow row in config.FilePath )
                {
                    ResourceGroupManager.Instance.AddResourceLocation( Path.GetFullPath( row.src ), row.type, row.group );
                }
            }
        }
        public void Init()
        {
            _game = new SampleGame();
            this._config = new EngineConfig();
            this._engine = new Engine(this._game, this._config);

            var cacheWidthInBlocks = ((_config.Cache.CacheRange * 2) + 1) * _config.Chunk.WidthInBlocks;
            var cacheLenghtInBlocks = ((_config.Cache.CacheRange*2) + 1) * _config.Chunk.LenghtInBlocks;

            this._cacheXStartIndex = -cacheWidthInBlocks/2;
            this._cacheXEndIndex = cacheWidthInBlocks / 2;

            this._cacheZStartIndex = -cacheLenghtInBlocks / 2;
            this._cacheZEndIndex = cacheLenghtInBlocks / 2;

            this._directlyIndexedValidationDictionary = new Dictionary<int, BlockType>();

            // set the initial values.
            for (var x = this._cacheXStartIndex; x < this._cacheXEndIndex; x++)
            {
                for (var z = this._cacheZStartIndex; z < this._cacheZEndIndex; z++)
                {
                    var offset = BlockStorage.BlockIndexByWorldPosition(x, z);

                    for (var y = 0; y < _config.Chunk.HeightInBlocks; y++)
                    {
                        var index = offset + y;
                        var block = new Block().RandomizeType();

                        this._directlyIndexedValidationDictionary.Add(index, block.Type);

                        BlockStorage.Blocks[index] = block;
                    }
                }
            }

            // check if validationDictionaries item count is equal to CacheRange's volume.
            Assert.AreEqual(this._directlyIndexedValidationDictionary.Values.Count, _config.Cache.CacheRangeVolume);
        }
		public void SetUp ()
		{
			connectionString = ConnectionManager.Singleton.ConnectionString;
			engine = ConnectionManager.Singleton.Engine;
		}
Exemple #6
0
		public void Setup ()
		{
			conn.Open ();
			engine = ConnectionManager.Singleton.Engine;
		}
 public void TestInvalidViewRangeValue()
 {
     var config = new EngineConfig {Cache = {ViewRange = 0}};
     config.Validate();
 }
        public void TestDefaultValidConfig()
        {
            var game = new SampleGame();
            var config = new EngineConfig();
            var engine = new Engine(game, config);

            Assert.IsTrue(config.Validate()); // expect config validation to succeed.

            Assert.IsNotNull(config.Chunk); // chunk configuration should exist.
            Assert.IsNotNull(config.Cache); // cache configuratio should exists.

            #region validate chunk configuration

            // make sure default dimensions are valid.
            Assert.Greater(config.Chunk.WidthInBlocks, 0);
            Assert.Greater(config.Chunk.HeightInBlocks, 0);
            Assert.Greater(config.Chunk.LenghtInBlocks, 0);

            // calculate expected chunk volume in blocks
            var expectedChunkVolumeInBlocks = config.Chunk.WidthInBlocks*
                                              config.Chunk.HeightInBlocks*
                                              config.Chunk.LenghtInBlocks;
            Assert.AreEqual(config.Chunk.Volume, expectedChunkVolumeInBlocks);

            // make sure max-width-index is valid.
            Assert.AreEqual(config.Chunk.MaxWidthInBlocks,
                            config.Chunk.WidthInBlocks - 1);

            // make sure max-height-index is valid.
            Assert.AreEqual(config.Chunk.MaxHeightInBlocks,
                            config.Chunk.HeightInBlocks - 1);

            // make sure max-lenght-index is valid.
            Assert.AreEqual(config.Chunk.MaxLenghtInBlocks,
                            config.Chunk.LenghtInBlocks - 1);

            #endregion

            #region validate cache configuration

            // make sure default dimensions are valid.
            Assert.Greater(config.Cache.ViewRange, 0);
            Assert.Greater(config.Cache.CacheRange, 0);

            // make sure cache-dimension in blocks are calculated correctly.
            var expectedCacheWidthInBlocks = (config.Cache.CacheRange * 2 + 1) *
                                             config.Chunk.WidthInBlocks;

            var expectedCacheHeightInBlocks = config.Chunk.HeightInBlocks;

            var expectedCacheLenghtInBlocks = (config.Cache.CacheRange * 2 + 1) *
                                              config.Chunk.LenghtInBlocks;

            Assert.AreEqual(config.Cache.CacheRangeWidthInBlocks, expectedCacheWidthInBlocks);
            Assert.AreEqual(config.Cache.CacheRangeHeightInBlocks, expectedCacheHeightInBlocks);
            Assert.AreEqual(config.Cache.CacheRangeLenghtInBlocks, expectedCacheLenghtInBlocks);

            // if by default, cache-extra-chunks option is set to true, make sure that default cache-range > default view-range.
            if (config.Cache.CacheExtraChunks)
                Assert.Greater(config.Cache.CacheRange, config.Cache.ViewRange,
                    "Cache range must be greater view range when CacheExtraChunk option is set to true.");
            else // if by default, cache-extra-chunks option is set to false, make sure that default cache-range = default view-range.
                Assert.AreEqual(config.Cache.ViewRange, config.Cache.CacheRange,
                    "Cache range can not be different than view range when CacheExtraChunk option is set to false.");

            #endregion
        }
			public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
				global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
				global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
				EngineConfig ds = new EngineConfig();
				global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
				any1.Namespace = "http://www.w3.org/2001/XMLSchema";
				any1.MinOccurs = new decimal(0);
				any1.MaxOccurs = decimal.MaxValue;
				any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
				sequence.Items.Add(any1);
				global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
				any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1";
				any2.MinOccurs = new decimal(1);
				any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
				sequence.Items.Add(any2);
				global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
				attribute1.Name = "namespace";
				attribute1.FixedValue = ds.Namespace;
				type.Attributes.Add(attribute1);
				global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
				attribute2.Name = "tableTypeName";
				attribute2.FixedValue = "ConfigOptionDataTable";
				type.Attributes.Add(attribute2);
				type.Particle = sequence;
				global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
				if (xs.Contains(dsSchema.TargetNamespace)) {
					global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
					global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
					try {
						global::System.Xml.Schema.XmlSchema schema = null;
						dsSchema.Write(s1);
						for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
							schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
							s2.SetLength(0);
							schema.Write(s2);
							if ((s1.Length == s2.Length)) {
								s1.Position = 0;
								s2.Position = 0;
								for (; ((s1.Position != s1.Length) 
											&& (s1.ReadByte() == s2.ReadByte())); ) {
									;
								}
								if ((s1.Position == s1.Length)) {
									return type;
								}
							}
						}
					}
					finally {
						if ((s1 != null)) {
							s1.Close();
						}
						if ((s2 != null)) {
							s2.Close();
						}
					}
				}
				xs.Add(dsSchema);
				return type;
			}
 public void TestInvalidViewRangeGreaterThanCacheRange()
 {
     var config = new EngineConfig { Cache = { ViewRange = 2, CacheRange = 1 } };
     config.Validate();
 }
        ///
        /// Sets up a processor with the input params.
        ///
        private IProcessor SetupTestProcessor(IOperationProvider[] operations, VariableCollection vc)
        {
            EngineConfig cfg = new EngineConfig(EnvironmentSettings, vc);

            return(Processor.Create(cfg, operations));
        }
Exemple #12
0
        /// <summary>
        /// Initializes the game.
        /// </summary>
        protected override void Initialize()
        {
            Logger.Trace("init()");                                                                                             // log the init.
            this.Window.Title = string.Format("Voxeliq [{0}/{1}]", PlatformManager.GameFramework, PlatformManager.GraphicsApi); // set the window title.

            this.IsMouseVisible = false;

            // read settings.
            var audioSettings    = new AudioSettings();
            var graphicsSettings = new GraphicsSettings();

            // create a new engine configuration.
            var config = new EngineConfig
            {
                Chunk =
                {
                    WidthInBlocks  =  16,
                    HeightInBlocks = 128,
                    LengthInBlocks =  16,
                },
                Cache =
                {
                    CacheExtraChunks = true,
                    ViewRange        =   12,
                    CacheRange       =   16,
                },
                Graphics =
                {
                    Width                 = graphicsSettings.Width,
                    Height                = graphicsSettings.Height,
                    FullScreenEnabled     = graphicsSettings.FullScreenEnabled,
                    VerticalSyncEnabled   = graphicsSettings.VerticalSyncEnabled,
                    FixedTimeStepsEnabled = graphicsSettings.FixedTimeStepsEnabled,
                },
                World =
                {
                    IsInfinitive = true,
                },
                Debugging =
                {
                    GraphsEnabled = true,
                },
                Bloom =
                {
                    Enabled = false,
                    State   = BloomState.Saturated,
                },
                Audio =
                {
                    Enabled = audioSettings.Enabled,
                }
            };

            var engine = new Engine.Core.Engine(this, config);

            this.ScreenManager = new GraphicsManager(this._graphicsDeviceManager, this); // start the screen manager.

            engine.EngineStart += OnEngineStart;

            engine.Run();

            base.Initialize();
        }
            public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs)
            {
                global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
                global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
                EngineConfig ds = new EngineConfig();

                global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
                any1.Namespace       = "http://www.w3.org/2001/XMLSchema";
                any1.MinOccurs       = new decimal(0);
                any1.MaxOccurs       = decimal.MaxValue;
                any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any1);
                global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
                any2.Namespace       = "urn:schemas-microsoft-com:xml-diffgram-v1";
                any2.MinOccurs       = new decimal(1);
                any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any2);
                global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute1.Name       = "namespace";
                attribute1.FixedValue = ds.Namespace;
                type.Attributes.Add(attribute1);
                global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute2.Name       = "tableTypeName";
                attribute2.FixedValue = "ConfigOptionDataTable";
                type.Attributes.Add(attribute2);
                type.Particle = sequence;
                global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
                if (xs.Contains(dsSchema.TargetNamespace))
                {
                    global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                    global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                    try {
                        global::System.Xml.Schema.XmlSchema schema = null;
                        dsSchema.Write(s1);
                        for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                        {
                            schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                            s2.SetLength(0);
                            schema.Write(s2);
                            if ((s1.Length == s2.Length))
                            {
                                s1.Position = 0;
                                s2.Position = 0;
                                for (; ((s1.Position != s1.Length) &&
                                        (s1.ReadByte() == s2.ReadByte()));)
                                {
                                    ;
                                }
                                if ((s1.Position == s1.Length))
                                {
                                    return(type);
                                }
                            }
                        }
                    }
                    finally {
                        if ((s1 != null))
                        {
                            s1.Close();
                        }
                        if ((s2 != null))
                        {
                            s2.Close();
                        }
                    }
                }
                xs.Add(dsSchema);
                return(type);
            }
Exemple #14
0
        /// <summary>
        /// Creates an engine configuration with two Data Sources.
        /// </summary>
        /// <param name="testContext">Used to store information that is provided to unit tests.</param>
        /// <param name="testRuleFileName">Name of the C# file that contains the Rule implementaiton.</param>
        /// <param name="testResourceFile">Resource File used to run the engine.</param>
        /// <returns>The configuration of the engine with two DataSources.</returns>
        internal static EngineConfig CreateSampleConfigWithTwoDataSources(TestContext testContext,
                                                                          string testRuleFileName, string testResourceFile)
        {
            testRuleFileName = Path.Combine(testContext.DeploymentDirectory, testRuleFileName);
            testResourceFile = Path.Combine(testContext.DeploymentDirectory, testResourceFile);
            var configuration = new EngineConfig();

            #region DataSourceProviderTypes

            configuration.AddDataSourceProvider <ResourceFileDataSource>();
            configuration.AddDataSourceProvider <ConfigDictionaryDataSource>();

            #endregion

            #region PropertyAdapterTypes

            configuration.AddPropertyAdapter <ResourceFileEntryPropertyAdapter>();
            configuration.AddPropertyAdapter <ConfigDictPropertyAdapter>();
            configuration.AddPropertyAdapter <LocResourceSelfPropertyAdapter>();

            #endregion

            #region COAdatpers

            configuration.AddCOAdapter <ResourceFileDataAdapter>();

            #endregion

            #region COTypes

            configuration.AddClassificationObject <LocResource>();

            #endregion

            #region DataSourcePackages

            var package = new DataSourcePackage(); // This package will contain 2 data sources
            package.SetCOType <LocResource>();

            var dataSource = new DataSourceInfo();
            dataSource.SetSourceType(typeof(ResourceFile));
            dataSource.SetSourceLocation(Path.Combine(System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase,
                                                      testResourceFile));
            package.AddDataSource(dataSource);

            dataSource = new DataSourceInfo();
            dataSource.SetSourceType <ConfigDictionary>();
            var configDictionary = new ConfigDictionary
            {
                { "Project", "test RSA" },
            };
            dataSource.SetSourceLocation(configDictionary);
            package.AddDataSource(dataSource);

            configuration.AddDataSourcePackage(package);

            #endregion

            #region Add rules

            RuleContainerType rct = new RuleContainerType();
            if (testRuleFileName.EndsWith(".cs"))
            {
                rct = RuleContainerType.Source;
            }
            else
            {
                rct = RuleContainerType.Module;
            }

            configuration.AddRule(new RuleContainer(testRuleFileName, rct));

            #endregion

            #region And some configuration for dynamic compiler

            configuration.AddBinaryReference("System.Core.dll");
            configuration.AddBinaryReference("mscorlib.dll");
            configuration.AddBinaryReference("System.dll");
            configuration.AddBinaryReference("Microsoft.ResourceStaticAnalysis.Core.dll");
            configuration.AddBinaryReference("Microsoft.ResourceStaticAnalysis.LocResource.dll");
            configuration.AddBinaryReference("Microsoft.ResourceStaticAnalysis.DataAdapter.dll");

            #endregion

            return(configuration);
        }
Exemple #15
0
 public WorldObjectGenerationService(IConfigurationService engineConfigOptions, IVectorCalculatorService vectorCalculatorService)
 {
     engineConfig = engineConfigOptions.Value;
     this.vectorCalculatorService = vectorCalculatorService;
 }
Exemple #16
0
 internal void Set(string key, int value)
 {
     EngineConfig.SetInt(Handle, key, value).Validate("Failed to set attribute");
 }
Exemple #17
0
 internal void Set(string key, string [] value)
 {
     EngineConfig.SetStringArray(Handle, key, value, value.Length).Validate("Failed to set attribute");
 }
Exemple #18
0
		public void SetUp ()
		{
			conn = (SqlConnection) ConnectionManager.Singleton.Connection;
			ConnectionManager.Singleton.OpenConnection ();
			cmd = conn.CreateCommand ();
			engine = ConnectionManager.Singleton.Engine;
		}
Exemple #19
0
 public CompositeElementProcessor(EngineConfig engineConfig, IImageProcessor imageProcessor, ILogger logger)
 {
     _paragraphsProcessor = new ParagraphsProcessor(engineConfig, imageProcessor, logger);
     _tablesProcessor     = new TablesProcessor(engineConfig, imageProcessor, logger);
 }
        public bool Setup()
        {
            // instantiate the Root singleton
            //engine = new Root( "AxiomEngine.log" );
            engine = new Root("EULog.txt");
            List<RenderSystem> renderSystems = new List<RenderSystem>(engine.RenderSystems.Values);
            //renderSystems[0]
            engine.RenderSystem = renderSystems[0];
            const string CONFIG_FILE = @"EngineConfig.xml";
            string resourceConfigPath = Path.GetFullPath(CONFIG_FILE);

            if (File.Exists(resourceConfigPath))
            {
                EngineConfig config = new EngineConfig();

                // load the config file
                // relative from the location of debug and releases executables
                config.ReadXml(CONFIG_FILE);

                // interrogate the available resource paths
                foreach (EngineConfig.FilePathRow row in config.FilePath)
                {
                    ResourceGroupManager.Instance.AddResourceLocation(Path.GetFullPath(row.src), row.type, row.group);
                }
            }

            // add event handlers for frame events
            engine.FrameStarted += OnFrameStarted;
            engine.FrameRenderingQueued += OnFrameRenderingQueued;
            engine.FrameEnded += OnFrameEnded;

            window = Root.Instance.Initialize(true, "Axiom Engine Demo Window");

            TechDemoListener rwl = new TechDemoListener(window);
            WindowEventMonitor.Instance.RegisterListener(window, rwl);

            ChooseSceneManager();
            CreateCamera();
            CreateViewports();

            // set default mipmap level
            TextureManager.Instance.DefaultMipmapCount = 5;

            // Create any resource listeners (for loading screens)
            this.CreateResourceListener();
            // Load resources
            this.LoadResources();

            scene.AmbientLight = ColorEx.Gray;
            scene.SetSkyBox(true, "AR/SpaceSkyBox", 500);
            //scene.SetSkyDome(true, "Examples/CloudySky", 5, 8);

            ParticleSystem smokeSystem =
                ParticleSystemManager.Instance.CreateSystem("SmokeSystem", "Examples/Smoke");

            // create an entity to have follow the path
            // create a scene node for the entity and attach the entity
            /*
             *             Entity ogreHead = scene.CreateEntity("OgreHead", "razor.mesh");
            SceneNode headNode = scene.RootSceneNode.CreateChildSceneNode(Vector3.Zero, Quaternion.Identity);
            headNode.AttachObject(ogreHead);
            */
            Entity razorEntity = scene.CreateEntity("Razor", "razor.mesh");
            SceneNode razorNode = scene.RootSceneNode.CreateChildSceneNode(Vector3.Zero, Quaternion.Identity);
            razorNode.AttachObject(razorEntity);
            razorNode.Pitch(90);

            Entity ogreHead = scene.CreateEntity("OgreHead", "spacevessel.mesh");
            SceneNode headNode = scene.RootSceneNode.CreateChildSceneNode(new Vector3(300,0,0), Quaternion.Identity);
            headNode.AttachObject(ogreHead);

            scene.RootSceneNode.CreateChildSceneNode(new Vector3(0,50,0)).AttachObject(smokeSystem);

            input = SetupInput();

            return true;
        }
Exemple #21
0
        public void DefaultEngineConfigSharedMemoryIsFalse()
        {
            var sut = new EngineConfig();

            Assert.False(sut.UseSharedMemory);
        }
		public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
			EngineConfig ds = new EngineConfig();
			global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
			global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
			global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny();
			any.Namespace = ds.Namespace;
			sequence.Items.Add(any);
			type.Particle = sequence;
			global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
			if (xs.Contains(dsSchema.TargetNamespace)) {
				global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
				global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
				try {
					global::System.Xml.Schema.XmlSchema schema = null;
					dsSchema.Write(s1);
					for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
						schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
						s2.SetLength(0);
						schema.Write(s2);
						if ((s1.Length == s2.Length)) {
							s1.Position = 0;
							s2.Position = 0;
							for (; ((s1.Position != s1.Length) 
										&& (s1.ReadByte() == s2.ReadByte())); ) {
								;
							}
							if ((s1.Position == s1.Length)) {
								return type;
							}
						}
					}
				}
				finally {
					if ((s1 != null)) {
						s1.Close();
					}
					if ((s2 != null)) {
						s2.Close();
					}
				}
			}
			xs.Add(dsSchema);
			return type;
		}
Exemple #23
0
        public void DefaultEngineConfigAlgorithmIsMld()
        {
            var sut = new EngineConfig();

            Assert.Equal(Algorithm.MLD, sut.Algorithm);
        }
 public void TestInvalidCacheRangeNotGreaterThanViewRangeWhenCacheExtraChunksIsOn()
 {
     var config = new EngineConfig { Cache = { CacheExtraChunks = true, ViewRange = 2, CacheRange = 2 } };
     config.Validate();
 }
Exemple #25
0
        /// <summary>
        /// Initializes the game.
        /// </summary>
        protected override void Initialize()
        {
            Logger.Trace("init()"); // log the init.
            this.Window.Title = string.Format("Voxeliq [{0}/{1}]", PlatformInfo.GameFramework, PlatformInfo.GraphicsApi); // set the window title.

            this.IsMouseVisible = false;

            // read settings.
            var audioSettings = new AudioSettings();
            var graphicsSettings = new GraphicsSettings();

            // create a new engine configuration.
            var config = new EngineConfig
            {
                Chunk =
                {
                    WidthInBlocks = 16,
                    HeightInBlocks = 128,
                    LenghtInBlocks = 16,
                },
                Cache =
                {
                    CacheExtraChunks = true,
                    ViewRange = 8,
                    CacheRange = 12,
                },
                Graphics =
                {
                    Width = graphicsSettings.Width,
                    Height = graphicsSettings.Height,
                    FullScreenEnabled = graphicsSettings.FullScreenEnabled,
                    VerticalSyncEnabled = graphicsSettings.VerticalSyncEnabled,
                    FixedTimeStepsEnabled = graphicsSettings.FixedTimeStepsEnabled,
                },
                World =
                {
                    IsInfinitive = true,
                },
                Debugging =
                {
                    GraphsEnabled = true,
                },
                Bloom =
                {
                    Enabled = false,
                    State = BloomState.Default,
                },
                Audio =
                {
                    Enabled = audioSettings.Enabled,
                }
            };

            var engine = new Engine(this, config);
            this.ScreenManager = new GraphicsManager(this._graphicsDeviceManager, this); // start the screen manager.

            engine.EngineStart += OnEngineStart;

            engine.Run();

            base.Initialize();
        }
 public void TestInvalidViewRangeNotEqualToCacheRangeWhenCacheExtraChunksIsOff()
 {
     var config = new EngineConfig { Cache = { CacheExtraChunks = false, ViewRange = 1, CacheRange = 2 } };
     config.Validate();
 }
Exemple #27
0
		public void SetUp ()
		{
			conn = (SqlConnection) ConnectionManager.Singleton.Connection;
			ConnectionManager.Singleton.OpenConnection ();
			engine = ConnectionManager.Singleton.Engine;
		}
 public void TestInvalidWidthInBlocksValue()
 {
     var config = new EngineConfig {Chunk = {WidthInBlocks = 0}};
     config.Validate();
 }
Exemple #29
0
 public void SetUp()
 {
     conn   = ConnectionManager.Instance.Sql.Connection;
     engine = ConnectionManager.Instance.Sql.EngineConfig;
 }
Exemple #30
0
 public ParagraphsProcessor(EngineConfig engineConfig, IImageProcessor imageProcessor, ILogger logger)
 {
     _engineConfig   = engineConfig;
     _imageProcessor = imageProcessor;
     _logger         = logger;
 }
        private IProcessor SetupConfig(IVariableCollection vc, params Phase[] phases)
        {
            EngineConfig cfg = new EngineConfig(_logger, vc, "$({0})");

            return(Processor.Create(cfg, new PhasedOperation(null, phases, true)));
        }
Exemple #32
0
 public static void ApplyDebugSettings()
 {
     EngineConfig.LoadConfig("resources/engine.settings.xml", typeof(GameEngine).Assembly, "Engine.Core");
 }
        //

        internal static void Init()
        {
            EngineConfig.RegisterClassParameters(typeof(EditorFavorites));
        }
Exemple #34
0
		public void SetUp ()
		{
			engine = ConnectionManager.Singleton.Engine;
		}
Exemple #35
0
        private static ArrayTemplate FindCompleteTemplate(this Token start, Table table, EngineConfig engineConfig)
        {
            var rowIndex = -1;

            foreach (var row in table.Rows())
            {
                rowIndex++;
                if (rowIndex < start.Position.RowIndex)
                {
                    continue;
                }

                var cellIndex = rowIndex == start.Position.RowIndex
                    ? start.Position.CellIndex
                    : 0;

                foreach (var cell in row.Cells().Skip(cellIndex))
                {
                    var end = cell.Paragraphs().ToArray().FindCloseToken(start, engineConfig, continueAfterOpenToken: false, rowIndex, cellIndex);
                    if (end != Token.None)
                    {
                        var openXmlTemplate = PrepareRowsTemplate(start, end, table.Rows());
                        return(new ArrayTemplate(start, end, openXmlTemplate));
                    }

                    cellIndex++;
                }
            }

            return(new ArrayTemplate(start, Token.None, OpenXmlTemplate.Empty));
        }