Invisible color not working in simulator


#1

I was just porting Blocky World to the latest version of the simulator and I noticed a little issue. Apparently the code for the invisible color had disappeared in the Display::directPixel() function. It might be a good idea to add that back :wink:


#2

Good catch! Will be replaced


#3

It’s missing again! I’m not that experienced with Github, so I don’t know how to make a PR, but you might want to fix it ASAP. I had purple lines all over my game at first :joy:

I also had a strange issue where the invisible color was looping around, so an invisible color of 16 did not draw pixels with color 0. I have no idea what’s going on, but a quick addition of && invisiblecolor < 16 did the trick for now.


#4

If you tell me what file and line number (if you know them) I can have a quick look and make a PR or something.


#5

Pokitto\POKITTO_CORE\PokittoDisplay.cpp

Line 211


#6

Sorry for the delay, was fixing code on another project.

Line 211 according to github is Display::directPixel:

That doesn’t seem right?


If you look on the page and find the bit of code you’re talking about, click the line number and it’ll take your browser to the line number.
You can then either copy the url in your address bar or click on the ... and there will be a Copy permalink option which should copy the address into your clipboard.

Paste that here with the proposed change and I’ll turn it into a fork or a branch and make a PR for review.
(If none of that makes any sense, it basically means I’ll get the code change ready and let the others read it to make sure it’s right before it gets accepted.)


#7


In between lines 211 and 212, add
if ((invisiblecolor<PALETTE_SIZE && invisiblecolor < 16 && color==palette[invisiblecolor])) return; //do not draw transparent pixels

I don’t know what’s going on with the PALETTE_SIZE, because when I put that without invisiblecolor < 16, the invisible color was wrapping around to color 0. Someone might want to look into that, but this is at least a temporary fix that’ll work for 16-color palettes. I guess you could in theory add another argument to the function?


#8

For the record I’m not entirely sure this is the right solution, but I don’t know enough about the display modes to judge either way.

I’ve made a PR out of it regardless and hopefully someone will come along and say ‘no this is wrong’ or ‘yes this is right’.


#9

You could put a breakpoint in code and see why it fails in that line.


#10

The PR has been merged.