MCPcopy
hub / github.com/fogleman/nes / spritePixel

Method spritePixel

nes/ppu.go:516–533  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

514}
515
516func (ppu *PPU) spritePixel() (byte, byte) {
517 if ppu.flagShowSprites == 0 {
518 return 0, 0
519 }
520 for i := 0; i < ppu.spriteCount; i++ {
521 offset := (ppu.Cycle - 1) - int(ppu.spritePositions[i])
522 if offset < 0 || offset > 7 {
523 continue
524 }
525 offset = 7 - offset
526 color := byte((ppu.spritePatterns[i] >> byte(offset*4)) & 0x0F)
527 if color%4 == 0 {
528 continue
529 }
530 return byte(i), color
531 }
532 return 0, 0
533}
534
535func (ppu *PPU) renderPixel() {
536 x := ppu.Cycle - 1

Callers 1

renderPixelMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected