mirror of
https://github.com/luanti-org/minetestmapper.git
synced 2025-10-06 13:55:22 +02:00
Move source files into folder
This commit is contained in:
44
src/PixelAttributes.h
Normal file
44
src/PixelAttributes.h
Normal file
@@ -0,0 +1,44 @@
|
||||
#pragma once
|
||||
|
||||
#include <climits>
|
||||
#include <cstdint>
|
||||
|
||||
#define BLOCK_SIZE 16
|
||||
|
||||
struct PixelAttribute {
|
||||
PixelAttribute() : height(INT16_MIN), thickness(0) {};
|
||||
|
||||
int16_t height;
|
||||
uint8_t thickness;
|
||||
|
||||
inline bool valid_height() const {
|
||||
return height != INT16_MIN;
|
||||
}
|
||||
};
|
||||
|
||||
class PixelAttributes
|
||||
{
|
||||
public:
|
||||
PixelAttributes();
|
||||
virtual ~PixelAttributes();
|
||||
|
||||
void setWidth(int width);
|
||||
void scroll();
|
||||
|
||||
inline PixelAttribute &attribute(int z, int x) {
|
||||
return m_pixelAttributes[z + 1][x + 1];
|
||||
};
|
||||
|
||||
private:
|
||||
void freeAttributes();
|
||||
|
||||
private:
|
||||
enum Line {
|
||||
FirstLine = 0,
|
||||
LastLine = BLOCK_SIZE,
|
||||
EmptyLine = BLOCK_SIZE + 1,
|
||||
LineCount = BLOCK_SIZE + 2
|
||||
};
|
||||
PixelAttribute *m_pixelAttributes[BLOCK_SIZE + 2]; // 1px gradient + empty
|
||||
int m_width;
|
||||
};
|
Reference in New Issue
Block a user