Welcome! Log In Create A New Profile

Advanced

GRRLIB Help

Posted by g_man 
Re: GRRLIB Help
March 19, 2009 11:07PM
ok, but i get an error telling me it can't find the library include files
/GRRLIB.c:15:40: error: ../../lib/libpng/pngu/pngu.h: No such file or directory
d:/homebrew/mystuff/pong/source/GRRLIB.c:16:39: error: ../../lib/libjpeg/jpeglib.h: No such file or directory
how do i locate the file where makefile is in?, main.c is in source the next level up.
Re: GRRLIB Help
March 20, 2009 11:15AM
Your Makefile should be in the level UP from where your main.c is.
Re: GRRLIB Help
March 20, 2009 02:13PM
In other words, dont put main.c in the same folder as your makefile. Put main.c in the folder one level below it.

EX:
/projects/myawesomeapp/makefile
/projects/myawesomeapp/source/main.c
Re: GRRLIB Help
March 21, 2009 02:08AM
i know that, but how do i call the dir, call might be the wrong word, but how do i get there, i wont be able test anything cause my parents took my computer away
Re: GRRLIB Help
March 21, 2009 04:16AM
Quote
g_man
i know that, but how do i call the dir, call might be the wrong word, but how do i get there, i wont be able test anything cause my parents took my computer away
Oh snap, that sucks. Anyway, what do you mean by "call the dir"? And which dir in particular are you trying to "call"?
Re: GRRLIB Help
March 21, 2009 08:52PM
call was the wrong word, i was using the internet channel on my wii and i didn't want to type much

When a say #include "GRRLIB.h" that means it's in the directory that main.c is in right?
so if thats true and i want to access a file pngu.h that is in the lib directory where my makefile is in, how do i tell it to go up one directory and then locate pngu.h? the #include for pngu.h is in GRRLIB.h

i'll have to know this whether i move GRRLIB or not.
Re: GRRLIB Help
March 21, 2009 08:54PM
You'll have to change your makefile, I dont think it can be done in C.
Re: GRRLIB Help
March 21, 2009 11:09PM
Here's how my directory structure looks:
- Makefile
- lib (dir)
	- libpng.a
- source (dir)
	- gfx (dir)
		- image.h
	- GRRLIB (dir)
		- GRRLIB.c
		- GRRLIB.h
	- libpng (dir)
		- pngu (dir)
			- pngu.c
			- pngu.h
		- png.h
		- pngconf.h
	- main.cpp
Then, in your Makefile, your sources line would look like this:
SOURCES	:=	source source/gfx source/GRRLIB source/libpng source/libpng/pngu
If you need to include a file like pngu.h, you could add the following to the file you want to include it to:
#include "libpng/pngu/pngu.h"
That should point to what you need. Hope this helps.



Edited 2 time(s). Last edit at 03/21/2009 11:35PM by RazorChrist.
Re: GRRLIB Help
March 21, 2009 11:41PM
when i originally looded at the #include i it had a /./ , or /../ , i can't remember is that how you do it, i don
t want to mess with my files that much, but i will if i hav to.
Re: GRRLIB Help
March 22, 2009 03:41PM
Quote
g_man
when i originally looded at the #include i it had a /./ , or /../ , i can't remember is that how you do it, i don
t want to mess with my files that much, but i will if i hav to.

That was most likely the problem. I don't think it'll work if you use /./ or /../. Of course, I've never tried it that way, so it might.
Re: GRRLIB Help
March 22, 2009 05:20PM
so i'l have to change my files around?
Re: GRRLIB Help
March 22, 2009 05:50PM
Erm, yeah that would be the easy way.
Re: GRRLIB Help
March 22, 2009 07:58PM
Ok thanks it finally compiled, the problem was that it was trying to find the file's under GRRLIB so it couldn't find them, i havent done anything with GRRLIB, except initialize it so lets hope i can print a picture. thanks again

EDIT: I added this code and it came up with a bunch of errors
the code i'v added
extern const unsigned char ready[];
extern const int ready_size;

The errors i got
main.c
linking ... pong.elf
main.o: In function `main':
d:/homebrew/mystuff/pong/source/main.c:107: undefined reference to `ready'
d:/homebrew/mystuff/pong/source/main.c:107: undefined reference to `ready'
GRRLIB.o: In function `GRRLIB_LoadTexturePNG':
d:/homebrew/mystuff/pong/source/GRRLIB/GRRLIB.c:138: undefined reference to `PNGU_SelectImageFromBuffer'
d:/homebrew/mystuff/pong/source/GRRLIB/GRRLIB.c:139: undefined reference to `PNGU_GetImageProperties'
d:/homebrew/mystuff/pong/source/GRRLIB/GRRLIB.c:141: undefined reference to `PNGU_DecodeTo4x4RGBA8'
d:/homebrew/mystuff/pong/source/GRRLIB/GRRLIB.c:142: undefined reference to `PNGU_ReleaseImageContext'
collect2: ld returned 1 exit status
make[1]: *** [/d/homebrew/mystuff/pong/pong.elf] Error 1
"make": *** [build] Error 2

I used raw2c to make a header file, i included the header file too.
i made the header file from a jpg image
is there a better way to load pictures with GRRLIB?

if i don't add the code then it says ready isn't referenced.



Edited 1 time(s). Last edit at 03/22/2009 08:13PM by g_man.
Re: GRRLIB Help
March 22, 2009 10:05PM
Instead of using JPEG, use PNG images, convert to .h with WiiBuilder 1.0, then use the following code to load the image:
#include "gfx/image.h"

u8 *tex_image=GRRLIB_LoadTexture(image);

GRRLIB_DrawImg(x,y,height,width,tex_image,0,1,1,255);

When you're converting the PNG with WiiBuilder, if you happen to get a warning that says "not a multiple of 4", just check the image dimensions and make sure whatever the dimensions are, they can divide by 4.



Edited 1 time(s). Last edit at 03/22/2009 10:06PM by RazorChrist.
Re: GRRLIB Help
March 22, 2009 10:17PM
sorry, i was working with a png, and when i tryed that i got this

main.c
d:/homebrew/mystuff/pong/source/main.c: In function 'main':
d:/homebrew/mystuff/pong/source/main.c:106: error: 'ready' undeclared (first use in this function)
d:/homebrew/mystuff/pong/source/main.c:106: error: (Each undeclared identifier is reported only once
d:/homebrew/mystuff/pong/source/main.c:106: error: for each function it appears in.)
d:/homebrew/mystuff/pong/source/main.c:106: error: incompatible types in initialization
d:/homebrew/mystuff/pong/source/main.c:108: error: incompatible type for argument 3 of 'GRRLIB_DrawImg'
d:/homebrew/mystuff/pong/source/main.c:108: error: incompatible type for argument 5 of 'GRRLIB_DrawImg'
d:/homebrew/mystuff/pong/source/main.c:108: error: too many arguments to function 'GRRLIB_DrawImg'
make[1]: *** [main.o] Error 1
"make": *** [build] Error 2

I also deleted this part
extern const unsigned char ready[];
extern const int ready_size;
EDIT:
i just tryed it with this in
extern const unsigned char ready[];
extern const int ready_size;

And now i'm only getting
main.c
d:/homebrew/mystuff/pong/source/main.c: In function 'main':
d:/homebrew/mystuff/pong/source/main.c:109: error: incompatible types in initialization
d:/homebrew/mystuff/pong/source/main.c:111: error: incompatible type for argument 3 of 'GRRLIB_DrawImg'
d:/homebrew/mystuff/pong/source/main.c:111: error: incompatible type for argument 5 of 'GRRLIB_DrawImg'
d:/homebrew/mystuff/pong/source/main.c:111: error: too many arguments to function 'GRRLIB_DrawImg'
make[1]: *** [main.o] Error 1
"make": *** [build] Error 2
looks as though i'm using the wrong data type in the line you gave me here
u8 *tex_image=GRRLIB_LoadTexture(image);

GRRLIB_DrawImg(x,y,height,width,tex_image,0,1,1,255);



Edited 1 time(s). Last edit at 03/22/2009 10:21PM by g_man.
Re: GRRLIB Help
March 22, 2009 10:21PM
Ok, on this line:
GRRLIB_DrawImg(x,y,height,width,tex_image,0,1,1,255);
You should be putting the actual x,y,height,width values in. Example, instead of the above, it should be something like:
GRRLIB_DrawImg(0,0,640,480,tex_image,0,1,1,255);

And the "image.h" should be whatever the name of the image is you're including...I was just using "image" as an example name.



Edited 2 time(s). Last edit at 03/22/2009 10:25PM by RazorChrist.
Re: GRRLIB Help
March 22, 2009 10:29PM
sorry, i forgot to say that i did all off that, and those are the errors i got, sorry for being unclear
Re: GRRLIB Help
March 23, 2009 12:00AM
Oh....I bet you're using the newest version of GRRLIB, which doesn't use GRRLIB_DrawImg. I'm using version 3.0. Sorry bout that....can't believe I didn't think about that earlier.
Re: GRRLIB Help
March 23, 2009 12:49AM
Ok, if anybody knows about the newer version of GRRLIB then can u help, i fixed my code, but it looks like something is still wrong
This is where the error is
	u8 *tex_ready=GRRLIB_LoadTexture(ready);
error:
d:/homebrew/mystuff/pong/source/main.c:134: error: incompatible types in initialization

Re: GRRLIB Help
March 23, 2009 01:05AM
Again, that's the different in syntax between version 3.0 and 4.0, I believe.



Edited 1 time(s). Last edit at 03/23/2009 01:06AM by RazorChrist.
Sorry, only registered users may post in this forum.

Click here to login