#include "shellbuffer.h" #include "scene/meshnode.h" #include "scene/textnode.h" #include "sparrowshell/sparrowshell.h" #include "tools/utils.h" void ShellBuffer::toggleBuffer(){ for(auto child : m_children){ MeshNode* meshchild = dynamic_cast(child); if(meshchild) meshchild->toggleVisibility(); } } void ShellBuffer::update() { TextNode* tnode; glm::vec2 text_pos(0); SparrowShell* shell = dynamic_cast(m_parent); // if(shell && shell->isEnabled()) // { // for(unsigned int i = 0; i< size();i++) // { // tnode = (TextNode*) this+i; // if (i >= m_index && i < m_index+SparrowShell::BUFFER_DISPLAYED_NUMBER) // { // utils::setPosition2D(tnode,text_pos); // text_pos.y += m_font_size; // //m_scene // } // else{ // utils::setPosition2D(tnode,glm::vec2(-100,-100)); // } // } // } } void ShellBuffer::push(TextNode* s){ if (m_children.size() >= m_max_size){ m_children[m_zero_offset++] = s; m_zero_offset %= m_max_size; }else m_children.push_back(s); }