moved textures into their own classes, better tilemapping

This commit is contained in:
2026-07-25 23:47:54 -07:00
parent e6ce80ce13
commit 1c2579148e
19 changed files with 277 additions and 56 deletions
+4 -4
View File
@@ -5,8 +5,8 @@
#include "../datatypes.cpp"
#include "../helpers.cpp"
#include "../buffer.cpp"
#include "../shaders/shaders.h"
#include "../mappers/mappers.h"
#include "../textures/textures.h"
namespace UwU {
// point
@@ -21,11 +21,11 @@ namespace UwU {
uint16_t y;
// Draw a point
template <class MapperT, class ShaderT>
void draw (Buffer buffer, MapperBase<MapperT>& mapper, ShaderBase<ShaderT>& shader) {
template <class MapperT, class TextureT>
void draw (Buffer buffer, MapperBase<MapperT>& mapper, TextureBase<TextureT>& texture) {
if (x > buffer.width || y > buffer.height) {return;};
Coord2 uv = mapper.map(x, y, x, y);
buffer.drawPixel(x, y, shader.shade(uv.x, uv.y));
buffer.drawPixel(x, y, texture.texel(uv.x, uv.y));
return;
}
};