htv04 / wiilove

Framework for making 2D Nintendo Wii homebrew games in Lua
GNU Lesser General Public License v3.0
66 stars 8 forks source link

Texture not showing up. #1

Open ACIDULATED opened 2 years ago

ACIDULATED commented 2 years ago

so I had tried newImage, but that didn't work, and then I tried newTexture. It didn't crash or give me an error, its just a black screen. Here's my lua code: function love.load() kris = love.graphics.newTexture("kris.png"); end

function love.update(dt)

end

function love.draw() love.graphics.draw(kris, 100, 100, 0, 1, 1, 48, 48); end

htv04 commented 2 years ago

It's likely that WiiLÖVE didn't crash at all and just isn't drawing the texture. This is a known issue, see https://github.com/GRRLIB/GRRLIB/discussions/12#discussioncomment-725819

I'm trying to look for ways around this, but in the meantime you can try padding the image with transparent pixels to fit the requirements.

ACIDULATED commented 2 years ago

wait, i changed it to fit the requirements! it's not working. here's the image: kris (btw i got this off of google, credits to whoever made it)!

htv04 commented 2 years ago

Seems that there was also one more issue with the image. libpngu (PNG handling library) can't handle paletted images yet. The original image uses a palette instead of RGB values (probably automatically done to save space).

Here's the fixed image, it now draws with your code: kris

By the way, don't close this issue, because nothing was fixed. This is just a workaround.

ACIDULATED commented 2 years ago

How can I convert images to have RGB values in the future?

htv04 commented 2 years ago

I used GIMP to convert the image from Indexed to RGB.

However, I may have found a way to integrate palette conversion into libpngu, so you might not need to do this in the future.

htv04 commented 2 years ago

Fixed indexed PNGs in 19dd46f1c48f8d12af90ebcc17f234c162ba3949!

I made a modification of libpngu with fixes: https://github.com/HTV04/libpngu-mod

Screenshot (this is using your original image): ID-wiilove_2022-05-08_16-20-38

Next, I need to fix (or workaround in code) images that aren't multiples of 4.