paulofmandown / rotLove

Roguelike Toolkit in Love. A Love2D/lua port of rot.js
http://paulofmandown.github.io/rotLove/
Other
258 stars 25 forks source link

Screen rendering as pure white #61

Closed finchco closed 2 years ago

finchco commented 3 years ago

Running the examples it looks like everything renders pure white, with the exception of the lighting demo (which just looks really jacked up, but you can see stuff at least).

finchco commented 3 years ago

I loaded the CP437 png and colored it something other than white and now it shows up. Looks like the library is clearing the background to white instead of black maybe? Still looking at it.

finchco commented 3 years ago

Ok, it looks like it's something that's not playing right with the default bg color in ROT.Display's init function.

If I explicitly override the defaults in the constructor like this:

ROT.Display(80, 40, 1, {255,255,255,255}, {0,0,0,255})

then it works just fine.

finchco commented 3 years ago

Turns out that was just luck. The real problem is that Love2d changed how it handles color values since the last update to rotLove. They used to be 0->255 and now they're 0.0->1.0 floats.

I'll put a pull request together that has a few other fixes that I made today (setting the texture filtering to linear+nearest for the font png so it doesn't fuzz out when it scales above 1, a few other small things)

finchco commented 3 years ago

To fix the issue, simply replace lines 42 and 43 of Display.lua with:

    self.defaultForegroundColor=dfg and dfg or { 1.0,1.0,1.0,1.0 }
    self.defaultBackgroundColor=dbg and dbg or { 0.0,0.0,0.0,1.0 }

It looks like this project is abandoned, so I'll probably fork it and add my improvements there. This solution is for anyone that makes it as far as I did to save them the time I spent figuring out the problem.

paulofmandown commented 3 years ago

not abandoned, I just don't really work on it anymore

happy to accept any and all pull requests!

finchco commented 2 years ago

Ok, cool! I'm making a few fixes outside of just the colors. Couple of questions:

  1. In display.lua why do you do self.graphics=love.graphics instead of just referencing love.graphics?
  2. Is there a particular reason that you're using a canvas here rather than just writing directly to the screen?

I'll roll back to a clean version to make my PR for the color fixes, which will include some of the examples as well. Thanks!

paulofmandown commented 2 years ago
  1. That's likely just something I saw somewhere else and interpreted as a best practice at the time
  2. I don't think there was any specific reason I did that like that
finchco commented 2 years ago

Ok, cool. Thanks! I'm doing some optimization and also writing a simple rogue clone to include as a new example.

finchco commented 2 years ago

Ok, I FINALLY got back to cleaning up my changes for a PR. It's submitted and ready for your review!