minetestmapper/PixelAttributes.cpp

35 lines
878 B
C++
Raw Normal View History

2012-08-25 13:19:58 +02:00
/*
* =====================================================================
* Version: 1.0
* Created: 25.08.2012 10:55:27
* Author: Miroslav Bendík
* Company: LinuxOS.sk
* =====================================================================
*/
#include "PixelAttributes.h"
2012-08-25 13:27:40 +02:00
#include <algorithm>
2012-08-25 13:19:58 +02:00
2012-08-25 13:27:40 +02:00
using namespace std;
2012-08-25 13:19:58 +02:00
PixelAttributes::PixelAttributes()
{
2012-09-01 13:34:27 +02:00
m_blockPixelAttributes.resize(17); // 16px + 1px gradient calculation
2012-08-25 13:19:58 +02:00
}
void PixelAttributes::setWidth(int width)
{
2012-09-01 13:34:27 +02:00
for (size_t i = 0; i < 17; ++i) {
2012-08-25 13:19:58 +02:00
m_blockPixelAttributes[i].resize(width + 2); // Width + 1 px gradient calculation on both sides
}
}
void PixelAttributes::scroll()
{
2012-09-01 13:34:27 +02:00
m_blockPixelAttributes[0] = m_blockPixelAttributes[16];
2012-08-25 13:27:40 +02:00
for (size_t i = 1; i < 17; ++i) {
fill(m_blockPixelAttributes[i].begin(), m_blockPixelAttributes[i].end(), PixelAttribute());
}
2012-08-25 13:19:58 +02:00
}