cleanup, add getProps()
This commit is contained in:
parent
a838cfcaeb
commit
9728c288b5
2 changed files with 38 additions and 36 deletions
|
@ -44,8 +44,6 @@ void MsdfLayer::draw(glm::vec3 position) const {
|
|||
ofSetColor(ofColor::pink);
|
||||
ofDrawLine(glm::vec2(0, 0), glm::vec2(ofGetWidth(), 0));
|
||||
ofPopStyle();
|
||||
//atlas->getAtlasImage().draw(0, 0);
|
||||
//cout << "drawing letters (" << ofToString(propsBuffer.size()) << ")" << endl;
|
||||
char previous_c;
|
||||
bool firstLetter = true;
|
||||
for(const char c : propsBuffer[0].text){
|
||||
|
@ -67,7 +65,7 @@ void MsdfLayer::draw(glm::vec3 position) const {
|
|||
float magic = ofMap(sin(ofGetElapsedTimeMicros() * 0.000001), -1, 1, 1, 200);
|
||||
magic = atlas->settings.scale;
|
||||
auto fontMetrics = atlas->getFontGeometry().getMetrics();
|
||||
float cender = (fontMetrics.ascenderY-fontMetrics.descenderY);
|
||||
float cender = (fontMetrics.ascenderY - fontMetrics.descenderY);
|
||||
//magic *= cender;
|
||||
//if(ofGetFrameNum() % 30 == 0){
|
||||
//cout << "drawing letter " << c << endl
|
||||
|
@ -80,36 +78,36 @@ void MsdfLayer::draw(glm::vec3 position) const {
|
|||
|
||||
//ofPushMatrix();
|
||||
//for(int i = 0; i < 2; i++){
|
||||
//if(i == 1){
|
||||
//ofRotateDeg(90);
|
||||
//ofTranslate(400, -150, 0);
|
||||
//}
|
||||
//ofNoFill();
|
||||
//ofSetColor(ofColor::white);
|
||||
//ofDrawLine(glm::vec2(0, 90), glm::vec2(0, 140));
|
||||
//ofSetColor(ofColor::lightGray);
|
||||
//for(int i = 1; i < 3; i++){
|
||||
//ofDrawLine(glm::vec2(i * 20, 90), glm::vec2(i * 20, 140));
|
||||
//}
|
||||
//ofFill();
|
||||
//if(i == 0){
|
||||
//ofSetColor(ofColor::red);
|
||||
//ofDrawRectangle(0, 100, pl * 50, 10);
|
||||
//ofSetColor(ofColor::lightBlue);
|
||||
//ofDrawRectangle(0, 120, pr * 50, 10);
|
||||
//ofSetColor(ofColor::green);
|
||||
//ofDrawRectangle(0, 130, gg.getAdvance() * 50, 10);
|
||||
//ofDrawBitmapStringHighlight(ofToString(gg.getAdvance()), 0, 150);
|
||||
//ofDrawBitmapStringHighlight(ofToString(pl), 0, 170);
|
||||
//ofDrawBitmapStringHighlight(ofToString(pb), 0, 190);
|
||||
//ofDrawBitmapStringHighlight(ofToString(pr), 0, 210);
|
||||
//ofDrawBitmapStringHighlight(ofToString(pt), 0, 230);
|
||||
//}else{
|
||||
//ofSetColor(ofColor::green);
|
||||
//ofDrawRectangle(0, 110, pb * 50, 10);
|
||||
//ofSetColor(ofColor::yellow);
|
||||
//ofDrawRectangle(0, 130, pt * 50, 10);
|
||||
//}
|
||||
//if(i == 1){
|
||||
//ofRotateDeg(90);
|
||||
//ofTranslate(400, -150, 0);
|
||||
//}
|
||||
//ofNoFill();
|
||||
//ofSetColor(ofColor::white);
|
||||
//ofDrawLine(glm::vec2(0, 90), glm::vec2(0, 140));
|
||||
//ofSetColor(ofColor::lightGray);
|
||||
//for(int i = 1; i < 3; i++){
|
||||
//ofDrawLine(glm::vec2(i * 20, 90), glm::vec2(i * 20, 140));
|
||||
//}
|
||||
//ofFill();
|
||||
//if(i == 0){
|
||||
//ofSetColor(ofColor::red);
|
||||
//ofDrawRectangle(0, 100, pl * 50, 10);
|
||||
//ofSetColor(ofColor::lightBlue);
|
||||
//ofDrawRectangle(0, 120, pr * 50, 10);
|
||||
//ofSetColor(ofColor::green);
|
||||
//ofDrawRectangle(0, 130, gg.getAdvance() * 50, 10);
|
||||
//ofDrawBitmapStringHighlight(ofToString(gg.getAdvance()), 0, 150);
|
||||
//ofDrawBitmapStringHighlight(ofToString(pl), 0, 170);
|
||||
//ofDrawBitmapStringHighlight(ofToString(pb), 0, 190);
|
||||
//ofDrawBitmapStringHighlight(ofToString(pr), 0, 210);
|
||||
//ofDrawBitmapStringHighlight(ofToString(pt), 0, 230);
|
||||
//}else{
|
||||
//ofSetColor(ofColor::green);
|
||||
//ofDrawRectangle(0, 110, pb * 50, 10);
|
||||
//ofSetColor(ofColor::yellow);
|
||||
//ofDrawRectangle(0, 130, pt * 50, 10);
|
||||
//}
|
||||
//}
|
||||
//ofPopMatrix();
|
||||
shader->begin();
|
||||
|
@ -127,8 +125,8 @@ void MsdfLayer::draw(glm::vec3 position) const {
|
|||
|
||||
std::map <std::pair <int, int>, double>::const_iterator it = kerning.find(std::make_pair <int, int>(gg_previous.getIndex(), gg.getIndex()));
|
||||
if(it != kerning.end()){
|
||||
advance += it->second;
|
||||
ofDrawBitmapStringHighlight(ofToString(it->second), 0, 200, ofColor::black, ofColor::pink);
|
||||
advance += it->second;
|
||||
ofDrawBitmapStringHighlight(ofToString(it->second), 0, 200, ofColor::black, ofColor::pink);
|
||||
}
|
||||
ofPushStyle();
|
||||
ofFill();
|
||||
|
@ -167,6 +165,9 @@ void Layer::setProps(const Props & props){
|
|||
}
|
||||
propsBuffer.push_front(props);
|
||||
}
|
||||
const Layer::Props & Layer::getProps() const {
|
||||
return propsBuffer[0];
|
||||
}
|
||||
void Layer::clearPropsBuffer(){
|
||||
propsBuffer.clear();
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ class Layer {
|
|||
bool mirror_y = false;
|
||||
float mirror_y_distance = 0;
|
||||
float letterDelay = 0;
|
||||
string text = "quickmonkeythedogASYAHELLO";
|
||||
string text = "ASYA is the best";
|
||||
};
|
||||
struct Settings {
|
||||
uint32_t maxBufferSize = 100;
|
||||
|
@ -43,6 +43,7 @@ class Layer {
|
|||
void update();
|
||||
virtual void draw(glm::vec3 position = glm::vec3(0, 0, 0)) const = 0;
|
||||
void setProps(const Props & props);
|
||||
const Props & getProps() const;
|
||||
//void setProps(float _x,
|
||||
//float _y,
|
||||
//float _rotation,
|
||||
|
|
Loading…
Reference in a new issue