Welcome! Log In Create A New Profile

Advanced

Can't Fix Problem with libwiisprite

Posted by Matando 
Can't Fix Problem with libwiisprite
November 30, 2008 11:54PM
I'm doing something wrong in my project, and it won't build.

I'm trying to get "map1" to be tiled and be shown on the screen. But I cant find documentation on the TiledLayer part of libwiisprite.

here's my zipped up source code, just give me a fix and explain why it needed to be fixed and how the fix worked(unless it was obvious, lol)

Zipped Project
Re: Can't Fix Problem with libwiisprite
December 01, 2008 02:30AM
Here's the error I get:

main.cpp: In function 'int main(int, char**)':
main.cpp:23: error: 'SetStaticTileset' was not declared in this scope
The error message says it can't find the SetStaticTileset function, here's how you're calling it in main.cpp:
    12          Image image;
    ...
    17          u32 TileHeight = 14;
    18          u32 TileWidth = 14;
    ...
    22          TiledLayer(47, 57, 0);
    23          SetStaticTileset(image, &TileWidth, &TileHeight);  //<<= problem line
The function SetStaticTileset() is a non-static member function of the class TiledLayer. In order to call it, you'll need to create an instance of the TiledLayer class. The prototype for this function looks like this:
void SetStaticTileset(Image* image, u32 tileWidth, u32 tileHeight);
So you need to pass it a pointer to your image, and pass by value the width and height.
Here's how I re-wrote this part of your code:
    22          TiledLayer tiledlayer(47, 57, 0);
    23          tiledlayer.SetStaticTileset(&image, TileWidth, TileHeight);
I don't know enough about libwiisprite to tell you if this is going to produce what you want, but this should get rid of the build errors. Hope that helps.
Re: Can't Fix Problem with libwiisprite
December 01, 2008 08:48PM
thanks :)
Sorry, only registered users may post in this forum.

Click here to login