コード例 #1
0
        public override void Draw(float elapsed)
        {
            if (!this.Visible)
            {
                return;
            }
            if (this.Shadow == true)
            {
                DrawRequest _drawRequestShadow = new DrawRequest();
                //_drawRequest.font = this.Material.Texture;
                _drawRequestShadow.position   = this.Position + new Vector2(3, 2);
                _drawRequestShadow.rotation   = this.Rotation;
                _drawRequestShadow.scaleRatio = this.Scale;
                Color shadowColor = Color.Black;
                shadowColor.A                      = _opacity;
                _drawRequestShadow.tint            = shadowColor;
                _drawRequestShadow.font            = _font.Font;
                _drawRequestShadow.text            = Text;
                _drawRequestShadow.isFont          = true;
                _drawRequestShadow.textSize        = this.BoundingRectSize;
                _drawRequestShadow.pivot           = Pivot;
                _drawRequestShadow.isPivotRelative = this.IsPivotRelative;
                DrawingManager.DrawOnLayer(_drawRequestShadow, this.Layer, _blendingType);
            }
            //_drawRequest.font = this.Material.Texture;
            _drawRequest.position   = this.Position;
            _drawRequest.rotation   = this.Rotation;
            _drawRequest.scaleRatio = this.Scale;
            if (_font == null)
            {
                _font = SceneManager.GetEmbeddedFont("DefaultFont");
            }
            _drawRequest.font            = _font.Font;
            _drawRequest.isFont          = true;
            _drawRequest.textSize        = this.BoundingRectSize;
            _drawRequest.text            = this.Text;
            _drawRequest.isPivotRelative = this.IsPivotRelative;
            _drawRequest.pivot           = this.Pivot;
            DrawingManager.DrawOnLayer(_drawRequest, this.Layer, _blendingType);

            base.Draw(elapsed);
        }
コード例 #2
0
ファイル: TextItem.cs プロジェクト: schminitz/IceCreamXNA
        public override void Draw(float elapsed)
        {
            if (!this.Visible)
            {
                return;
            }
            if (this.Shadow == true)
            {
                DrawRequest _drawRequestShadow = new DrawRequest();
                //_drawRequest.font = this.Material.Texture;
                _drawRequestShadow.position = this.Position + new Vector2(3, 2);
                _drawRequestShadow.rotation = this.Rotation;
                _drawRequestShadow.scaleRatio = this.Scale;
                Color shadowColor = Color.Black;
                shadowColor.A = _opacity;
                _drawRequestShadow.tint = shadowColor;
                _drawRequestShadow.font = _font.Font;
                _drawRequestShadow.text = Text;
                _drawRequestShadow.isFont = true;
                _drawRequestShadow.textSize = this.BoundingRectSize;
                _drawRequestShadow.pivot = Pivot;
                _drawRequestShadow.isPivotRelative = this.IsPivotRelative;
                DrawingManager.DrawOnLayer(_drawRequestShadow, this.Layer, _blendingType);
            }
            //_drawRequest.font = this.Material.Texture;
            _drawRequest.position = this.Position;
            _drawRequest.rotation = this.Rotation;
            _drawRequest.scaleRatio = this.Scale;
            if (_font == null)
            {
                _font = SceneManager.GetEmbeddedFont("DefaultFont");
            }
            _drawRequest.font = _font.Font;
            _drawRequest.isFont = true;
            _drawRequest.textSize = this.BoundingRectSize;
            _drawRequest.text = this.Text;
            _drawRequest.isPivotRelative = this.IsPivotRelative;
            _drawRequest.pivot = this.Pivot;
            DrawingManager.DrawOnLayer(_drawRequest, this.Layer, _blendingType);

            base.Draw(elapsed);
        }
コード例 #3
0
ファイル: SceneSerializer.cs プロジェクト: dekk7/xEngine
        private static void LoadAssets(XmlDocument doc, SceneBase scene)
        {
            string _lastValidName = "";
            try
            {
                XmlNode _el = doc.SelectSingleNode("IceScene/Assets");
                int _count = _el.ChildNodes.Count;
                int _current = 0;
                foreach (XmlNode _node in _el.ChildNodes)
                {
                    _current++;
                    int perc = (int)((double)_current / (double)_count * 100); ;
                    FireStatusUpdate(string.Format("Loading Asset {0}/{1}", _current, _count), perc);

                    IceAsset asset = null;
                    if (_node.Name.ToUpper() == "MATERIAL")
                    {
                        Material newMat = new Material();
                        asset = newMat;
                        scene.Materials.Add(newMat);
                        TraceLogger.TraceInfo("Loading Material");
                        if (_node.Attributes.GetNamedItem("areas_definition") != null)
                        {
                            newMat.AreasDefinitionFilename
                                = _node.Attributes["areas_definition"].InnerText;
                            String definitionPath = Path.Combine(SceneSerializer.RootPath, newMat.AreasDefinitionFilename);
                            TraceLogger.TraceVerbose("Loading AreasDefinitionFilename: " + newMat.AreasDefinitionFilename);
                            newMat.LoadAreasDefinition(definitionPath);
                        }
                    }
                    else if (_node.Name.ToUpper() == "FONT")
                    {
                        asset = new IceFont();
                        scene.Fonts.Add(asset as IceFont);
                        TraceLogger.TraceInfo("Loading Font");
                    }
                    else if (_node.Name.ToUpper() == "EFFECT")
                    {
						#if !XNATOUCH
                        asset = CreateEffectInstance(_node.Attributes["type"].InnerText);
                        scene.Effects.Add(asset as IceEffect);
                        TraceLogger.TraceInfo("Loading Effect");
#endif
                    }
                    else if (_node.Name.ToUpper() == "TILESHEET")
                    {
                        TileSheet newTileSheet = LoadTileSheet(_node, scene);
                        asset = newTileSheet;
                        scene.TileSheets.Add(newTileSheet);                       
                        TraceLogger.TraceInfo("Loading TileSheet");
                    }
                    asset.Scope = AssetScope.Local;
                    if (scene == SceneManager.GlobalDataHolder)
                    {
                        asset.Scope = AssetScope.Global;
                    }
                    asset.Parent = scene;
                    asset.Name = _node.Attributes["name"].InnerText;
                    _lastValidName = asset.Name;
                    if (_node.Attributes.GetNamedItem("location") != null)
                    {
                        asset.Filename = _node.Attributes["location"].InnerText;
                    }
                    else
                    {
                        asset.Filename = "";
                    }
                    TraceLogger.TraceInfo("Name : " + asset.Name);
                    TraceLogger.TraceVerbose("FileName : " + asset.Filename);
                    TraceLogger.TraceVerbose("Scope : " + asset.Scope.ToString());
                }
            }
            catch (Exception err)
            {
                if (err != null)
                {
                    #if(WINDOWS)
                    Trace.TraceError("ERROR In Load Assets - " + _lastValidName);
                    #endif
                    throw new ArgumentException("Error in load materials: " + err.Message);
                }
            }
        }