cleanup, add getProps()

This commit is contained in:
jrkb 2023-03-29 20:46:54 +02:00
parent a838cfcaeb
commit 9728c288b5
2 changed files with 38 additions and 36 deletions

View file

@ -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
@ -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();
}

View file

@ -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,