#include <Adafruit_GFX.h>
#include <Adafruit_ILI9341.h>
#include "assets.h"
#define TFT_DC 2
#define TFT_CS 15
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
void setup(void) {
Serial.begin(9600);
tft.begin();
tft.setRotation(1);
tft.fillScreen(white);
drawSprite(80,10,player_width,player_height, player_sprite, 7);
}
void loop(void) {
}
void drawSprite(int x, int y, int w, int h, const uint8_t *bitmap, int scale) {
tft.startWrite();
for (int16_t j = 0; j < h; j++) {
for (int16_t i = 0; i < w; i++) {
if(bitmap[j * w + i] != transparent) { // Check if the pixel is not transparent
// Draw each pixel `scale` times in both x and y directions
for (int dy = 0; dy < scale; dy++) {
for (int dx = 0; dx < scale; dx++) {
tft.writePixel(x + (i*scale) + dx, y + (j*scale) + dy, RGB565(bitmap[j * w + i]));
}
}
}
}
}
tft.endWrite();
}