You are not logged in.

#1 2011-03-12 22:58:43

jimmys317
Member

need help in getting image coordinates

hello guys,im new in wii programming.i have managed to project some images and a png control with the wii remote on the 'game' but the last think left to do is the collision thing.I cannot figure out what could i do in order to check if the png file controller by wii remote collides with an projected,any help is appreciated smile

Offline

 

#2 2011-03-13 15:42:34

Crayon
Bad Mother Fucker

Re: need help in getting image coordinates

Maybe those simple collision functions will work for you:
GRRLIB_PtInRect
GRRLIB_RectInRect
GRRLIB_RectOnRect

Offline

 

#3 2011-03-13 16:41:42

jimmys317
Member

Re: need help in getting image coordinates

thank you for your reply but,i dont think that these functions can help me.I need to find the exaclty x,y coordinates of my image which is randomly created with the function rand().and also there is no command like target.x or target_x (target is the texture)

Offline

 

#4 2011-03-13 16:46:37

Crayon
Bad Mother Fucker

Re: need help in getting image coordinates

If you generate the coordinates why don't you keep them in memory

Offline

 

#5 2011-03-13 16:47:54

jimmys317
Member

Re: need help in getting image coordinates

i have thought of doing that,i will give it a try and then i will tell u the result

Offline

 

#6 2011-03-13 16:50:52

Crayon
Bad Mother Fucker

Re: need help in getting image coordinates

If you need information about the GRRLIB_texImg structure: http://grrlib.santo.fr/doc/struct_g_r_r … x_img.html

Offline

 

#7 2011-03-13 17:01:16

jimmys317
Member

Re: need help in getting image coordinates

thank y but i dont think that i can manage to deal with rectonrect function,is there any function like if pic.bounces.interceptswith(pic2.bounce)then (visual basic)

Offline

 

#8 2011-03-13 17:02:46

Crayon
Bad Mother Fucker

Re: need help in getting image coordinates

Look at the code in the basic_drawing example folder.  Check the code where Link is moving over a rupee.

Offline

 

#9 2011-03-13 17:03:39

jimmys317
Member

Re: need help in getting image coordinates

my code is based on this example but it uses  rectonrect function this one"(GRRLIB_RectOnRect(320+left, 240+top, 48, 64, 618, 434, 12, 30))"

Offline

 

#10 2011-03-13 17:30:32

jimmys317
Member

Re: need help in getting image coordinates

something last,how can i get x,y-coordinate of the upper-left corner of the rectangle.

Offline

 

#11 2011-03-13 17:34:39

Crayon
Bad Mother Fucker

Re: need help in getting image coordinates

It's so easy to do something like this:

static int CoordX = 0;
static int CoordY = 0;

...

CoordX = 22; // Random value
CoordY = 44; // Random value
GRRLIB_DrawImg(CoordX, CoordY, MyTexture, 0, 1, 1, 0xFFFFFFFF);

...

GRRLIB_RectOnRect using CoordX and CoordY...

Offline

 

#12 2011-03-13 17:40:40

jimmys317
Member

Re: need help in getting image coordinates

crayon thanks a lot !!!!u have solved my issue !!!!!!!!!!!!!!!!!!!!!!!!!

Offline

 

Board footer

Powered by FluxBB