From 47e1273a0fed4485ab171be504d2a6d621f2e1e4 Mon Sep 17 00:00:00 2001 From: Lendemor Date: Wed, 7 Dec 2016 20:25:24 +0100 Subject: [PATCH] temp commit before the end of the world --- src/sparrowshell/shellbuffer.cpp | 5 +++++ src/sparrowshell/shellbuffer.h | 4 +--- src/sparrowshell/sparrowshell.cpp | 27 ++++++++++++++------------- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/sparrowshell/shellbuffer.cpp b/src/sparrowshell/shellbuffer.cpp index 3690a55..4992a88 100644 --- a/src/sparrowshell/shellbuffer.cpp +++ b/src/sparrowshell/shellbuffer.cpp @@ -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; diff --git a/src/sparrowshell/shellbuffer.h b/src/sparrowshell/shellbuffer.h index b631076..68fe944 100644 --- a/src/sparrowshell/shellbuffer.h +++ b/src/sparrowshell/shellbuffer.h @@ -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;} diff --git a/src/sparrowshell/sparrowshell.cpp b/src/sparrowshell/sparrowshell.cpp index 4488675..ad0ef61 100644 --- a/src/sparrowshell/sparrowshell.cpp +++ b/src/sparrowshell/sparrowshell.cpp @@ -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(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; isize(); 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(); }