From 834d7f6676e35ff44bc4ee10ee98e957dcf3ab13 Mon Sep 17 00:00:00 2001 From: Lendemor Date: Wed, 7 Dec 2016 19:27:17 +0100 Subject: [PATCH] switch shellbuffer to graphicalcontainernode --- src/sparrowshell/shellbuffer.h | 14 +++++++++----- src/sparrowshell/sparrowshell.cpp | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/sparrowshell/shellbuffer.h b/src/sparrowshell/shellbuffer.h index 70e3ca0..b631076 100644 --- a/src/sparrowshell/shellbuffer.h +++ b/src/sparrowshell/shellbuffer.h @@ -1,22 +1,26 @@ #ifndef SHELLBUFFER_H #define SHELLBUFFER_H -#include "scene/containernode.h" +#include "scene/graphicalcontainernode.h" class TextNode; -class ShellBuffer : public ContainerNode { +class ShellBuffer : public GraphicalContainerNode { private: - int m_zero_offset = 0; unsigned int m_max_size; + int m_zero_offset; float m_font_size; public: - ShellBuffer(int buffer_size):m_max_size(buffer_size){} - SceneNode* operator[](int i){return m_children[(m_zero_offset+i)%m_max_size];} + ShellBuffer(int buffer_size):m_max_size(buffer_size), m_zero_offset(0),m_font_size(16.f){} + GraphicalNode* operator[](int i){return m_children[(m_zero_offset+i)%m_max_size];} void push(TextNode*); unsigned int size(){return m_children.size();} void toggleBuffer(); + 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;} float getFontSize(){return m_font_size;} diff --git a/src/sparrowshell/sparrowshell.cpp b/src/sparrowshell/sparrowshell.cpp index 8b1f4a3..4488675 100644 --- a/src/sparrowshell/sparrowshell.cpp +++ b/src/sparrowshell/sparrowshell.cpp @@ -86,6 +86,7 @@ void SparrowShell::update(){ // position textnode inside shellBuffer if(m_shellEnabled){ + m_buffer->update(); for(unsigned int i = 0; isize(); i++){ // tnode = (TextNode*)(m_buffer+i); // if (i >= m_index && i < m_index + BUFFER_DISPLAYED_NUMBER){