mirror of
https://github.com/GRRLIB/GRRLIB.git
synced 2024-11-25 16:22:20 +00:00
[CHG] Added some comments
This commit is contained in:
parent
c0ababb4e4
commit
324f4792e8
2 changed files with 23 additions and 21 deletions
|
@ -433,13 +433,18 @@ bool GRRLIB_RectOnRect(int rect1x, int rect1y, int rect1w, int rect1h, int rect2
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the color value of a pixel from a GRRLIB_texImg !!!!!!!!!!!!!!!! NOT WORKING NEED HELP !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
* Return the color value of a pixel from a GRRLIB_texImg
|
||||||
|
* @bug !!!!!!!!!!!!!!!! NOT WORKING NEED HELP !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
* @param x specifies the x-coordinate of the pixel in the texture.
|
||||||
|
* @param y specifies the y-coordinate of the pixel in the texture.
|
||||||
|
* @param tex texture to get the color from.
|
||||||
|
* @return The color of a pixel.
|
||||||
*/
|
*/
|
||||||
u32 GRRLIB_GetPixelFromtexImg(int x, int y, GRRLIB_texImg tex){
|
u32 GRRLIB_GetPixelFromtexImg(int x, int y, GRRLIB_texImg tex){
|
||||||
u8 *truc = (u8*)tex.data;
|
u8 *truc = (u8*)tex.data;
|
||||||
u32 x1,y1;
|
u32 x1, y1;
|
||||||
u8 r,g,b,a;
|
u8 r, g, b, a;
|
||||||
u32 value=0;
|
u32 value;
|
||||||
u32 offset;
|
u32 offset;
|
||||||
|
|
||||||
x1 = x >> 2; // div by 4
|
x1 = x >> 2; // div by 4
|
||||||
|
@ -453,17 +458,21 @@ u32 GRRLIB_GetPixelFromtexImg(int x, int y, GRRLIB_texImg tex){
|
||||||
|
|
||||||
value = (r<<24) | (g<<16) | (b<<8) | a;
|
value = (r<<24) | (g<<16) | (b<<8) | a;
|
||||||
|
|
||||||
|
|
||||||
return(value);
|
return(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the color value of a pixel to a GRRLIB_texImg !!!!!!!!!!!!!!!! NOT WORKING NEED HELP !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
* Set the color value of a pixel to a GRRLIB_texImg
|
||||||
|
* @bug !!!!!!!!!!!!!!!! NOT WORKING NEED HELP !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
* @param x specifies the x-coordinate of the pixel in the texture.
|
||||||
|
* @param y specifies the y-coordinate of the pixel in the texture.
|
||||||
|
* @param tex texture to set the color to.
|
||||||
|
* @param color the color of the pixel.
|
||||||
*/
|
*/
|
||||||
void GRRLIB_SetPixelTotexImg(int x, int y, GRRLIB_texImg tex, u32 color){
|
void GRRLIB_SetPixelTotexImg(int x, int y, GRRLIB_texImg tex, u32 color){
|
||||||
u8 *truc = (u8*)tex.data;
|
u8 *truc = (u8*)tex.data;
|
||||||
u32 x1,y1;
|
u32 x1, y1;
|
||||||
u8 r,g,b,a;
|
u8 r, g, b, a;
|
||||||
u32 offset;
|
u32 offset;
|
||||||
|
|
||||||
x1 = x >> 2; // div by 4
|
x1 = x >> 2; // div by 4
|
||||||
|
@ -475,13 +484,10 @@ void GRRLIB_SetPixelTotexImg(int x, int y, GRRLIB_texImg tex, u32 color){
|
||||||
g=(color>>16) & 0xFF;
|
g=(color>>16) & 0xFF;
|
||||||
b=(color>>24) & 0xFF;
|
b=(color>>24) & 0xFF;
|
||||||
|
|
||||||
|
|
||||||
*(truc+offset)=a;
|
*(truc+offset)=a;
|
||||||
*(truc+offset+1)=r;
|
*(truc+offset+1)=r;
|
||||||
*(truc+offset+32)=g;
|
*(truc+offset+32)=g;
|
||||||
*(truc+offset+33)=b;
|
*(truc+offset+33)=b;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include "gfx/sprite.h"
|
#include "gfx/sprite.h"
|
||||||
#include "gfx/pixeltest.h"
|
#include "gfx/pixeltest.h"
|
||||||
|
|
||||||
|
|
||||||
// Tile stuff
|
// Tile stuff
|
||||||
#define TILE_DELAY 10
|
#define TILE_DELAY 10
|
||||||
#define TILE_UP 12*0
|
#define TILE_UP 12*0
|
||||||
|
@ -57,7 +56,7 @@ Mtx GXmodelView2D;
|
||||||
int main() {
|
int main() {
|
||||||
int left = 0, top = 0, page = 0, frame = TILE_DOWN + 1;
|
int left = 0, top = 0, page = 0, frame = TILE_DOWN + 1;
|
||||||
unsigned int wait = TILE_DELAY, direction = TILE_DOWN, direction_new = TILE_DOWN;
|
unsigned int wait = TILE_DELAY, direction = TILE_DOWN, direction_new = TILE_DOWN;
|
||||||
int x=0,y=0,val=0;
|
int x, y, val;
|
||||||
ir_t ir1;
|
ir_t ir1;
|
||||||
u32 wpaddown, wpadheld;
|
u32 wpaddown, wpadheld;
|
||||||
Vector triangle[] = {{400,200,0.0f}, {500,400,0.0f}, {300,400,0.0f}};
|
Vector triangle[] = {{400,200,0.0f}, {500,400,0.0f}, {300,400,0.0f}};
|
||||||
|
@ -90,8 +89,6 @@ int main() {
|
||||||
GRRLIB_texImg tex_BMfont5 = GRRLIB_LoadTexturePNG(BMfont5);
|
GRRLIB_texImg tex_BMfont5 = GRRLIB_LoadTexturePNG(BMfont5);
|
||||||
GRRLIB_InitTileSet(&tex_BMfont5, 8, 16, 0);
|
GRRLIB_InitTileSet(&tex_BMfont5, 8, 16, 0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
WPAD_SetVRes(0, 640, 480);
|
WPAD_SetVRes(0, 640, 480);
|
||||||
WPAD_ScanPads();
|
WPAD_ScanPads();
|
||||||
|
@ -110,14 +107,13 @@ int main() {
|
||||||
GRRLIB_DrawImg(10, 50, tex_test_jpg, 0, 1, 1, GRRLIB_WHITE);
|
GRRLIB_DrawImg(10, 50, tex_test_jpg, 0, 1, 1, GRRLIB_WHITE);
|
||||||
GRRLIB_DrawImg(400, 150, tex_pixeltest, 0, 1, 1, GRRLIB_WHITE);
|
GRRLIB_DrawImg(400, 150, tex_pixeltest, 0, 1, 1, GRRLIB_WHITE);
|
||||||
|
|
||||||
for(y=0;y<tex_pixeltest.h;y++){ //------------ <just a test>
|
for(y=0; y<tex_pixeltest.h; y++) { //------------ <just a test>
|
||||||
for(x=0;x<(tex_pixeltest.w*20);x++){
|
for(x=0; x<(tex_pixeltest.w*20); x++) {
|
||||||
val = 1 + (int) (16777215.0 * (rand() / (RAND_MAX + 1.0)));
|
val = 1 + (int) (16777215.0 * (rand() / (RAND_MAX + 1.0)));
|
||||||
GRRLIB_SetPixelTotexImg(x,y,tex_pixeltest,(val<<8)|0xFF);
|
GRRLIB_SetPixelTotexImg(x, y, tex_pixeltest, (val<<8)|0xFF);
|
||||||
}
|
}
|
||||||
} //------------ </just a test>
|
} //------------ </just a test>
|
||||||
|
|
||||||
|
|
||||||
// Draw a sprite
|
// Draw a sprite
|
||||||
GRRLIB_DrawTile(600, 400, tex_sprite_png, 0, 2, 2, GRRLIB_WHITE, 12*4); // Rupee
|
GRRLIB_DrawTile(600, 400, tex_sprite_png, 0, 2, 2, GRRLIB_WHITE, 12*4); // Rupee
|
||||||
GRRLIB_DrawTile(320+left, 240+top, tex_sprite_png, 0, 2, 2, GRRLIB_WHITE, frame);
|
GRRLIB_DrawTile(320+left, 240+top, tex_sprite_png, 0, 2, 2, GRRLIB_WHITE, frame);
|
||||||
|
|
Loading…
Reference in a new issue