Beispiel #1
0
        public static void InitializeEmbedded(IServiceProvider services, bool loadMaterials)
        {
#if XBOX360
            _globalcontent = new ResourceContentManager(services,XBOXIceResources.ResourceManager); //Add root directory ?
#else
			#if !XNATOUCH
            _globalcontent = new ResourceContentManager(services, WINIceCreamResources.ResourceManager); //Add root directory ?
#endif
#endif

			#if !XNATOUCH
            String[] bloomShaders = { "BloomExtractEffect", "GaussianBlurEffect", "BloomCombineEffect" };
            DrawingManager.EmbeddedIceEffects[(int)EmbeddedIceEffectType.Bloom]
                .Load(SceneManager.GlobalContent, bloomShaders);
            String[] gaussianShaders = { "GaussianBlurEffect" };
            DrawingManager.EmbeddedIceEffects[(int)EmbeddedIceEffectType.GaussianBlur]
                .Load(SceneManager.GlobalContent, gaussianShaders);
            DrawingManager.RefractionLayerEffect = _globalcontent.Load<Effect>("RefractionLayerEffect");
			
            Texture2D _pixelTexture = new Texture2D(DrawingManager.GraphicsDevice, 
                1, 1, 0, TextureUsage.None, SurfaceFormat.Color);
            Color[] pixelColor = new Color[1];
            pixelColor[0] = Color.White;
            _pixelTexture.SetData<Color>(pixelColor);
            EmbeddedMaterials.Add(new Material("Pixel", _pixelTexture, AssetScope.Embedded));
            EmbeddedMaterials.Add(new Material("DefaultParticleMaterial",
                _globalcontent.Load<Texture2D>("DefaultParticleTexture"), AssetScope.Embedded));
            Material defaultTileGridMat = new Material("DefaultTileGridMaterial",
                _globalcontent.Load<Texture2D>("DefaultTileGridTexture"), AssetScope.Embedded);            
            // load default areas of the texture            
            defaultTileGridMat.Areas.Add("1", new Rectangle(0, 0, 32, 32));
            defaultTileGridMat.Areas.Add("2", new Rectangle(34, 0, 32, 32));
            defaultTileGridMat.Areas.Add("3", new Rectangle(0, 34, 32, 32));
            defaultTileGridMat.Areas.Add("4", new Rectangle(34, 34, 32, 32));
            EmbeddedMaterials.Add(defaultTileGridMat);
            EmbeddedMaterials.Add(new Material("BlankMaterial",
                _globalcontent.Load<Texture2D>("blank"), AssetScope.Embedded));

            EmbeddedFonts.Add(new IceFont("DefaultFont",
                _globalcontent.Load<SpriteFont>("Arial"), AssetScope.Embedded));

            EmbeddedFonts.Add(new IceFont("DiagnosticFont",
                _globalcontent.Load<SpriteFont>("diagnosticFont"), AssetScope.Embedded));
			#else
			Texture2D _pixelTexture = Texture2D.FromFile(DrawingManager.GraphicsDevice, "Content/pixel.png");
			EmbeddedMaterials.Add(new Material("Pixel", _pixelTexture, AssetScope.Embedded));
			#endif
        }
 private void SelectTexture(Material material)
 {
     _selectedMaterial = material;
     materialPreviewControl.Texture = material.Texture;          
 }
 private void PreviewMaterial(Material material)
 {
     textBoxSourceRectanglesXML.Text = _selectedMaterial.AreasDefinitionFilename;
     materialPreviewControl.Texture = material.Texture;
 }
 private void toolStripButtonAddMaterial_Click(object sender, EventArgs e)
 {
     String newMaterialName;
     // TO-DO: replace this with a unique name generator
     newMaterialName = "New Material";
     Material newMaterial = new Material(newMaterialName, 
         SceneManager.EmbeddedMaterials[0].Texture,
         (_showLocalTextures?AssetScope.Local:AssetScope.Global));
     if (newMaterial.Scope == AssetScope.Local)
     {
         newMaterial.Parent = SceneManager.ActiveScene;
     }
     else
     {
         newMaterial.Parent = SceneManager.GlobalDataHolder;
     }
     _materialList.Add(newMaterial);
     LoadNodes(true);
 }
 private void SelectTexture(Material material)
 {
     _selectedMaterial = material;
     txtName.Text = material.Name;
     PreviewMaterial(material);
 }