Update general

This commit is contained in:
Miloslav Číž 2018-09-09 17:52:30 +02:00
parent 6a7cc1151f
commit c7e8638db7
2 changed files with 15 additions and 8 deletions

View file

@ -638,11 +638,10 @@ inline void pixelFunc(PixelInfo pixel)
rgbToIndex(intensity/2,intensity,intensity/3) : rgbToIndex(intensity/2,intensity,intensity/3) :
rgbToIndex(intensity,intensity/2,0); rgbToIndex(intensity,intensity/2,0);
uint8_t *buf = pokitto.display.screenbuffer; uint8_t *buf = pokitto.display.screenbuffer;
buf += pixel.position.x * SUBSAMPLE; buf += pixel.position.x * SUBSAMPLE;
buf += pixel.position.y * pokitto.display.width; buf += pixel.position.y * SCREEN_WIDTH;
for (uint8_t i = 0; i < SUBSAMPLE - 1; ++i) for (uint8_t i = 0; i < SUBSAMPLE - 1; ++i)
*buf++ = c; *buf++ = c;
@ -699,8 +698,7 @@ bool runReleased = false;
int main() int main()
{ {
pokitto.begin(); initGeneral();
initPalette();
player.setPositionSquare(4,5); player.setPositionSquare(4,5);
@ -708,10 +706,6 @@ int main()
sprites[1] = Sprite(sprite1,14,5,1,100); sprites[1] = Sprite(sprite1,14,5,1,100);
sprites[2] = Sprite(sprite2,15,19,1,200); sprites[2] = Sprite(sprite2,15,19,1,200);
pokitto.display.persistence = 1;
pokitto.setFrameRate(FPS);
pokitto.display.setFont(fontTiny);
uint32_t previousTime = 0; uint32_t previousTime = 0;
uint32_t dt; uint32_t dt;

View file

@ -223,4 +223,17 @@ public:
Unit mPixelSize; Unit mPixelSize;
}; };
void initGeneral()
{
pokitto.begin();
pokitto.setFrameRate(FPS);
pokitto.display.setFont(fontTiny);
pokitto.display.persistence = 1;
initPalette();
for (uint8_t i = 0; i < SUBSAMPLED_WIDTH; ++i)
zBuffer[i] = 0;
}
#endif #endif