コード例 #1
0
        /// <summary>
        /// creates a FreeTypeFont
        /// </summary>
        /// <param name="attributes"></param>
        private void CreateFreeTypeFont(XMLAttributes attributes)
        {
#if CEGUI_HAS_FREETYPE
            var name           = attributes.GetValueAsString(FontNameAttribute);
            var filename       = attributes.GetValueAsString(FontFilenameAttribute);
            var resource_group = attributes.GetValueAsString(FontResourceGroupAttribute);

            Logger.LogInsane("---- CEGUI font name: " + name);
            Logger.LogInsane("----       Font type: FreeType");
            Logger.LogInsane("----     Source file: " + filename + " in resource group: " +
                             (String.IsNullOrEmpty(resource_group)
                                          ? "(Default)"
                                          : resource_group));
            Logger.LogInsane("---- Real point size: " + attributes.GetValueAsString(FontSizeAttribute, "12"));

            _font = new FreeTypeFont(name,
                                     attributes.GetValueAsFloat(FontSizeAttribute, 12.0f),
                                     attributes.GetValueAsBool(FontAntiAliasedAttribute, true),
                                     filename, resource_group,
                                     PropertyHelper.FromString <AutoScaledMode>(attributes.GetValueAsString(FontAutoScaledAttribute)),
                                     new Sizef(attributes.GetValueAsFloat(FontNativeHorzResAttribute, 640.0f),
                                               attributes.GetValueAsFloat(FontNativeVertResAttribute, 480.0f)),
                                     attributes.GetValueAsFloat(FontLineSpacingAttribute, 0.0f));
#else
            throw new InvalidRequestException("CEGUI was compiled without freetype support.");
#endif
        }
コード例 #2
0
        public AnimationDefinitionHandler(XMLAttributes attributes, string namePrefix)
        {
            _anim = null;

            var animName = namePrefix + attributes.GetValueAsString(NameAttribute);

            Logger.LogInsane(
                "Defining animation named: " +
                animName +
                "  Duration: " +
                attributes.GetValueAsString(DurationAttribute) +
                "  Replay mode: " +
                attributes.GetValueAsString(ReplayModeAttribute) +
                "  Auto start: " +
                attributes.GetValueAsString(AutoStartAttribute, "false"));

            _anim = AnimationManager.GetSingleton().CreateAnimation(animName);

            _anim.SetDuration(attributes.GetValueAsFloat(DurationAttribute));

            var replayMode = attributes.GetValueAsString(ReplayModeAttribute, ReplayModeLoop);

            if (replayMode == ReplayModeOnce)
            {
                _anim.SetReplayMode(Animation.ReplayMode.Once);
            }
            else if (replayMode == ReplayModeBounce)
            {
                _anim.SetReplayMode(Animation.ReplayMode.Bounce);
            }
            else
            {
                _anim.SetReplayMode(Animation.ReplayMode.Loop);
            }

            _anim.SetAutoStart(attributes.GetValueAsBool(AutoStartAttribute));
        }