aboutsummaryrefslogtreecommitdiff
path: root/src/ppusim/pixel.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ppusim/pixel.c')
-rw-r--r--src/ppusim/pixel.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/ppusim/pixel.c b/src/ppusim/pixel.c
new file mode 100644
index 0000000..3a09ccd
--- /dev/null
+++ b/src/ppusim/pixel.c
@@ -0,0 +1,22 @@
+#include <SDL2/SDL.h>
+
+#include "ppusim/sim.h"
+
+static void hh_ppusim_draw(SDL_Renderer* r, unsigned px, unsigned py, unsigned cr, unsigned cg, unsigned cb) {
+ SDL_SetRenderDrawColor(r, cr, cg, cb, 255);
+ SDL_RenderFillRect(r, &(SDL_Rect) {
+ .x = px * HH_PPUSIM_UPSCALE_FACTOR,
+ .y = py * HH_PPUSIM_UPSCALE_FACTOR,
+ .w = HH_PPUSIM_UPSCALE_FACTOR,
+ .h = HH_PPUSIM_UPSCALE_FACTOR
+ });
+}
+
+void hh_ppusim_pixel(SDL_Renderer* r, unsigned x, unsigned y) {
+ // loop through foreground sprites to get highest priority cidx
+ // get background cidx
+ // check if palette color cidx of foreground is 0
+ // lookup color from PAL
+ // hh_ppusim_draw
+}
+