You are not logged in.
I was wondering if anyone have created a function that can take x, y, width, height of source image and x and y of the destination (screen) when drawing an image?
A function like this:
void GRRLIB_DrawImg(f32 xpos, f32 ypos, f32 source_xpos, f32 source_ypos, u16 width, u16 height, u8 data[], float degrees, float scaleX, f32 scaleY, u8 alpha);
Example: You have an image that is 10 x 10 pixels, and only want to draw an area of 2 x 2 pixels located at the bottom right part of the source image to coordinates 0,0 on the screen, then you call the function like this:
GRRLIB_DrawImg(0, 0, 8, 8, 2, 2, image, 0, 1, 1, 255);
Would be nice to have a function like that..
Offline
Maybe the GRRLIB_DrawTile function would work for you check this page: http://grrlib.santo.fr/wiki/wikka.php?wakka=Day6
Offline
I did something similar for a flag waving effect for language selection in Mahjongg Wii, but I found that I has some corruption with parts of the image nearer the bottom. I figured out that I had to change the GGRLIB_DrawTile function slightly so that the tile number that you want to choose was a bigger variable type and this fixed it.
The original DrawTile function only supported one row of tiles, so I also changed it to support any amount of rows and columns (as long as the image does not go over 1024 for x or y pixels)
When I get home (if I remember ) I will post my version on here
The only other thing is that the tiles have to be multiples of 4 so your idea of 2x2 would not be possible
Last edited by JustWoody (2009-01-27 10:19:43)
Offline
hi,
The svn version support 1024x1024 tileset.
no more glishes at the middle of the screen, and lot of more
Check it now !! and enjoy !!
http://code.google.com/p/grrlib/source/checkout
ps: the tiles do not have to be a multiple of 4, only the tileset does.
Offline
Ohhhh, is it so. That is really good to know. Then I guess I could use the DrawTile function 'Crayon' mentioned earlier in this thread.
Perhaps I'll write a new function that is compatible with the "new" GRRLIB version, since I use the SVN version now..
NoNameNo wrote:
ps: the tiles do not have to be a multiple of 4, only the tileset does.
Offline