Skip to content

Commit

Permalink
Addign ArcText and spiralText
Browse files Browse the repository at this point in the history
  • Loading branch information
patriciogonzalezvivo committed Apr 26, 2012
1 parent 29a13a1 commit ead4994
Show file tree
Hide file tree
Showing 11 changed files with 264 additions and 131 deletions.
14 changes: 14 additions & 0 deletions src/ofxTextAlignment.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// ofxTextAlignment.h
// ofxArcText-example
//
// Created by Patricio González Vivo on 4/24/12.
// Copyright (c) 2012 PatricioGonzalezVivo.com. All rights reserved.
//

#ifndef ofxArcText_example_ofxTextAlignment_h
#define ofxArcText_example_ofxTextAlignment_h



#endif
9 changes: 9 additions & 0 deletions src/ofxTextArc.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//
// ofxTextArc.cpp
// ofxArcText-example
//
// Created by Patricio González Vivo on 4/24/12.
// Copyright (c) 2012 PatricioGonzalezVivo.com. All rights reserved.
//

#include <iostream>
38 changes: 38 additions & 0 deletions src/ofxTextArc.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,51 @@
#ifndef OFXTEXTARC_H
#define OFXTEXTARC_H

#include "ofMain.h"

#include "ofxTextFont.h"
#include "ofxTextAlignment.h"

typedef struct {
float angle;
float width;
float radius;
float scale;
} letterArc;

class ofxTextArc {
public:
ofxTextArc();

virtual void loadFont(string _fontLocation, float _fontSize, int _dpi = 90);

virtual void setText(string _inputText);
virtual void setScale(float _scale){ scale = _scale; };
virtual void setRadius(float _radius){ radius = _radius; _loadWords(); };
virtual void setAngle(float _angle){ angle = _angle; _loadWords(); };
virtual void setAlignment(ofxHorizontalAlignment _hAlignment , ofxVerticalAlignment _vAlignment = OF_TEXT_ALIGN_TOP);

virtual int length(){return rawText.length();};
virtual void clear(){ rawText.clear();};
virtual ofxTextArc& operator += (string _text){ setText(rawText + _text);};
virtual ofxTextArc& operator = (string _text){ setText(_text);};
virtual ofxTextArc& operator -- (){ if( rawText.length()>0){ rawText.erase( rawText.begin() ); setText(rawText); }};
virtual ofxTextArc& operator -- (int){ if( rawText.length()>0){ rawText.erase(rawText.end()-1); setText(rawText); }};

virtual void draw(float _x, float _y);

protected:
virtual void _loadWords();

ofxTextFont font;

ofxHorizontalAlignment hAlignment;
ofxVerticalAlignment vAlignment;

letterArc *letters;
string rawText;
float angle, totalAngle, radius;
float scale;
};

#endif
Loading

0 comments on commit ead4994

Please sign in to comment.