aboutsummaryrefslogtreecommitdiff
path: root/src/ppusim/pixel.c
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2023-02-24 19:23:56 +0100
committerlonkaars <loek@pipeframe.xyz>2023-02-24 19:23:56 +0100
commit97dd5f6bd354c8e931778c79c7a421d5bdaafee5 (patch)
tree31503c1d99d6165de2e8474e4535478975ea6650 /src/ppusim/pixel.c
parentf5c8ae2f2d2074d483490e857db5aef8388f06c9 (diff)
WIP ppusim
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
+}
+