[CHG] Template has a GRRLIB_NGoneFilled example and text with alpha

This commit is contained in:
Crayon2000 2009-01-28 06:37:03 +00:00
parent 141e14ed07
commit 188c9790b8
2 changed files with 12 additions and 7 deletions

View file

@ -35,7 +35,7 @@ inline void GRRLIB_FillScreen(u32 color) {
* @param color the color of the dot.
*/
inline void GRRLIB_Plot(f32 x, f32 y, u32 color) {
Vector v[] = {{x,y,0.0f}};
Vector v[] = {{x,y,0.0f}};
GRRLIB_NPlot(v, color, 1);
}
@ -59,7 +59,7 @@ void GRRLIB_NPlot(Vector v[], u32 color, long n) {
* @param color line color.
*/
inline void GRRLIB_Line(f32 x1, f32 y1, f32 x2, f32 y2, u32 color) {
Vector v[] = {{x1,y1,0.0f}, {x2,y2,0.0f}};
Vector v[] = {{x1,y1,0.0f}, {x2,y2,0.0f}};
GRRLIB_NGone(v, color, 2);
}
@ -76,7 +76,7 @@ inline void GRRLIB_Line(f32 x1, f32 y1, f32 x2, f32 y2, u32 color) {
inline void GRRLIB_Rectangle(f32 x, f32 y, f32 width, f32 height, u32 color, u8 filled) {
f32 x2 = x+width;
f32 y2 = y+height;
Vector v[] = {{x,y,0.0f}, {x2,y,0.0f}, {x2,y2,0.0f}, {x,y2,0.0f}, {x,y,0.0f}};
Vector v[] = {{x,y,0.0f}, {x2,y,0.0f}, {x2,y2,0.0f}, {x,y2,0.0f}, {x,y,0.0f}};
if(!filled) {
GRRLIB_NGone(v, color, 5);

View file

@ -40,6 +40,8 @@
#define GRRLIB_GRAY 0x808080FF
#define GRRLIB_YELLOW 0xFFFF00FF
#define GRRLIB_SILVER 0xC0C0C0FF
#define GRRLIB_AQUA 0x00FFFFFF
#define GRRLIB_LIME 0x00FF00FF
Mtx GXmodelView2D;
@ -48,6 +50,7 @@ int main() {
unsigned int wait = TILE_DELAY, direction = TILE_DOWN, direction_new = TILE_DOWN;
ir_t ir1;
u32 wpaddown, wpadheld;
Vector triangle[] = {{400,200,0.0f}, {500,400,0.0f}, {300,400,0.0f}};
GRRLIB_Init();
@ -90,7 +93,7 @@ int main() {
GRRLIB_DrawImg(10, 50, tex_test_jpg, 0, 1, 1, GRRLIB_WHITE);
// Draw a sprite
GRRLIB_DrawTile(600, 400, tex_link_png, 0, 2, 2, GRRLIB_WHITE, 12*4); // Rupy
GRRLIB_DrawTile(600, 400, tex_link_png, 0, 2, 2, GRRLIB_WHITE, 12*4); // Rupee
GRRLIB_DrawTile(320+left, 240+top, tex_link_png, 0, 2, 2, GRRLIB_WHITE, frame);
if(GRRLIB_RectOnRect(320+left, 240+top, 48, 64, 618, 434, 12, 30))
WPAD_Rumble(WPAD_CHAN_0, 1);
@ -119,8 +122,9 @@ int main() {
GRRLIB_Printf(5, 25, tex_BMfont2, GRRLIB_WHITE, 1, "SHAPES DEMO");
GRRLIB_Rectangle(100, 100, 200, 100, GRRLIB_RED, 1);
GRRLIB_Rectangle(left + 150, top + 150, 200, 200, 0x0000FFC8, 1); // Blue with alpha
GRRLIB_Line(100, 100, 350, 200, GRRLIB_SILVER);
GRRLIB_NGoneFilled(triangle, GRRLIB_GRAY, 3);
GRRLIB_Rectangle(left + 150, top + 150, 200, 200, 0x0000FFC8, 1); // Blue with alpha
// Draw a yellow four pixel dot where the wiimote is pointing
GRRLIB_Plot(ir1.sx, ir1.sy, GRRLIB_YELLOW);
@ -134,8 +138,9 @@ int main() {
GRRLIB_Printf(5, 100, tex_BMfont4, GRRLIB_WHITE, 1, "TO QUIT PRESS THE HOME BUTTON.");
GRRLIB_Printf(5, 140, tex_BMfont4, GRRLIB_YELLOW, 1, "USE + AND - TO MOVE ACROSS PAGES.");
GRRLIB_Printf(5, 180, tex_BMfont4, GRRLIB_GREEN, 1, "USE THE D-PAD TO MOVE STUFF.");
GRRLIB_Printf(left, top+250, tex_BMfont1, GRRLIB_WHITE, 1, "X VALUE: %d", (int)ir1.sx);
GRRLIB_Printf(left, top+300, tex_BMfont3, GRRLIB_WHITE, 1, "Y VALUE: %d", (int)ir1.sy);
GRRLIB_Printf(left, top+250, tex_BMfont1, GRRLIB_WHITE, 1, "IR X VALUE: %d", (int)ir1.x);
GRRLIB_Printf(left, top+300, tex_BMfont3, GRRLIB_WHITE, 1, "IR Y VALUE: %d", (int)ir1.y);
GRRLIB_Printf(left, top+350, tex_BMfont3, 0XFFFFFF50, 1, "TEXT WITH ALPHA");
}
GRRLIB_Render();