From WiiBrew
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

just what i've been waiting for, i'll give a test on my tank's project ^^ --Grillo 15:34, 11 June 2008 (CEST)

nice clean useful library. thanks! --Beardface 16:07, 11 June 2008 (CEST)

Where do I sign up! hehe... looks like I'll be using this library then :D JD 20:38, 11 June 2008 (CEST)

Your library makes me rage. I had just finished writing all my sprite and collision box code with GRRLIB, and now you make this :( Also, any possibility of a plain C version for those who are too lazy to learn C++? Or source. :P SquidMan 080611

  • Thanks for all your comments, guys :) A C version is currently not planned, because OOP is a big feature of this library, which is the reason why development can be so fast with it. But we will release the source once the projects gets mature. --Chaosteil 14:38, 12 June 2008 (CEST)
  • Chaosteil, can you release the source as is? Even if it isn't easy to compile, a browse through the source can help me understand the library and use it better in my app. -- PaceMaker 06:03, 31 July 2008 (CEST)
    • Drop me an email and I'll give you the link ;) --Chaosteil 23:22, 31 July 2008 (CEST)


Is there any way to modulate color onto a sprite? It seems very inefficient for me to use like 20 different images for colored particles.. I tried using GX's color functions but they froze the game. Any ideas? --Paril 17:19, 8 February 2009 (UTC)

What I did was add R G and B channel members, getters, and setters (in addition to the existing transparency ones). You can then replace the 0xFF's in the Draw function with R G and B and get your color effect. -- MetaFight 13:33, 20 April 2009 (UTC)

sprite test not working

Added to the SD and on loading it went to a black screen and any key press would exit. JD 19:02, 13 June 2008 (CEST)

  • What files did you put on your SD Card? --Chaosteil 21:58, 13 June 2008 (CEST)
Whatever was included in the download... couple of png files an xml and a dol JD 22:12, 13 June 2008 (CEST)
Sorted it... small error in the source.
if(image.LoadImage("/libwiisprite.png") != IMG_LOAD_ERROR_NONE)exit(0);
changed to:
if(image.LoadImage("./libwiisprite.png") != IMG_LOAD_ERROR_NONE)exit(0);
HAHA! I feel stupid for not noticing it :D JD 22:30, 13 June 2008 (CEST)
Oh yeah, thank you, this fix is going to be in the next release then. (It would be best to remove the ./ altogether, btw ;) ) --Chaosteil 22:53, 13 June 2008 (CEST)
yea, I did think that, but it wouldn't work for some strange reason?? probably just how tired I am I suppose! JD 23:18, 13 June 2008 (CEST)
Check out the newest release then and report if you can find any bugs :) --Chaosteil 11:22, 14 June 2008 (CEST)
already got the new version running! haha. and with ./ its also answered anther question I had. I was having problems loading some custom PNG files, but that seems to have gone now :) keep up the good work ;) JD 11:50, 14 June 2008 (CEST)

problems with pngs

This is fixed now, since libwiisprite also supports 24bit pngs

I tried to load a png on screen created with Photoshop CS3, but when it is loaded it has no colors, it shows in black and white... I tried with PNG-8 and PNG-24, and no one worked. Then I tried the PNGs provided in the library and it worked. is PhotoshopCS3 saving PNGs in a format that is unrecognizable by the library? or what could be my problem? -- Bool

Please try to save as PNG32 (using an alpha channel should be enough here). We are planning to review PNGU (once we've done with our next update) to possibly support even more png formats, but for now this one has to do the cut, sorry :/ --Chaosteil 03:43, 16 June 2008 (CEST)
Thanks for the quick reply :), it works perfect now, my image had a solid background, I removed a part from it to force photoshop to use alpha channel and it works now :D, thanks again : ) -- Bool
Could some of this information be rolled into the main article? I was getting started with libwiisprite and had problems with an 8-bit png. I didn't think to check the talk page here until I already talked to Chaosteil to get it sorted out. Thav
8bit was not the case of this problem.. I will see what I can do about it, some faulty libpng documentation here ;/ --Chaosteil 23:22, 31 July 2008 (CEST)

Collision Detection Woes

This is fixed. You can use both zoom and rotation on collision detection now.

Collision detection is not acurate at all when rotating or zooming sprites... It seems as though the detection algorithm is still using the original Image's unrotated height and width to detect collision.

I'd greatly appreciate a fix; or the source to provide a fix back to you... After all, you can't really play operation without superb collision detection :) --Beardface 04:44, 19 June 2008 (CEST)

Oh, so this actually is an issue? It certainly uses the same width and height you've specified as the image.. Currently the only workaround would be to write a collision detection yourself. I will make sure a fix gets into the next release then ;) --Chaosteil 09:41, 19 June 2008 (CEST)
Check out 0.2.1 for updated collision code ;) --Chaosteil 22:34, 22 June 2008 (CEST)

Text print

Great lib, it's really easy to use, but one thing I miss is Text Printing. The example on the apps main page isn't any good, maybe you could implement a good print system directly into libwiisprite. Anyway, I love it ;) Thanks! --PaRaDoX 04:19, 29 June 2008 (CEST)

Here is one way of doing text with libwiisprite
--Beardface 07:07, 29 June 2008 (CEST)
Thanks beardface for your immediate help ;) Anyway, we are currently working on a complete freetype implementation as an addon of libwiisprite. It is almost ready, but it still needs some work. The next release of libwiisprite will for example come earlier than this addon. Until then, please use this method :) --Chaosteil 12:29, 29 June 2008 (CEST)
Waiting for that ;)
Any chance of getting an example of how tiledtextlayer works? Seems pretty straightforward, but I seem to be unable to get it working. --Shuffle

When text printing is added, can the interface be made compatible with the output of F2IBuilder ( The png output should be fine, but it would have to handle the metrics output. -- PaceMaker 01:12, 7 August 2008 (CEST)

Transparency collision

I've used the collision(works great), but maybe you could add transparency detection. Only return the collision if it's touching something visible. Great work on 0.3.0a! --(Previusly unsigned)PaRaDoX 00:12, 9 July 2008 (CEST)

Pixel-perfect detection is very unlikely, since it's one of the most inefficient things one can do. You can, however, use multiple rectangles (currently sprites if you also do rotation and zoom, but we'll have something good in the next release) --Chaosteil 00:02, 9 July 2008 (CEST)
Yeah, that is the option I'll have to use. I wanted to make a labyrinth style game, where users could make their own stages. Anyway, each release of LibWiiSprite is better ;) Thanks for your time! --PaRaDoX 00:12, 9 July 2008 (CEST)

Problem: black bands on TV 4x3

I have an old style TV 4x3 and when I make a program using libwiisprite, it displays it with black bands on top and bottom. It does that, also with the demo apps wiispritetest and invaders. I also noticed this problem with other homebrew apps. I presume it can be fixed (homebrew channel doesn't have this problem) but I don't know how. Any idea ? --Gerome 22:57, 14 July 2008 (CEST)

I corrected this using this: "??.Draw(0, -13); " when it draws it all. Just draw 13 pixels up, and it makes the black space dissapear.--PaRaDoX 01:50, 15 July 2008 (CEST)
Thanks ! What would become the total size of the display then ? 666x480 ?? if you use "??.Draw(0, -13); " on a 16/9 TV, are you going to draw outside of the TV ? idealy, I'd like to find a solution that would display correctly in full screen for all TVs... --Gerome 01:17, 16 July 2008 (CEST)
The black space is basically just the overscan that is actually displayed on your TV. (0;0)u(640;480) is the safe zone in libwiisprite which is displayed on all TVs, but everything else may not get shown on some TVs. --Chaosteil 11:08, 17 July 2008 (CEST)
Chaosteil, can you turn off the overscan and let the app deal with it? This could be an option to turn off overscan protection, if you really like the feature. --PaceMaker 23:00, 6 August 2008 (CEST)

I've recompiled LibWiiSprite v3.0b with a minor change to remove the black bands at the top and bottom. If you use this, your app will have to handle overscan on old style TV's (like mine). The source and compiled library are here It is a one line change and NTSC only. I don't have a way to test PAL. --PaceMaker 19:17, 18 September 2008 (UTC)

Problem Installing in Windows

When I try to install in windows by typing 'make win', I get the following error:

Installing libwiisprite for Windows...
make: copy: Command not found
make: *** [win] Error 127

There appears to be at least three problems with the makefile. The first is that 'lib' is tried to be copied twice, instead of 'lib' and 'include'. The second is that windows 'copy' can't take three parameters. The third is that 'copy' can't be found since it's really a cmd.exe function and not a copy.exe stand-alone app.
-- PaceMaker 03:57, 31 July 2008 (CEST)

Oh... Try to use it with the linux command then.. Devkit installes cygwin, so when you want to use make, it calles the cygwin version, which obviously has cp, not copy. Should work then --Chaosteil 23:22, 31 July 2008 (CEST)

LibWiiSprite Coding Question

In the simplest case, it seems that an 'image' and a 'sprite' object are required to put a picture on the screen. Does the 'image' object need to be persistent as long as the 'sprite' object is? For example, can I do this:

Image * i;
Sprite s;
i = new Image ();
delete (i);

Alternatively, if I can't delete the Image object, can I retrieve it from the sprite object for deletion later? I'm trying to keep my code simple and only keep track of a single object (the sprite) and I'd love to create the image and forget about it.
-- PaceMaker 04:01, 31 July 2008 (CEST)

Yes, it is most definitely needed, the Image takes care of the loading, converting and storing of the bitmap, while the Sprite takes care of the alignment math and all that fancy stuff.--henke37 13:06, 31 July 2008 (CEST)

Henke got it straight to the point. Why Image is the data, the whole calculations are done with the sprite. You should better track both or you will end up with a huge mess, but it is possible to get the pointer to the image the sprite uses (GetImage), however, it is const Image*, so it would be just a pointer to peek at data. --Chaosteil 23:22, 31 July 2008 (CEST)
Thanks for the help. I changed my design to have a single ImageServer object to store the images and supply them to the required sprite objects. -- PaceMaker 01:15, 7 August 2008 (CEST)

Printf With LibWiiSprite

I found a need to support printf in my apps, while using LibWiiSprite. The code below shows an example on how to do this. One reason to do this is that asserts from Box2d (and presumably others) will do a printf. This method should also work with other graphic libraries that use GX instead of framebuffers. The majority of this code was taken from the libogc source.

It's easy to use. Call InitConsole() once, and RenderConsole() each draw loop. Also you'll need to provide a function that replaces my text drawing function: CourierNew_ScreenFont.DisplayText (int x, int y, char * szText); If there is any interest in my ScreenFont class, let me know.

Also, it's not optimized at all, but who wants an optimized printf function?

PaceMaker 01:24, 5 September 2008 (UTC)

Compatibility with HomeMenu

Hey, I was wondering if you could release an update to your library which would allow users to access pointers to the framebuffers (and which framebuffer is currently being drawn). I'm writing HomeMenu, a library which is graphics-library independent, but it requires access to the framebuffers. -- MetaFight 23:50, 25 March 2009 (UTC)