switch shellbuffer to graphicalcontainernode

This commit is contained in:
Lendemor 2016-12-07 19:27:17 +01:00
parent f0cd0fbace
commit 834d7f6676
2 changed files with 10 additions and 5 deletions

View File

@ -1,22 +1,26 @@
#ifndef SHELLBUFFER_H #ifndef SHELLBUFFER_H
#define SHELLBUFFER_H #define SHELLBUFFER_H
#include "scene/containernode.h" #include "scene/graphicalcontainernode.h"
class TextNode; class TextNode;
class ShellBuffer : public ContainerNode { class ShellBuffer : public GraphicalContainerNode {
private: private:
int m_zero_offset = 0;
unsigned int m_max_size; unsigned int m_max_size;
int m_zero_offset;
float m_font_size; float m_font_size;
public: public:
ShellBuffer(int buffer_size):m_max_size(buffer_size){} ShellBuffer(int buffer_size):m_max_size(buffer_size), m_zero_offset(0),m_font_size(16.f){}
SceneNode* operator[](int i){return m_children[(m_zero_offset+i)%m_max_size];} GraphicalNode* operator[](int i){return m_children[(m_zero_offset+i)%m_max_size];}
void push(TextNode*); void push(TextNode*);
unsigned int size(){return m_children.size();} unsigned int size(){return m_children.size();}
void toggleBuffer(); void toggleBuffer();
void update(){
}
// if this font_size is scaling down, sizes which are power of 2 render better. // 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;} void setFontSize(float font_size){m_font_size = font_size;}
float getFontSize(){return m_font_size;} float getFontSize(){return m_font_size;}

View File

@ -86,6 +86,7 @@ void SparrowShell::update(){
// position textnode inside shellBuffer // position textnode inside shellBuffer
if(m_shellEnabled){ if(m_shellEnabled){
m_buffer->update();
for(unsigned int i = 0; i<m_buffer->size(); i++){ for(unsigned int i = 0; i<m_buffer->size(); i++){
// tnode = (TextNode*)(m_buffer+i); // tnode = (TextNode*)(m_buffer+i);
// if (i >= m_index && i < m_index + BUFFER_DISPLAYED_NUMBER){ // if (i >= m_index && i < m_index + BUFFER_DISPLAYED_NUMBER){