basic tilemapping
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "../datatypes.cpp"
|
||||
#include "../helpers.cpp"
|
||||
#include "../buffer.cpp"
|
||||
#include "shaderbase.cpp"
|
||||
|
||||
namespace UwU {
|
||||
class BufferShader : public ShaderBase<BufferShader> {
|
||||
public:
|
||||
BufferShader(Buffer buffer) {
|
||||
this->buffer = buffer;
|
||||
}
|
||||
Buffer buffer;
|
||||
|
||||
Color shade(uint16_t x, uint16_t y) {
|
||||
uint32_t index = (y * buffer.stride) + (x * 4);
|
||||
Color c = Color(buffer.pixels[index + 2], buffer.pixels[index + 1], buffer.pixels[index], buffer.pixels[index + 3]);
|
||||
return c;
|
||||
}
|
||||
};
|
||||
}
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
#include "shaderbase.cpp"
|
||||
#include "colorshader.cpp"
|
||||
#include "hgradientshader.cpp"
|
||||
#include "vgradientshader.cpp"
|
||||
#include "vgradientshader.cpp"
|
||||
#include "buffershader.cpp"
|
||||
Reference in New Issue
Block a user