temp commit before the end of the world

This commit is contained in:
Lendemor 2016-12-07 20:25:24 +01:00
parent d5ecf17302
commit 47e1273a0f
3 changed files with 20 additions and 16 deletions

View File

@ -10,6 +10,11 @@ void ShellBuffer::toggleBuffer(){
}
}
void ShellBuffer::update()
{
}
void ShellBuffer::push(TextNode* s){
if (m_children.size() >= m_max_size){
m_children[m_zero_offset++] = s;

View File

@ -17,9 +17,7 @@ public:
unsigned int size(){return m_children.size();}
void toggleBuffer();
void update(){
}
void update();
// if this font_size is scaling down, sizes which are power of 2 render better.
void setFontSize(float font_size){m_font_size = font_size;}

View File

@ -34,6 +34,7 @@ SparrowShell::SparrowShell(sf::Window* window, Input* input):
mesh->initGL();
m_background = new MeshNode(mesh);
this->addChild(m_background);
this->addChild(m_buffer);
m_scrollbar = ShellScrollBar(this);
}
@ -42,8 +43,8 @@ void SparrowShell::out(std::string s)
Font *shellfont = RESOURCE_GET(Font,"shellfont");
TextNode* tnode = shellfont->getTextNode(s,glm::vec3(0.7,1,0.3),m_buffer->getFontSize());
tnode->setDepth(SHELL_DEPTH+1);
// m_currentScene->addToIndex(tnode);
m_buffer->push(tnode);
m_scene->addToIndex(tnode);
if (m_buffer->size() > SparrowShell::BUFFER_DISPLAYED_NUMBER)
m_resizeBuffer = true;
}
@ -66,10 +67,10 @@ void SparrowShell::toggleShell(){
m_shellEnabled = !m_shellEnabled;
for(auto child : m_children){
MeshNode* meshchild = dynamic_cast<MeshNode*>(child);
if(meshchild)
meshchild->toggleVisibility();
// if(meshchild)
// meshchild->toggleVisibility();
}
m_buffer->toggleBuffer();
// m_buffer->toggleBuffer();
m_background->toggleVisibility();
}
@ -85,16 +86,16 @@ void SparrowShell::update(){
//move position of shellBuffer
// position textnode inside shellBuffer
if(m_shellEnabled){
m_buffer->update();
m_buffer->update();
/* if(m_shellEnabled){
for(unsigned int i = 0; i<m_buffer->size(); i++){
// tnode = (TextNode*)(m_buffer+i);
// if (i >= m_index && i < m_index + BUFFER_DISPLAYED_NUMBER){
// utils::setPosition2D(tnode,text_pos);
// text_pos.y += m_buffer->getFontSize();
// m_scene->addToIndex(tnode);
// }
tnode = (TextNode*)(m_buffer+i);
if (i >= m_index && i < m_index + BUFFER_DISPLAYED_NUMBER){
utils::setPosition2D(tnode,text_pos);
text_pos.y += m_buffer->getFontSize();
m_scene->addToIndex(tnode);
}
}
}
}*/
m_scrollbar.update();
}