Advertisement
TheFastFish

nChip render stuff

May 8th, 2015
573
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. //opcode for drawing sprites
  2. //DXYN or something
  3. //be sure all variables are defined
  4. rx = opcode[0] & 0x0F;
  5. ry = opcode[1] & 0xF0;
  6. hbyte = opcode[1] & 0x0F;
  7. for (j = 0; j <= hbyte; j++) {
  8. lbyte = memory[i + j];
  9. for (k = 0; k < 8; k++) {
  10. pbit = lbyte & ( 1 << k);
  11. if (pbit) {
  12. pixelRect.x = rx * displaywidth;
  13. pixelRect.y = ry * displayheight;
  14. pixelRect.w = displayscale;
  15. pixelRect.h = displayscale;
  16. SDL_RenderReadPixels(renderer, pixelRect, 0, pixelData, pitch);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement