コード例 #1
0
ファイル: FLabelAnimate.cs プロジェクト: tanis2000/Futile
    protected int _startVisibleCharIdx = 0; //idx included

    #endregion Fields

    #region Constructors

    public FLabelAnimate(string fontName, string text, bool startVisible=false, FTextParams textParams=null)
        : base(fontName, text, textParams==null?new FTextParams():textParams)
    {
        if (startVisible) {
            _endVisibleCharIdx=text.Length;
        }
    }
コード例 #2
0
    public void LoadFont(string name, string elementName, string configPath, FTextParams fontTextParams)
    {
        FAtlasElement element = GetElementWithName(elementName);
        FFont         font    = new FFont(name, element, configPath, fontTextParams);

        _fonts.Add(font);
        _fontsByName.Add(name, font);
    }
コード例 #3
0
ファイル: FFont.cs プロジェクト: GeekAndDad/Futile
    public FFont(string name, FAtlasElement element, string configPath, FTextParams fontTextParams)
    {
        _name = name;
        _element = element;
        _configPath = configPath;
        _fontTextParams = fontTextParams;

        LoadAndParseConfigFile();
    }
コード例 #4
0
    public FFont(string name, FAtlasElement element, string configPath, FTextParams fontTextParams)
    {
        _name           = name;
        _element        = element;
        _configPath     = configPath;
        _fontTextParams = fontTextParams;

        LoadAndParseConfigFile();
    }
コード例 #5
0
ファイル: FFont.cs プロジェクト: wtrebella/ImmunityGame
    public FFont(string name, FAtlasElement element, string configPath, float offsetX, float offsetY, FTextParams textParams)
    {
        _name       = name;
        _element    = element;
        _configPath = configPath;
        _textParams = textParams;
        _offsetX    = offsetX;
        _offsetY    = offsetY;

        LoadAndParseConfigFile();
    }
コード例 #6
0
ファイル: FFont.cs プロジェクト: MrPhil/Futile
    public FFont(string name, FAtlasElement element, string configPath, float offsetX, float offsetY, FTextParams textParams)
    {
        _name = name;
        _element = element;
        _configPath = configPath;
        _textParams = textParams;
        _offsetX = offsetX;
        _offsetY = offsetY;

        LoadAndParseConfigFile();
    }
コード例 #7
0
    public FFont(string name, FAtlasElement element, string configPath, float offsetX, float offsetY, FTextParams textParams)
    {
        _name       = name;
        _element    = element;
        _configPath = configPath;
        _textParams = textParams;
        _offsetX    = offsetX * Futile.displayScale / Futile.resourceScale;
        _offsetY    = offsetY * Futile.displayScale / Futile.resourceScale;

        LoadAndParseConfigFile();
    }
コード例 #8
0
ファイル: FLabel.cs プロジェクト: maggardJosh/NinjaCircuit
	public FLabel (string fontName, string text, FTextParams textParams) : base()
	{
		_fontName = fontName;
		_text = text;
		_font = Futile.atlasManager.GetFontWithName(_fontName);
		_textParams = textParams;

		Init(FFacetType.Quad, _font.element, 0);

		CreateTextQuads();
	}
コード例 #9
0
    public FLabel(string fontName, string text, FTextParams textParams) : base()
    {
        _fontName   = fontName;
        _text       = text;
        _font       = Futile.atlasManager.GetFontWithName(_fontName);
        _textParams = textParams;

        Init(FFacetType.Quad, _font.element, 0);

        CreateTextQuads();
    }
コード例 #10
0
ファイル: TOFonts.cs プロジェクト: BoarK/BewareWolf
    private static void LoadFont(string fontName, float offsetX, float offsetY,float lineHeightOffset, float kerningOffset)
    {
        //offsetY -= 1f; //they're all off by 1
        offsetY -= 2f;
        lineHeightOffset -= 6;

        FTextParams textParams;

        textParams = new FTextParams();
        textParams.kerningOffset = kerningOffset;
        textParams.lineHeightOffset = lineHeightOffset;

        Futile.atlasManager.LoadFont(fontName,"Fonts/"+fontName, "Fonts/"+fontName, offsetX,offsetY,textParams);
    }
コード例 #11
0
ファイル: TOFonts.cs プロジェクト: MattRix/BewareWolf
    private static void LoadFont(string fontName, float offsetX, float offsetY, float lineHeightOffset, float kerningOffset)
    {
        //offsetY -= 1f; //they're all off by 1
        offsetY          -= 2f;
        lineHeightOffset -= 6;

        FTextParams textParams;

        textParams = new FTextParams();
        textParams.kerningOffset    = kerningOffset;
        textParams.lineHeightOffset = lineHeightOffset;

        Futile.atlasManager.LoadFont(fontName, "Fonts/" + fontName, "Fonts/" + fontName, offsetX, offsetY, textParams);
    }
コード例 #12
0
ファイル: FButton.cs プロジェクト: MattRix/BewareWolf
    virtual public FLabel AddLabel(string fontName, string text, FTextParams textParams, Color color)
    {
        if (_label != null)
        {
            RemoveChild(_label);
        }

        _label = new FLabel(fontName, text, textParams);
        AddChild(_label);
        _label.color   = color;
        _label.anchorX = _label.anchorY = 0.5f;
        _label.x       = -_anchorX * _sprite.width + _sprite.width / 2;
        _label.y       = -_anchorY * _sprite.height + _sprite.height / 2;

        return(_label);
    }
コード例 #13
0
    // Use this for initialization
    void Start()
    {
        //instance = this;

        Go.defaultEaseType       = EaseType.Linear;
        Go.duplicatePropertyRule = DuplicatePropertyRuleType.RemoveRunningProperty;

        bool landscape = true;
        bool portrait  = false;

        bool isIPad = SystemInfo.deviceModel.Contains("iPad");
        bool shouldSupportPortraitUpsideDown = isIPad && portrait;         //only support portrait upside-down on iPad

        FutileParams fparams = new FutileParams(landscape, landscape, portrait, shouldSupportPortraitUpsideDown);

        fparams.backgroundColor = new Color(0.1f, 0.1f, 0.1f);

        fparams.AddResolutionLevel(480.0f, 1.0f, 1.0f, "_Scale1");                  //iPhone
        fparams.AddResolutionLevel(960.0f, 2.0f, 2.0f, "_Scale2");                  //iPhone retina
        fparams.AddResolutionLevel(1024.0f, 2.0f, 2.0f, "_Scale2");                 //iPad
        fparams.AddResolutionLevel(1280.0f, 2.0f, 2.0f, "_Scale2");                 //Nexus 7
        fparams.AddResolutionLevel(2048.0f, 4.0f, 4.0f, "_Scale4");                 //iPad Retina

        fparams.origin = new Vector2(0.0f, 0.0f);

        Futile.instance.Init(fparams);

        Futile.atlasManager.LoadAtlas("Atlases/UIFonts");
        Futile.atlasManager.LoadAtlas("Atlases/GameAtlas");

        FPWorld.Create(64.0f);

        FTextParams textParams;

        textParams = new FTextParams();
        textParams.lineHeightOffset = -8.0f;
        Futile.atlasManager.LoadFont("Franchise", "FranchiseFont" + Futile.resourceSuffix, "Atlases/FranchiseFont" + Futile.resourceSuffix, -2.0f, -5.0f, textParams);

        textParams = new FTextParams();
        textParams.kerningOffset    = -0.5f;
        textParams.lineHeightOffset = -8.0f;
        Futile.atlasManager.LoadFont("CubanoInnerShadow", "Cubano_InnerShadow" + Futile.resourceSuffix, "Atlases/CubanoInnerShadow" + Futile.resourceSuffix, 0.0f, 2.0f, textParams);

        GoToPage(PageType.BitmaskPuzzleShapesGame);
    }
コード例 #14
0
ファイル: FPseudoHtmlText.cs プロジェクト: tanis2000/Futile
    public FPseudoHtmlText(string fontName, string text, FTextParams textParams, float maxWidth, PseudoHtmlTextAlign align, float lineOffset,object actionsDelegate)
    {
        _fontName = fontName;
        _text = text.Replace("\n"," ");
        _textParams = textParams;
        _maxWidth = maxWidth;
        _align=align;
        _lineOffset=lineOffset;
        _actionsDelegate=actionsDelegate;

        _stylesStack=new List<Dictionary<string, string>>();
        PushDefaultStyles();

        _buttonActions=new Dictionary<FButton, string>();

        _contentContainer = new FContainer ();
        AddChild (_contentContainer);

        Update ();
    }
コード例 #15
0
ファイル: FButton.cs プロジェクト: maggardJosh/NinjaCircuit
	virtual public FLabel AddLabel (string fontName, string text, FTextParams textParams, Color color)
	{
		if(_label != null) 
		{
			RemoveChild(_label);
		}

		_label = new FLabel(fontName, text, textParams);
		AddChild(_label);
		_label.color = color;
		_label.anchorX = _label.anchorY = 0.5f;
		_label.x = -_anchorX*_sprite.width+_sprite.width/2;
		_label.y = -_anchorY*_sprite.height+_sprite.height/2;
		
		return _label;
	}
コード例 #16
0
ファイル: FFont.cs プロジェクト: MrPhil/Futile
    public FLetterQuadLine[] GetQuadInfoForText(string text, FTextParams textParams)
    {
        int lineCount = 0;
        int letterCount = 0;

        char[] letters = text.ToCharArray();

        //at some point these should probably be pooled and reused so we're not allocing new ones all the time
        FLetterQuadLine[] lines = new FLetterQuadLine[10];

        int lettersLength = letters.Length;
        for(int c = 0; c<lettersLength; ++c)
        {
            char letter = letters[c];

            if(letter == ASCII_NEWLINE)
            {
                lines[lineCount] = new FLetterQuadLine();
                lines[lineCount].letterCount = letterCount;
                lines[lineCount].quads = new FLetterQuad[letterCount];

                lineCount++;
                letterCount = 0;
            }
            else
            {
                letterCount++;
            }
        }

        lines[lineCount] = new FLetterQuadLine();
        lines[lineCount].letterCount = letterCount;
        lines[lineCount].quads = new FLetterQuad[letterCount];

        FLetterQuadLine[] oldLines = lines;
        lines = new FLetterQuadLine[lineCount+1];

        for(int c = 0; c<lineCount+1; ++c)
        {
            lines[c] = oldLines[c];
        }

        lineCount = 0;
        letterCount = 0;

        float nextX = 0;
        float nextY = 0;

        FCharInfo charInfo;

        char previousLetter = '\0';

        float minX = 100000;
        float maxX = -100000;
        float minY = 100000;
        float maxY = -100000;

        float usableLineHeight = _lineHeight + textParams.scaledLineHeightOffset + _textParams.scaledLineHeightOffset;

        for(int c = 0; c<lettersLength; ++c)
        {
            char letter = letters[c];

            if(letter == ASCII_NEWLINE)
            {
                lines[lineCount].bounds = new Rect(minX,minY,maxX-minX,maxY-minY);

                minX = 100000;
                maxX = -100000;
                minY = 100000;
                maxY = -100000;

                nextX = 0;
                nextY -= usableLineHeight;

                lineCount++;
                letterCount = 0;
            }
            else
            {
                FKerningInfo foundKerning = _nullKerning;

                for(int k = 0; k<_kerningCount; k++)
                {
                    FKerningInfo kerningInfo = _kerningInfos[k];
                    if(kerningInfo.first == previousLetter && kerningInfo.second == letter)
                    {
                        foundKerning = kerningInfo;
                    }
                }

                //TODO: Reuse letterquads with pooling!
                FLetterQuad letterQuad = new FLetterQuad();

                if(_charInfosByID.ContainsKey(letter))
                {
                    charInfo = _charInfosByID[letter];
                }
                else //we don't have that character in the font
                {
                    //blank,  character (could consider using the "char not found square")
                    charInfo = _charInfosByID[0];
                }

                float totalKern = foundKerning.amount + textParams.scaledKerningOffset + _textParams.scaledKerningOffset;

                nextX += totalKern;

                letterQuad.charInfo = charInfo;

                Rect quadRect = new Rect(nextX + charInfo.offsetX, nextY - charInfo.offsetY - charInfo.height, charInfo.width, charInfo.height);

                letterQuad.rect = quadRect;

                lines[lineCount].quads[letterCount] = letterQuad;

                minX = Math.Min (minX, quadRect.xMin);
                maxX = Math.Max (maxX, quadRect.xMax);
                maxY = Math.Max (maxY, nextY);

                minY = Math.Min (minY, nextY - usableLineHeight);

        //				minY = Math.Min (minY, quadRect.yMin);
        //				maxY = Math.Max (maxY, quadRect.yMax);

                nextX += charInfo.xadvance;

                letterCount++;
            }

            previousLetter = letter;
        }

        lines[lineCount].bounds = new Rect(minX,minY,maxX-minX,maxY-minY);

        return lines;
    }
コード例 #17
0
    public void LoadFont(string name, string elementName, string configPath, float offsetX, float offsetY, FTextParams textParams)
    {
        FAtlasElement element = GetElementWithName(elementName);
        FFont font = new FFont(name,element,configPath, offsetX, offsetY, textParams);

        _fonts.Add(font);
        _fontsByName.Add (name, font);
    }
コード例 #18
0
ファイル: TMain.cs プロジェクト: hassanLastborn/Tether
    private void Start()
    {
        instance = this;

        Go.defaultEaseType = EaseType.Linear;
        Go.duplicatePropertyRule = DuplicatePropertyRuleType.RemoveRunningProperty;

        //Screen.showCursor = false;

        //Time.timeScale = 0.1f;

        bool landscape = true;
        bool portrait = false;

        bool isIPad = SystemInfo.deviceModel.Contains("iPad");
        bool shouldSupportPortraitUpsideDown = isIPad && portrait; //only support portrait upside-down on iPad

        FutileParams fparams = new FutileParams(landscape, landscape, portrait, shouldSupportPortraitUpsideDown);

        fparams.backgroundColor = RXUtils.GetColorFromHex(0x000000); //light blue 0x94D7FF or 0x74CBFF

        //fparams.AddResolutionLevel(2560.0f,	2.0f,	2.0f,	""); //1280x720
        //fparams.AddResolutionLevel(1280.0f,	1.0f,	2.0f,	""); //1280x720
        fparams.AddResolutionLevel(1920.0f,	1.5f,	2.0f,	""); //1920x1080
        fparams.AddResolutionLevel(960.0f,	0.75f,	2.0f,	""); //960x540

        fparams.origin = new Vector2(0.5f,0.5f);

        Futile.instance.Init (fparams);

        Futile.atlasManager.LoadAtlas("Atlases/UIAtlas");
        Futile.atlasManager.LoadAtlas("Atlases/UIFonts");
        Futile.atlasManager.LoadAtlas("Atlases/BackgroundAtlas");
        Futile.atlasManager.LoadAtlas("Atlases/GameAtlas");

        FTextParams textParams;

        textParams = new FTextParams();
        textParams.lineHeightOffset = -8.0f;
        Futile.atlasManager.LoadFont("Franchise","FranchiseFont", "Atlases/FranchiseFont", -2.0f,-5.0f,textParams);

        textParams = new FTextParams();
        textParams.kerningOffset = -0.5f;
        textParams.lineHeightOffset = -8.0f;
        Futile.atlasManager.LoadFont("CubanoInnerShadow","Cubano_InnerShadow", "Atlases/CubanoInnerShadow", 0.0f,2.0f,textParams);

        textParams = new FTextParams();
        textParams.lineHeightOffset = -8.0f;
        textParams.kerningOffset = -0.5f;
        Futile.atlasManager.LoadFont("CubanoBig","Cubano136", "Atlases/Cubano136", 0.0f,2.0f,textParams);

        GamepadManager.Init();
        GameManager.Init();

        _stage = Futile.stage;

        _stage.AddChild(background = new Background());

        GoToPage(TPageType.PagePlayerSelect);

        _stage.ListenForUpdate (HandleUpdate);

        FSoundManager.isMuted = !GameConfig.IS_SOUND_ON;

        _stage.ListenForResize(HandleResize);
    }
コード例 #19
0
ファイル: SKMain.cs プロジェクト: MattRix/ScorekeeperX
    private void Start()
    {
        Go.defaultEaseType = EaseType.Linear;
        Go.duplicatePropertyRule = DuplicatePropertyRuleType.RemoveRunningProperty;

        // Uncomment if you need to delete bad save data on startup
        // PlayerPrefs.DeleteAll();

        //Time.timeScale = 0.1f; //use for checking timings of things in slow motion

        //only support portrait
        FutileParams fparams = new FutileParams(true, true, false, true);

        fparams.backgroundColor = RXUtils.GetColorFromHex(0x050122);
        fparams.shouldLerpToNearestResolutionLevel = false;
        fparams.resolutionLevelPickMode = FResolutionLevelPickMode.Closest;

        bool shouldHaveScale1 = true;
        bool shouldHaveScale2 = true;
        bool shouldHaveScale4 = true;

        #if UNITY_WEBPLAYER
        //webplayer has everything but scale2 stripped out
        shouldHaveScale1 = false;
        shouldHaveScale4 = false;
        #endif

        if(shouldHaveScale1) fparams.AddResolutionLevel(480.0f,		1.0f,	1.0f,	"_Scale1"); //iPhone
        if(shouldHaveScale2) fparams.AddResolutionLevel(960.0f,		2.0f,	2.0f,	"_Scale2"); //iPhone retina
        if(shouldHaveScale2) fparams.AddResolutionLevel(1024.0f,	2.0f,	2.0f,	"_Scale2"); //iPad
        if(shouldHaveScale2) fparams.AddResolutionLevel(1136.0f,	2.0f,	2.0f,	"_Scale2"); //iPhone 5 retina
        if(shouldHaveScale2) fparams.AddResolutionLevel(1280.0f,	2.0f,	2.0f,	"_Scale2"); //Nexus 7
        if(shouldHaveScale4) fparams.AddResolutionLevel(2048.0f,	4.0f,	4.0f,	"_Scale4"); //iPad Retina

        //FOR SCREENSHOTS
        //		if(shouldHaveScale1) fparams.AddResolutionLevel(480.0f,		1.0f,	2.0f,	"_Scale2"); //iPhone
        //		if(shouldHaveScale2) fparams.AddResolutionLevel(960.0f,		2.0f,	2.0f,	"_Scale2"); //iPhone retina
        //		if(shouldHaveScale2) fparams.AddResolutionLevel(1024.0f,	2.0f,	4.0f,	"_Scale4"); //iPad
        //		if(shouldHaveScale2) fparams.AddResolutionLevel(1136.0f,	2.0f,	4.0f,	"_Scale4"); //iPhone 5 retina
        //		if(shouldHaveScale2) fparams.AddResolutionLevel(1280.0f,	2.0f,	4.0f,	"_Scale4"); //Nexus 7
        //		if(shouldHaveScale4) fparams.AddResolutionLevel(2048.0f,	4.0f,	4.0f,	"_Scale4"); //iPad Retina

        fparams.origin = new Vector2(0.5f,0.5f);

        Futile.instance.Init (fparams);

        Futile.atlasManager.LoadAtlas("Atlases/MainAtlas");
        //Futile.atlasManager.LoadImage("Atlases/Fonts/Raleway");
        //Futile.atlasManager.LoadImage("Atlases/Fonts/Ostrich");

        FTextParams textParams;

        textParams = new FTextParams();
        textParams.kerningOffset = -0.0f;
        textParams.lineHeightOffset = -15.0f;
        Futile.atlasManager.LoadFont("Raleway","Fonts/Raleway"+Futile.resourceSuffix, "Atlases/Fonts/Raleway"+Futile.resourceSuffix, -1.0f,-1.0f,textParams);

        //
        //		textParams = new FTextParams();
        //		textParams.kerningOffset = -0.0f;
        //		textParams.lineHeightOffset = -15.0f;
        //		Futile.atlasManager.LoadFont("Ostrich","Atlases/Fonts/Ostrich", "Atlases/Fonts/Ostrich"+Futile.resourceSuffix, 0.0f,-2.0f,textParams);
        //
        for(int s = 0; s<10; s++)
        {
            FSoundManager.PreloadSound("Musical/Note"+s+"_bass");
            FSoundManager.PreloadSound("Musical/Note"+s+"_normal");
        }

        Futile.stage.AddChild(new Keeper()); //keeper statically retains itself and never gets removed
    }
コード例 #20
0
ファイル: FFont.cs プロジェクト: GeekAndDad/Futile
    public FLetterQuadLine[] GetQuadInfoForText(string text, FTextParams textParams)
    {
        int lineCount = 0;
        int letterCount = 0;

        char[] letters = text.ToCharArray();

        FLetterQuadLine[] lines = new FLetterQuadLine[10];

        for(int c = 0; c<letters.Length; ++c)
        {
            char letter = letters[c];

            if(letter == ASCII_NEWLINE)
            {
                lines[lineCount] = new FLetterQuadLine();
                lines[lineCount].letterCount = letterCount;
                lines[lineCount].quads = new FLetterQuad[letterCount];

                lineCount++;
                letterCount = 0;
            }
            else
            {
                letterCount++;
            }
        }

        lines[lineCount] = new FLetterQuadLine();
        lines[lineCount].letterCount = letterCount;
        lines[lineCount].quads = new FLetterQuad[letterCount];

        FLetterQuadLine[] oldLines = lines;
        lines = new FLetterQuadLine[lineCount+1];

        for(int c = 0; c<lineCount+1; ++c)
        {
            lines[c] = oldLines[c];
        }

        lineCount = 0;
        letterCount = 0;

        float nextX = 0;
        float nextY = 0;

        FCharInfo charInfo;

        char previousLetter = '\0';

        float minX = 100000;
        float maxX = -100000;
        float minY = 100000;
        float maxY = -100000;

        for(int c = 0; c<letters.Length; ++c)
        {
            char letter = letters[c];

            if(letter == ASCII_NEWLINE)
            {
                lines[lineCount].bounds = new Rect(minX,minY,maxX-minX,maxY-minY);

                minX = 100000;
                maxX = -100000;
                minY = 100000;
                maxY = -100000;

                nextX = 0;
                nextY -= _lineHeight + textParams.scaledLineHeightOffset + _fontTextParams.scaledLineHeightOffset;

                lineCount++;
                letterCount = 0;
            }
            else
            {
                FKerningInfo foundKerning = _nullKerning;

                foreach(FKerningInfo kerningInfo in _kerningInfos)
                {
                    if(kerningInfo.first == previousLetter && kerningInfo.second == letter)
                    {
                        foundKerning = kerningInfo;
                    }
                }

                //TODO: Reuse letterquads with pooling!
                FLetterQuad letterQuad = new FLetterQuad();

                charInfo = _charInfosByID[letter];

                float totalKern = foundKerning.amount + textParams.scaledKerningOffset + _fontTextParams.scaledKerningOffset;

                nextX += totalKern;

                letterQuad.charInfo = charInfo;
                //
                Rect quadRect = new Rect(nextX + charInfo.offsetX, nextY - charInfo.offsetY - charInfo.height, charInfo.width, charInfo.height);

                letterQuad.rect = quadRect;

                lines[lineCount].quads[letterCount] = letterQuad;

                minX = Math.Min (minX, quadRect.xMin);
                maxX = Math.Max (maxX, quadRect.xMax);
                minY = Math.Min (minY, quadRect.yMin);
                maxY = Math.Max (maxY, quadRect.yMax);

                nextX += charInfo.xadvance;

                letterCount++;
            }

            previousLetter = letter;
        }

        lines[lineCount].bounds = new Rect(minX,minY,maxX-minX,maxY-minY);

        return lines;
    }
コード例 #21
0
    public FFont(string name, FAtlasElement element, string configPath, float offsetX, float offsetY, FTextParams textParams)
    {
        _name = name;
        _element = element;
        _configPath = configPath;
        _textParams = textParams;
        _offsetX = offsetX * Futile.displayScale / Futile.resourceScale;
        _offsetY = offsetY * Futile.displayScale / Futile.resourceScale;

        LoadAndParseConfigFile();
    }
コード例 #22
0
    // Use this for initialization
    void Start()
    {
        //instance = this;

        Go.defaultEaseType = EaseType.Linear;
        Go.duplicatePropertyRule = DuplicatePropertyRuleType.RemoveRunningProperty;

        bool landscape = true;
        bool portrait = false;

        bool isIPad = SystemInfo.deviceModel.Contains("iPad");
        bool shouldSupportPortraitUpsideDown = isIPad && portrait; //only support portrait upside-down on iPad

        FutileParams fparams = new FutileParams(landscape, landscape, portrait, shouldSupportPortraitUpsideDown);

        fparams.backgroundColor = new Color(0.1f, 0.1f, 0.1f);

        fparams.AddResolutionLevel(480.0f,	1.0f,	1.0f,	"_Scale1"); //iPhone
        fparams.AddResolutionLevel(960.0f,	2.0f,	2.0f,	"_Scale2"); //iPhone retina
        fparams.AddResolutionLevel(1024.0f,	2.0f,	2.0f,	"_Scale2"); //iPad
        fparams.AddResolutionLevel(1280.0f,	2.0f,	2.0f,	"_Scale2"); //Nexus 7
        fparams.AddResolutionLevel(2048.0f,	4.0f,	4.0f,	"_Scale4"); //iPad Retina

        fparams.origin = new Vector2(0.0f,0.0f);

        Futile.instance.Init (fparams);

        Futile.atlasManager.LoadAtlas("Atlases/UIFonts");
        Futile.atlasManager.LoadAtlas("Atlases/GameAtlas");

        FPWorld.Create(64.0f);

        FTextParams textParams;

        textParams = new FTextParams();
        textParams.lineHeightOffset = -8.0f;
        Futile.atlasManager.LoadFont("Franchise","FranchiseFont"+Futile.resourceSuffix, "Atlases/FranchiseFont"+Futile.resourceSuffix, -2.0f,-5.0f,textParams);

        textParams = new FTextParams();
        textParams.kerningOffset = -0.5f;
        textParams.lineHeightOffset = -8.0f;
        Futile.atlasManager.LoadFont("CubanoInnerShadow","Cubano_InnerShadow"+Futile.resourceSuffix, "Atlases/CubanoInnerShadow"+Futile.resourceSuffix, 0.0f,2.0f,textParams);

        GoToPage(PageType.BitmaskPuzzleShapesGame);
    }
コード例 #23
0
    public FLetterQuadLine[] GetQuadInfoForText(string text, FTextParams labelTextParams)
    {
        int lineCount   = 0;
        int letterCount = 0;

        char[] letters = text.ToCharArray();

        //at some point these should probably be pooled and reused so we're not allocing new ones all the time
        //now they're structs though, so it might not be an issue
        FLetterQuadLine[] lines = new FLetterQuadLine[15];

        int lettersLength = letters.Length;

        for (int c = 0; c < lettersLength; ++c)
        {
            char letter = letters[c];

            if (letter == ASCII_NEWLINE)
            {
                lines[lineCount]             = new FLetterQuadLine();
                lines[lineCount].letterCount = letterCount;
                lines[lineCount].quads       = new FLetterQuad[letterCount];

                lineCount++;
                letterCount = 0;
            }
            else
            {
                letterCount++;
            }
        }

        lines[lineCount]             = new FLetterQuadLine();
        lines[lineCount].letterCount = letterCount;
        lines[lineCount].quads       = new FLetterQuad[letterCount];

        FLetterQuadLine[] oldLines = lines;
        lines = new FLetterQuadLine[lineCount + 1];

        for (int c = 0; c < lineCount + 1; ++c)
        {
            lines[c] = oldLines[c];
        }

        lineCount   = 0;
        letterCount = 0;

        float nextX = 0;
        float nextY = 0;

        FCharInfo charInfo;

        char previousLetter = '\0';

        float minX = float.MaxValue;
        float maxX = float.MinValue;
        float minY = float.MaxValue;
        float maxY = float.MinValue;

        float usableLineHeight = _lineHeight + labelTextParams.scaledLineHeightOffset + _textParams.scaledLineHeightOffset;

        for (int c = 0; c < lettersLength; ++c)
        {
            char letter = letters[c];

            if (letter == ASCII_NEWLINE)
            {
                if (letterCount == 0)
                {
                    lines[lineCount].bounds = new Rect(0, 0, nextY, nextY - usableLineHeight);
                }
                else
                {
                    lines[lineCount].bounds = new Rect(minX, minY, maxX - minX, maxY - minY);
                }

                minX = float.MaxValue;
                maxX = float.MinValue;
                minY = float.MaxValue;
                maxY = float.MinValue;

                nextX  = 0;
                nextY -= usableLineHeight;

                lineCount++;
                letterCount = 0;
            }
            else
            {
                FKerningInfo foundKerning = _nullKerning;

                for (int k = 0; k < _kerningCount; k++)
                {
                    FKerningInfo kerningInfo = _kerningInfos[k];
                    if (kerningInfo.first == previousLetter && kerningInfo.second == letter)
                    {
                        foundKerning = kerningInfo;
                    }
                }

                //TODO: Reuse letterquads with pooling!
                FLetterQuad letterQuad = new FLetterQuad();

                if (_charInfosByID.ContainsKey(letter))
                {
                    charInfo = _charInfosByID[letter];
                }
                else                 //we don't have that character in the font
                {
                    //blank,  character (could consider using the "char not found square")
                    charInfo = _charInfosByID[0];
                }

                float totalKern = foundKerning.amount + labelTextParams.scaledKerningOffset + _textParams.scaledKerningOffset;

                if (letterCount == 0)
                {
                    nextX = -charInfo.offsetX;                     //don't offset the first character
                }
                else
                {
                    nextX += totalKern;
                }

                letterQuad.charInfo = charInfo;

                Rect quadRect = new Rect(nextX + charInfo.offsetX, nextY - charInfo.offsetY - charInfo.height, charInfo.width, charInfo.height);

                letterQuad.rect = quadRect;

                lines[lineCount].quads[letterCount] = letterQuad;

                minX = Math.Min(minX, quadRect.xMin);
                maxX = Math.Max(maxX, quadRect.xMax);
                minY = Math.Min(minY, nextY - usableLineHeight);
                maxY = Math.Max(maxY, nextY);

                nextX += charInfo.xadvance;

                letterCount++;
            }

            previousLetter = letter;
        }

        if (letterCount == 0)        //there were no letters, so minX and minY would be crazy if we used them
        {
            lines[lineCount].bounds = new Rect(0, 0, nextY, nextY - usableLineHeight);
        }
        else
        {
            lines[lineCount].bounds = new Rect(minX, minY, maxX - minX, maxY - minY);
        }

        return(lines);
    }
コード例 #24
0
ファイル: FFont.cs プロジェクト: maggardJosh/NinjaCircuit
	public FLetterQuadLine[] GetQuadInfoForText(string text, FTextParams labelTextParams)
	{
		int lineCount = 0;
		int letterCount = 0;
		
		char[] letters = text.ToCharArray();
		
		//at some point these should probably be pooled and reused so we're not allocing new ones all the time
		//now they're structs though, so it might not be an issue
		FLetterQuadLine[] lines = new FLetterQuadLine[10];
		
		int lettersLength = letters.Length;
		for(int c = 0; c<lettersLength; ++c)
		{
			char letter = letters[c];
			
			if(letter == ASCII_NEWLINE)
			{
				lines[lineCount] = new FLetterQuadLine();
				lines[lineCount].letterCount = letterCount;
				lines[lineCount].quads = new FLetterQuad[letterCount];
				
				lineCount++;
				letterCount = 0;
			}
			else 
			{
				letterCount++;	
			}
		}
		
		lines[lineCount] = new FLetterQuadLine();
		lines[lineCount].letterCount = letterCount;
		lines[lineCount].quads = new FLetterQuad[letterCount];
		
		FLetterQuadLine[] oldLines = lines;
		lines = new FLetterQuadLine[lineCount+1];
		 
		for(int c = 0; c<lineCount+1; ++c)
		{
			lines[c] = oldLines[c];	
		}
		
		lineCount = 0;
		letterCount = 0;
		
		float nextX = 0;
		float nextY = 0;
		
		FCharInfo charInfo;
		
		char previousLetter = '\0';
		
		float minX = float.MaxValue;
		float maxX = float.MinValue;
		float minY = float.MaxValue;
		float maxY = float.MinValue;
		
		float usableLineHeight = _lineHeight + labelTextParams.scaledLineHeightOffset + _textParams.scaledLineHeightOffset;

		for(int c = 0; c<lettersLength; ++c)
		{
			char letter = letters[c];
			
			if(letter == ASCII_NEWLINE)
			{	
				if(letterCount == 0)
				{
					lines[lineCount].bounds = new Rect(0,0,nextY,nextY - usableLineHeight);
				}
				else 
				{
					lines[lineCount].bounds = new Rect(minX,minY,maxX-minX,maxY-minY);
				}
				
				minX = float.MaxValue;
				maxX = float.MinValue;
				minY = float.MaxValue;
				maxY = float.MinValue;
				
				nextX = 0;
				nextY -= usableLineHeight;
				
				lineCount++;
				letterCount = 0;
			}
			else 
			{
				FKerningInfo foundKerning = _nullKerning;
				
				for(int k = 0; k<_kerningCount; k++)
				{
					FKerningInfo kerningInfo = _kerningInfos[k];
					if(kerningInfo.first == previousLetter && kerningInfo.second == letter)
					{
						foundKerning = kerningInfo;
					}
				}
				
				FLetterQuad letterQuad = new FLetterQuad();

				if(!_charInfosByID.TryGetValue(letter,out charInfo))
				{
					charInfo = _charInfosByID[0];
				}
				
				float totalKern = foundKerning.amount + labelTextParams.scaledKerningOffset + _textParams.scaledKerningOffset;

				if(letterCount == 0)
				{
					nextX = -charInfo.offsetX; //don't offset the first character
				}
				else
				{
					nextX += totalKern; 
				}
				
				letterQuad.charInfo = charInfo;
				
				Rect quadRect = new Rect(nextX + charInfo.offsetX, nextY - charInfo.offsetY - charInfo.height, charInfo.width, charInfo.height);
			
				letterQuad.rect = quadRect;
				
				lines[lineCount].quads[letterCount] = letterQuad;	
				
				minX = Math.Min (minX, quadRect.xMin);
				maxX = Math.Max (maxX, quadRect.xMax);
				minY = Math.Min (minY, nextY - usableLineHeight);
				maxY = Math.Max (maxY, nextY);

				nextX += charInfo.xadvance;

				letterCount++;
			}
						
			previousLetter = letter; 
		}
		
		if(letterCount == 0) //there were no letters, so minX and minY would be crazy if we used them
		{
			lines[lineCount].bounds = new Rect(0,0,nextY,nextY - usableLineHeight);
		}
		else 
		{
			lines[lineCount].bounds = new Rect(minX,minY,maxX-minX,maxY-minY);
		}

		for(int n = 0; n<lineCount+1; n++)
		{
			lines[n].bounds.height += labelTextParams.scaledLineHeightOffset + _textParams.scaledLineHeightOffset;
		}

		return lines;
	}
コード例 #25
0
ファイル: FAtlasManager.cs プロジェクト: narutopatel/Futile
    public void LoadFont(string name, string elementName, string configPath, FTextParams fontTextParams)
    {
        FAtlasElement element = _allElementsByName[elementName];
        FFont font = new FFont(name,element,configPath, fontTextParams);

        _fonts.Add(font);
        _fontsByName.Add (name, font);
    }
コード例 #26
0
ファイル: SKMain.cs プロジェクト: MattRix/ScorekeeperX
    private void Start()
    {
        Go.defaultEaseType       = EaseType.Linear;
        Go.duplicatePropertyRule = DuplicatePropertyRuleType.RemoveRunningProperty;

        // Uncomment if you need to delete bad save data on startup
        // PlayerPrefs.DeleteAll();

        //Time.timeScale = 0.1f; //use for checking timings of things in slow motion

        FutileParams fparams = new FutileParams(true, true, false, false);

        fparams.backgroundColor = RXUtils.GetColorFromHex(0x050122);
        fparams.shouldLerpToNearestResolutionLevel = false;
        fparams.resolutionLevelPickMode            = FResolutionLevelPickMode.Closest;

        bool shouldHaveScale1 = true;
        bool shouldHaveScale2 = true;
        bool shouldHaveScale4 = true;

                #if UNITY_WEBPLAYER
        //webplayer has everything but scale2 stripped out
        shouldHaveScale1 = false;
        shouldHaveScale4 = false;
                #endif

        if (shouldHaveScale1)
        {
            fparams.AddResolutionLevel(480.0f, 1.0f, 1.0f, "_Scale1");                                      //iPhone
        }
        if (shouldHaveScale2)
        {
            fparams.AddResolutionLevel(960.0f, 2.0f, 2.0f, "_Scale2");                                      //iPhone retina
        }
        if (shouldHaveScale2)
        {
            fparams.AddResolutionLevel(1024.0f, 2.0f, 2.0f, "_Scale2");                                     //iPad
        }
        if (shouldHaveScale2)
        {
            fparams.AddResolutionLevel(1136.0f, 2.0f, 2.0f, "_Scale2");                                     //iPhone 5 retina
        }
        if (shouldHaveScale2)
        {
            fparams.AddResolutionLevel(1280.0f, 2.0f, 2.0f, "_Scale2");                                     //Nexus 7
        }
        if (shouldHaveScale4)
        {
            fparams.AddResolutionLevel(2048.0f, 4.0f, 4.0f, "_Scale4");                                     //iPad Retina
        }
        //FOR SCREENSHOTS
//		if(shouldHaveScale1) fparams.AddResolutionLevel(480.0f,		1.0f,	2.0f,	"_Scale2"); //iPhone
//		if(shouldHaveScale2) fparams.AddResolutionLevel(960.0f,		2.0f,	2.0f,	"_Scale2"); //iPhone retina
//		if(shouldHaveScale2) fparams.AddResolutionLevel(1024.0f,	2.0f,	4.0f,	"_Scale4"); //iPad
//		if(shouldHaveScale2) fparams.AddResolutionLevel(1136.0f,	2.0f,	4.0f,	"_Scale4"); //iPhone 5 retina
//		if(shouldHaveScale2) fparams.AddResolutionLevel(1280.0f,	2.0f,	4.0f,	"_Scale4"); //Nexus 7
//		if(shouldHaveScale4) fparams.AddResolutionLevel(2048.0f,	4.0f,	4.0f,	"_Scale4"); //iPad Retina

        fparams.origin = new Vector2(0.5f, 0.5f);

        Futile.instance.Init(fparams);

        Futile.atlasManager.LoadAtlas("Atlases/MainAtlas");
        //Futile.atlasManager.LoadImage("Atlases/Fonts/Raleway");
        //Futile.atlasManager.LoadImage("Atlases/Fonts/Ostrich");

        FTextParams textParams;

        textParams = new FTextParams();
        textParams.kerningOffset    = -0.0f;
        textParams.lineHeightOffset = -15.0f;
        Futile.atlasManager.LoadFont("Raleway", "Fonts/Raleway" + Futile.resourceSuffix, "Atlases/Fonts/Raleway" + Futile.resourceSuffix, -1.0f, -1.0f, textParams);

//
//		textParams = new FTextParams();
//		textParams.kerningOffset = -0.0f;
//		textParams.lineHeightOffset = -15.0f;
//		Futile.atlasManager.LoadFont("Ostrich","Atlases/Fonts/Ostrich", "Atlases/Fonts/Ostrich"+Futile.resourceSuffix, 0.0f,-2.0f,textParams);
//
        for (int s = 0; s < 10; s++)
        {
            FSoundManager.PreloadSound("Musical/Note" + s + "_bass");
            FSoundManager.PreloadSound("Musical/Note" + s + "_normal");
        }

        Futile.stage.AddChild(new Keeper());         //keeper statically retains itself and never gets removed
    }
コード例 #27
0
    public FLetterQuadLine[] GetQuadInfoForText(string text, FTextParams textParams)
    {
        int lineCount   = 0;
        int letterCount = 0;

        char[] letters = text.ToCharArray();

        FLetterQuadLine[] lines = new FLetterQuadLine[10];

        for (int c = 0; c < letters.Length; ++c)
        {
            char letter = letters[c];

            if (letter == ASCII_NEWLINE)
            {
                lines[lineCount]             = new FLetterQuadLine();
                lines[lineCount].letterCount = letterCount;
                lines[lineCount].quads       = new FLetterQuad[letterCount];

                lineCount++;
                letterCount = 0;
            }
            else
            {
                letterCount++;
            }
        }

        lines[lineCount]             = new FLetterQuadLine();
        lines[lineCount].letterCount = letterCount;
        lines[lineCount].quads       = new FLetterQuad[letterCount];

        FLetterQuadLine[] oldLines = lines;
        lines = new FLetterQuadLine[lineCount + 1];

        for (int c = 0; c < lineCount + 1; ++c)
        {
            lines[c] = oldLines[c];
        }

        lineCount   = 0;
        letterCount = 0;

        float nextX = 0;
        float nextY = 0;

        FCharInfo charInfo;

        char previousLetter = '\0';

        float minX = 100000;
        float maxX = -100000;
        float minY = 100000;
        float maxY = -100000;

        for (int c = 0; c < letters.Length; ++c)
        {
            char letter = letters[c];

            if (letter == ASCII_NEWLINE)
            {
                lines[lineCount].bounds = new Rect(minX, minY, maxX - minX, maxY - minY);

                minX = 100000;
                maxX = -100000;
                minY = 100000;
                maxY = -100000;

                nextX  = 0;
                nextY -= _lineHeight + textParams.scaledLineHeightOffset + _fontTextParams.scaledLineHeightOffset;

                lineCount++;
                letterCount = 0;
            }
            else
            {
                FKerningInfo foundKerning = _nullKerning;

                foreach (FKerningInfo kerningInfo in _kerningInfos)
                {
                    if (kerningInfo.first == previousLetter && kerningInfo.second == letter)
                    {
                        foundKerning = kerningInfo;
                    }
                }



                //TODO: Reuse letterquads with pooling!
                FLetterQuad letterQuad = new FLetterQuad();

                charInfo = _charInfosByID[letter];

                float totalKern = foundKerning.amount + textParams.scaledKerningOffset + _fontTextParams.scaledKerningOffset;

                nextX += totalKern;

                letterQuad.charInfo = charInfo;
                //
                Rect quadRect = new Rect(nextX + charInfo.offsetX, nextY - charInfo.offsetY - charInfo.height, charInfo.width, charInfo.height);

                letterQuad.rect = quadRect;

                lines[lineCount].quads[letterCount] = letterQuad;

                minX = Math.Min(minX, quadRect.xMin);
                maxX = Math.Max(maxX, quadRect.xMax);
                minY = Math.Min(minY, quadRect.yMin);
                maxY = Math.Max(maxY, quadRect.yMax);

                nextX += charInfo.xadvance;

                letterCount++;
            }

            previousLetter = letter;
        }

        lines[lineCount].bounds = new Rect(minX, minY, maxX - minX, maxY - minY);

        return(lines);
    }
コード例 #28
0
ファイル: Config.cs プロジェクト: tanis2000/Futile
 static Config()
 {
     textParams = new FTextParams();
     textParams.kerningOffset=-3f;
     textParams.lineHeightOffset=-6f;
 }