From 3acd7de9a75e12a0717df47d6d0162dc23b20516 Mon Sep 17 00:00:00 2001 From: Annika Date: Sat, 25 Jul 2026 23:50:05 -0700 Subject: [PATCH] minor cleanup --- example.cpp | 11 ----------- mappers/tilemapper.cpp | 31 ------------------------------- shaders/buffershader.cpp | 24 ------------------------ shaders/colorshader.cpp | 24 ------------------------ shaders/hgradientshader.cpp | 30 ------------------------------ shaders/shaders.h | 6 +----- shaders/vgradientshader.cpp | 30 ------------------------------ 7 files changed, 1 insertion(+), 155 deletions(-) delete mode 100644 mappers/tilemapper.cpp delete mode 100644 shaders/buffershader.cpp delete mode 100644 shaders/colorshader.cpp delete mode 100644 shaders/hgradientshader.cpp delete mode 100644 shaders/vgradientshader.cpp diff --git a/example.cpp b/example.cpp index 878a77b..f70d872 100644 --- a/example.cpp +++ b/example.cpp @@ -7,17 +7,6 @@ #include #include -// #include "datatypes.cpp" -// #include "helpers.cpp" -// #include "buffer.cpp" -// #include "surface.cpp" -// #include "primatives/line.cpp" -// #include "primatives/point.cpp" -// #include "primatives/rectangle.cpp" -// #include "primatives/trapezoid.cpp" -// #include "primatives/triangle.cpp" -// #include "Texture.cpp" - #include "uwugl.h" #include #include "font.cpp" diff --git a/mappers/tilemapper.cpp b/mappers/tilemapper.cpp deleted file mode 100644 index 3fd6334..0000000 --- a/mappers/tilemapper.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#pragma once - -#include - -#include "../datatypes.cpp" -#include "../helpers.cpp" -#include "mapperbase.cpp" - -namespace UwU { - class TileMapper : public MapperBase { // not actually tilemapping yet - public: - TileMapper() { - this->tileMap = new uint16_t[16384]; // the map of tile positions 128x128 8x8 tiles from a 512x512 bitmap space - } - uint16_t* tileMap; - - Coord2 map(uint16_t x0, uint16_t y0, uint16_t x, uint16_t y) { - uint16_t u0 = x - x0; - uint16_t v0 = y - y0; - // returns uv coordinates that point to a specific pixel of a specific tile on a tilesheet buffer - uint16_t mapX = (u0 & 0x03f8) >> 3; - uint16_t mapY = (v0 & 0x03f8) << 4; - uint16_t tileIndex = tileMap[mapY + mapX]; - uint16_t u = (tileIndex & 0x003f) << 3; - u += (u0 & 0x0007); - uint16_t v = (tileIndex & 0x0fc0) >> 3; - v += (v0 & 0x0007); - return Coord2(u, v); - } - }; -} \ No newline at end of file diff --git a/shaders/buffershader.cpp b/shaders/buffershader.cpp deleted file mode 100644 index d83d1b9..0000000 --- a/shaders/buffershader.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include - -#include "../datatypes.cpp" -#include "../helpers.cpp" -#include "../buffer.cpp" -#include "shaderbase.cpp" - -namespace UwU { - class BufferShader : public ShaderBase { - 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; - } - }; -} \ No newline at end of file diff --git a/shaders/colorshader.cpp b/shaders/colorshader.cpp deleted file mode 100644 index 927410e..0000000 --- a/shaders/colorshader.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include - -#include "../datatypes.cpp" -#include "../helpers.cpp" -#include "../buffer.cpp" -#include "shaderbase.cpp" - -namespace UwU { - class ColorShader : public ShaderBase { - public: - ColorShader(Color c) { - this->c = c; - } - Color c; - - Color shade(uint16_t x, uint16_t y) { - (void)x; - (void)y; - return c; - } - }; -} \ No newline at end of file diff --git a/shaders/hgradientshader.cpp b/shaders/hgradientshader.cpp deleted file mode 100644 index c3f3c5e..0000000 --- a/shaders/hgradientshader.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#pragma once - -#include - -#include "../datatypes.cpp" -#include "../helpers.cpp" -#include "../buffer.cpp" -#include "shaderbase.cpp" - -namespace UwU { - class HGradientShader : public ShaderBase { - public: - HGradientShader(uint16_t u0, uint16_t u1, Color c0, Color c1) { - this->u0 = (uint32_t)u0; - this->uScale = 0xffffffff / (1 + (uint32_t)u1 - (uint32_t)u0); - this->c0 = c0; - this->c1 = c1; - } - uint32_t u0; - uint32_t uScale; - Color c0; - Color c1; - - Color shade(uint16_t u, uint16_t v) { - (void)v; - uint32_t t = (((uint32_t)u - u0) * uScale) / 0x01000000; - return Helpers::lerpColor(c0, c1, (uint8_t)t); - } - }; -} \ No newline at end of file diff --git a/shaders/shaders.h b/shaders/shaders.h index 9632c93..188ee9c 100644 --- a/shaders/shaders.h +++ b/shaders/shaders.h @@ -1,5 +1 @@ -#include "shaderbase.cpp" -#include "colorshader.cpp" -#include "hgradientshader.cpp" -#include "vgradientshader.cpp" -#include "buffershader.cpp" \ No newline at end of file +#include "shaderbase.cpp" \ No newline at end of file diff --git a/shaders/vgradientshader.cpp b/shaders/vgradientshader.cpp deleted file mode 100644 index b878c2c..0000000 --- a/shaders/vgradientshader.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#pragma once - -#include - -#include "../datatypes.cpp" -#include "../helpers.cpp" -#include "../buffer.cpp" -#include "shaderbase.cpp" - -namespace UwU { - class VGradientShader : public ShaderBase { - public: - VGradientShader(uint16_t v0, uint16_t v1, Color c0, Color c1) { - this->v0 = (uint32_t)v0; - this->vScale = 0xffffffff / (1 + (uint32_t)v1 - (uint32_t)v0); - this->c0 = c0; - this->c1 = c1; - } - uint32_t v0; - uint32_t vScale; - Color c0; - Color c1; - - Color shade(uint16_t u, uint16_t v) { - (void)u; - uint32_t t = (((uint32_t)v - v0) * vScale) / 0x01000000; - return Helpers::lerpColor(c0, c1, (uint8_t)t); - } - }; -} \ No newline at end of file