Sun May 10, 2015 7:43 am
gb.display.persistence = true;
PFFS.lseek_file(screen_num*(LCDWIDTH*LCDHEIGHT/8));
uint8_t * buffer = gb.display.getBuffer();
for (int row=0; row<LCDHEIGHT/8; row++, buffer+=LCDWIDTH)
PFFS.read_file((char *)buffer, LCDWIDTH, &bytes_read);
gb.display.setColor(INVERT);
if (grayscale_frame)
drawBitmap(dst_x, dst_y, dst_w, dst_h, src_x, src_y, image1);
else
drawBitmap(dst_x, dst_y, dst_w, dst_h, src_x, src_y, image2);
gb.display.drawBitmap((player.x % LCDWIDTH) - 4,(player.y % LCDHEIGHT) - 5, player.sprites[player.currentState].sprite1); //Sprite
/* another test */
gb.display.setColor(INVERT);
gb.display.drawBitmap((player.x % LCDWIDTH) - 4,(player.y % LCDHEIGHT) - 5, player.sprites[player.currentState].sprite1); //Sprite
/* another test */
gb.display.setColor(INVERT,INVERT);
if(gb.frameCount%2 == 0)//grey scale frame
{
gb.display.drawBitmap((player.x % LCDWIDTH) - 4,(player.y % LCDHEIGHT) - 5, player.sprites[player.currentState].sprite1); //Sprite
}
else {
gb.display.drawBitmap((player.x % LCDWIDTH) - 4,(player.y % LCDHEIGHT) - 5, player.sprites[player.currentState].sprite2); //inverse sprite (black are white and white are black)
}
/* and with draw Myndale's bitmap */
gb.display.setColor(INVERT);
if(gb.frameCount%2 == 0)
{
drawBitmap((player.x % LCDWIDTH) - 4,(player.y % LCDHEIGHT) - 5,8,11,0,0, player.sprites[player.currentState].sprite1);
}
else {
drawBitmap((player.x % LCDWIDTH) - 4,(player.y % LCDHEIGHT) - 5,8,11,0,0, player.sprites[player.currentState].sprite2);
}
Tue May 19, 2015 6:02 am
Tue May 19, 2015 6:51 am
Mon May 25, 2015 1:04 pm
Myndale wrote:I'd have to see a working sample of your code but I'll try to explain how the LunarRun code works. At the moment there isn't enough free RAM to store the entire screen, even in compressed format. What I do instead is load the level in and draw the ship in its current position using INVERT. Then, once per frame I draw the ship in its old position using INVERT to erase it, update the ship position and then draw it with INVERT again.