basic tilemapping

This commit is contained in:
2026-07-25 21:53:33 -07:00
parent 5298e75fdb
commit e6ce80ce13
5 changed files with 52 additions and 8 deletions
+24
View File
@@ -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
View File
@@ -1,4 +1,5 @@
#include "shaderbase.cpp"
#include "colorshader.cpp"
#include "hgradientshader.cpp"
#include "vgradientshader.cpp"
#include "vgradientshader.cpp"
#include "buffershader.cpp"