Welcome! Log In Create A New Profile

Advanced

libWiiSprite maximum image size

Posted by michela 
libWiiSprite maximum image size
November 07, 2009 12:25PM
Dear Wii Developpers, i have a question concerning the size of the Images that we can load in libwiisprite.
I am very happy with the image and sprite class in libwiiprite for background images of size 640x480 or small animation spritesheet images of small size.

Nevertheless, It seems that i am not able to load bigger images. If the picture is just a little bit larger than the screen like 700x500 there is no problem but for large size images like 1000x250 the sprite drawing is wrong. I don't understand if it is a normal limitation of the library or if there is away to allow these big images to be used in a standard way.

To develop my project without this function, i think i will have to develop my own array of images + my own sprite/frame manager. Maybe it won't be as user-friendly and efficient as the Sprite.NextFrame() function.

Examples of Big Images :

1) Large background Images for scrolling or zooming

I would like to load a bigger image than the screen and adjust the stretching ratio or position to show only a small part on the screen.

2) Large spritesheet images

I would like to use big sprites in my game (256x256) with 8 frames so my image size would be 2048x256 or 1024x512 if i use two lines.
Re: libWiiSprite maximum image size
November 07, 2009 01:33PM
Make sure the image dimensions are multiples of 4.
Re: libWiiSprite maximum image size
November 07, 2009 03:07PM
Thank you for your answer.

I have already made the mistake not to use (h = h0x4, w=w0x4 ) during my first tests but now i use regular sizes like 32, 64, 256, 512, 1024, or 640x480 for bg pictures.

My problem really concern the maximum height or width.
I have made more tests to track the problem and i give you my results :

512x512 png 32 => OK
1024x512 png 32 => OK
512x1024 png 32 => OK
1024x1024 png 32 => OK

2048x512 png 32 => No Loading Error but i obtain a pixel mixture
2048x2048 png 32 => No Loading Error but i obtain a pixel mixture

It seems like 1024 = 2^10 is the maximum size ( height or width ) allowed in my case to have a good image rendering.

I think i will try and use only 1024x1024 images in the future since it work perfectly and it is enough for my SpriteSheet (16 frames for 256x256 sprites).

Thank you again.

I give you some lines from my code which works perfectly for 1024x1024 SpriteSheetA.png Image but has problems with the same sheet reshaped as a 2048x512 image.

include stdio.h
include stdlib.h
include gccore.h
include wiiuse/wpad.h
include fat.h
include wiisprite.h
include ogc/lwp_watchdog.h

using namespace wsp; 

// Header

GameWindow gwd; // Initializes and renders our scene.

int count_tick = 0;  // current tick value
int delta_tick = 5;  //number of ticks between two frames

Image imageA; // SpriteSheetA.png Image Handler
Sprite spriteA;     // Animated Sprite for imageA 

int main(int argc, char **argv) {
	
fatInitDefault();
gwd.InitVideo();    
   	
// Init Sprite 	
IMG_LOAD_ERROR ok = imageA.LoadImage("Data/SpriteSheetA.png") ;
spriteA.SetImage(&imageA, 256, 256);
spriteA.SetPosition(50, 50);	

// Add Sprite to Manager 
LayerManager manager(1);	
manager.Append(&spriteA);	

while(1) {

WPAD_ScanPads();
u32 pressed = WPAD_ButtonsHeld(WPAD_CHAN_0); 

// Go Home Menu
if(pressed & WPAD_BUTTON_HOME) break;

// Animate Sprite
if (pressed & WPAD_BUTTON_A ) {
  count_tick++;                           // update count_tick
  if (count_tick > delta_tick) {   // its time to move to the next frame !!  
     spriteA.NextFrame();          // advance frame for spriteA
     }
}

 // Draw Layers and Flush GameWindow
  
manager.Draw(0, 0);        
gwd.Flush();
}

manager.Draw(0, 0);
gwd.Flush();    
return 0;
}



Edited 1 time(s). Last edit at 11/07/2009 03:09PM by michela.
Re: libWiiSprite maximum image size
November 07, 2009 03:14PM
Make sure you have the latest release of devkitPPC and libpng installed. Beyond that, I'm sorry I cant be of more help.
Re: libWiiSprite maximum image size
November 07, 2009 03:29PM
Thank you for your support, i will try and update my dev tool kit and libraries.
Sorry, only registered users may post in this forum.

Click here to login