mirror of
https://github.com/GRRLIB/GRRLIB.git
synced 2024-12-23 10:49:20 +00:00
lib-conversion moved to trunk, version is now 4.1.0
This commit is contained in:
parent
68a63bf966
commit
ee128f47bc
49 changed files with 11249 additions and 0 deletions
18
GRRLIB/GRRLIB/-README-.txt
Normal file
18
GRRLIB/GRRLIB/-README-.txt
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
*** Temporary fix ***
|
||||||
|
After the release of libogc v1.7.1a, Vector was renamed to guVector
|
||||||
|
"to avoid collisions" [svn 3650]
|
||||||
|
...also Quaternion was renamed to guQuaternion - but GRRLIB does not use these!
|
||||||
|
|
||||||
|
The main codebase of GRRLIB has been updated to reflect this change.
|
||||||
|
But until the new libogc is officially released,
|
||||||
|
if you are using a version of libogc later than v1.7.1a/svn3649,
|
||||||
|
you will need to add:
|
||||||
|
-DNOGUFIX
|
||||||
|
to the compiler flags in your makefile
|
||||||
|
|
||||||
|
When the libogc changes are officially released,
|
||||||
|
this *temporary fix* should be removed [see grrlib.h, line 50ish]
|
||||||
|
The requirement for -DNOGUFIX will be deprecated,
|
||||||
|
but its lingering presence will not be a hinderance
|
||||||
|
|
||||||
|
Thanks to Nicksasa for reporting this problem :)
|
133
GRRLIB/GRRLIB/GRRLIB_addon/GRRLIB_addon.c
Normal file
133
GRRLIB/GRRLIB/GRRLIB_addon/GRRLIB_addon.c
Normal file
|
@ -0,0 +1,133 @@
|
||||||
|
/*===========================================
|
||||||
|
GRRLIB (GX version) 4.0.0 addon
|
||||||
|
Code : NoNameNo
|
||||||
|
Additional Code : Crayon & Xane
|
||||||
|
GX hints : RedShade
|
||||||
|
===========================================*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <malloc.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "../lib/libpng/pngu/pngu.h"
|
||||||
|
#include "GRRLIB.h"
|
||||||
|
#include <fat.h>
|
||||||
|
|
||||||
|
#include "GRRLIB_addon/GRRLIBfont.h"
|
||||||
|
#include "GRRLIB_addon/GRRLIBbutton.h"
|
||||||
|
|
||||||
|
extern u32 fb;
|
||||||
|
extern void *xfb[2];
|
||||||
|
extern GXRModeObj *rmode;
|
||||||
|
|
||||||
|
GRRLIB_texImg *tex_GRRLIBfont;
|
||||||
|
GRRLIB_texImg *tex_GRRLIBbutton;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initalize all addon requirement
|
||||||
|
*/
|
||||||
|
void GRRLIB_addon_Init(){
|
||||||
|
tex_GRRLIBfont = GRRLIB_LoadTexture(GRRLIBfont);
|
||||||
|
GRRLIB_InitTileSet(tex_GRRLIBfont, 16, 19, 32);
|
||||||
|
|
||||||
|
tex_GRRLIBbutton = GRRLIB_LoadTexture(GRRLIBbutton);
|
||||||
|
GRRLIB_InitTileSet(tex_GRRLIBbutton, 4, 24, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Free all addon requirement
|
||||||
|
*/
|
||||||
|
void GRRLIB_addon_Exit(){
|
||||||
|
GRRLIB_FreeTexture(tex_GRRLIBfont);
|
||||||
|
GRRLIB_FreeTexture(tex_GRRLIBbutton);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load a texture from a file.
|
||||||
|
* @param filename The JPEG or PNG filename to load.
|
||||||
|
* @return A GRRLIB_texImg structure filled with image informations.
|
||||||
|
*/
|
||||||
|
GRRLIB_texImg *GRRLIB_LoadTextureFromFile(const char *filename) {
|
||||||
|
fatInitDefault();
|
||||||
|
FILE *fd = fopen(filename, "rb");
|
||||||
|
|
||||||
|
fseek(fd, 0, SEEK_END);
|
||||||
|
long lsize = ftell(fd);
|
||||||
|
rewind(fd);
|
||||||
|
|
||||||
|
unsigned char *buffer = (unsigned char*) malloc (sizeof(unsigned char)*lsize);
|
||||||
|
fread (buffer, 1, lsize, fd);
|
||||||
|
GRRLIB_texImg *tex = GRRLIB_LoadTexture(buffer);
|
||||||
|
free(buffer);
|
||||||
|
|
||||||
|
fclose(fd);
|
||||||
|
return tex;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make a PNG screenshot on the SD card.
|
||||||
|
* libfat is required to use the function.
|
||||||
|
* @param File name of the file to write.
|
||||||
|
* @return true if every thing worked, false otherwise.
|
||||||
|
*/
|
||||||
|
bool GRRLIB_ScrShot(const char* File) {
|
||||||
|
int ErrorCode = -1;
|
||||||
|
IMGCTX pngContext;
|
||||||
|
|
||||||
|
if(fatInitDefault() && (pngContext = PNGU_SelectImageFromDevice(File))) {
|
||||||
|
ErrorCode = PNGU_EncodeFromYCbYCr(pngContext, rmode->fbWidth, rmode->efbHeight, xfb[fb], 0);
|
||||||
|
PNGU_ReleaseImageContext(pngContext);
|
||||||
|
}
|
||||||
|
return !ErrorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Easy Button Maker.
|
||||||
|
* @param indice Index number of your button.
|
||||||
|
* @param x top-left corner X position of the button.
|
||||||
|
* @param y top-left corner Y position of the button.
|
||||||
|
* @param col color of your button.
|
||||||
|
* @param wpadx your X wpad posistion.
|
||||||
|
* @param wpady your Y wpad posistion.
|
||||||
|
* @param WPADDown your wpad button Down Status.
|
||||||
|
* @param WPADHeld your wpad button Held Status.
|
||||||
|
* @param but The wpad button you want to check.
|
||||||
|
* @param resdown You will find here the downed button index number.
|
||||||
|
* @param resheld You will find here the helded button index number.
|
||||||
|
* @param toto Text on the button.
|
||||||
|
*/
|
||||||
|
void GRRLIB_addon_Button(int indice, int x,int y,u32 col, int wpadx, int wpady, u32 WPADDown, u32 WPADHeld, int but, int *resdown, int *resheld, char toto[]){
|
||||||
|
int butwidth=strlen(toto)*16+8;
|
||||||
|
Vector bg[]={{x+4,y,0},{x+4+strlen(toto)*16,y,0},{x+4+strlen(toto)*16,y+24,0},{x+4,y+24,0}};
|
||||||
|
if((toto[0]=='^') && ((toto[1]=='U') || (toto[1]=='D') || (toto[1]=='L') || (toto[1]=='R'))){
|
||||||
|
butwidth=1*16+8;
|
||||||
|
bg[1].x=x+4+1*16;
|
||||||
|
bg[2].x=x+4+1*16;
|
||||||
|
}
|
||||||
|
|
||||||
|
GRRLIB_DrawTile(x,y, tex_GRRLIBbutton , 0, 1, 1, col,0 );
|
||||||
|
GRRLIB_DrawTileQuad(bg, tex_GRRLIBbutton, col,1 );
|
||||||
|
GRRLIB_DrawTile(bg[1].x,y, tex_GRRLIBbutton , 0, 1, 1, col,2);
|
||||||
|
|
||||||
|
if(GRRLIB_PtInRect(x, y, butwidth, 24, wpadx, wpady)) {
|
||||||
|
if((toto[0]=='^') && (toto[1]=='U')) GRRLIB_Printf(x+4, y+2, tex_GRRLIBfont, 0xFFFFFFFF, 1, "%c", 0xa1);
|
||||||
|
else if((toto[0]=='^') && (toto[1]=='D')) GRRLIB_Printf(x+4, y+2, tex_GRRLIBfont, 0xFFFFFFFF, 1, "%c", 0xa2);
|
||||||
|
else if((toto[0]=='^') && (toto[1]=='L')) GRRLIB_Printf(x+4, y+2, tex_GRRLIBfont, 0xFFFFFFFF, 1, "%c", 0xa3);
|
||||||
|
else if((toto[0]=='^') && (toto[1]=='R')) GRRLIB_Printf(x+4, y+2, tex_GRRLIBfont, 0xFFFFFFFF, 1, "%c", 0xa4);
|
||||||
|
else GRRLIB_Printf(x+4, y+2, tex_GRRLIBfont, 0xFFFFFFFF, 1, toto);
|
||||||
|
if(WPADDown & but) {
|
||||||
|
*resdown=indice;
|
||||||
|
}
|
||||||
|
if(WPADHeld & but) {
|
||||||
|
*resheld=indice;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if((toto[0]=='^') && (toto[1]=='U')) GRRLIB_Printf(x+4, y+2, tex_GRRLIBfont, 0xFFFFFF77, 1, "%c", 0xa1);
|
||||||
|
else if((toto[0]=='^') && (toto[1]=='D')) GRRLIB_Printf(x+4, y+2, tex_GRRLIBfont, 0xFFFFFF77, 1, "%c", 0xa2);
|
||||||
|
else if((toto[0]=='^') && (toto[1]=='L')) GRRLIB_Printf(x+4, y+2, tex_GRRLIBfont, 0xFFFFFF77, 1, "%c", 0xa3);
|
||||||
|
else if((toto[0]=='^') && (toto[1]=='R')) GRRLIB_Printf(x+4, y+2, tex_GRRLIBfont, 0xFFFFFF77, 1, "%c", 0xa4);
|
||||||
|
else GRRLIB_Printf(x+4, y+2, tex_GRRLIBfont, 0xFFFFFF77, 1, toto);
|
||||||
|
}
|
||||||
|
}
|
33
GRRLIB/GRRLIB/GRRLIB_addon/GRRLIB_addon.h
Normal file
33
GRRLIB/GRRLIB/GRRLIB_addon/GRRLIB_addon.h
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
/*===========================================
|
||||||
|
GRRLIB (GX version) 4.0.0 addon
|
||||||
|
Code : NoNameNo
|
||||||
|
Additional Code : Crayon & Xane
|
||||||
|
GX hints : RedShade
|
||||||
|
===========================================*/
|
||||||
|
|
||||||
|
#ifndef __GRRLIB_ADDON__
|
||||||
|
#define __GRRLIB_ADDON__
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file GRRLIBaddon.h
|
||||||
|
* GRRLIB library.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
void GRRLIB_addon_Init();
|
||||||
|
void GRRLIB_addon_Exit();
|
||||||
|
GRRLIB_texImg *GRRLIB_LoadTextureFromFile(const char *filename);
|
||||||
|
bool GRRLIB_ScrShot(const char*);
|
||||||
|
void GRRLIB_addon_Button(int indice, int x,int y,u32 col, int wpadx, int wpady, u32 WPADDown, u32 WPADHeld, int but, int *resdown, int *resheld, char toto[]);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
32
GRRLIB/GRRLIB/GRRLIB_addon/GRRLIBbutton.c
Normal file
32
GRRLIB/GRRLIB/GRRLIB_addon/GRRLIBbutton.c
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
This file was autogenerated by raw2c.
|
||||||
|
Visit http://www.devkitpro.org
|
||||||
|
*/
|
||||||
|
|
||||||
|
const unsigned char GRRLIBbutton[] = {
|
||||||
|
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
|
||||||
|
0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x18, 0x08, 0x06, 0x00, 0x00, 0x00, 0xce, 0x32, 0x1c,
|
||||||
|
0x6a, 0x00, 0x00, 0x00, 0x01, 0x73, 0x52, 0x47, 0x42, 0x00, 0xae, 0xce, 0x1c, 0xe9, 0x00, 0x00,
|
||||||
|
0x00, 0x06, 0x62, 0x4b, 0x47, 0x44, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0xa0, 0xbd, 0xa7, 0x93,
|
||||||
|
0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x0b, 0x13, 0x00, 0x00, 0x0b, 0x13,
|
||||||
|
0x01, 0x00, 0x9a, 0x9c, 0x18, 0x00, 0x00, 0x00, 0x07, 0x74, 0x49, 0x4d, 0x45, 0x07, 0xd9, 0x03,
|
||||||
|
0x13, 0x02, 0x17, 0x23, 0x58, 0x89, 0x44, 0x6c, 0x00, 0x00, 0x00, 0xf9, 0x49, 0x44, 0x41, 0x54,
|
||||||
|
0x38, 0xcb, 0xed, 0x93, 0xcd, 0x8d, 0xc5, 0x20, 0x0c, 0x84, 0x07, 0x30, 0x01, 0x29, 0x8d, 0xa4,
|
||||||
|
0xac, 0x94, 0x96, 0x0a, 0x52, 0x4f, 0x0a, 0x48, 0x0b, 0xf9, 0x01, 0x0c, 0xde, 0x43, 0x44, 0xf4,
|
||||||
|
0x0e, 0x79, 0x64, 0xf7, 0xbe, 0x96, 0x10, 0x17, 0x7f, 0xf2, 0x8c, 0x19, 0x14, 0x00, 0x2c, 0xcb,
|
||||||
|
0x22, 0x22, 0x02, 0x11, 0xc1, 0x53, 0x29, 0xa5, 0xa0, 0x94, 0xc2, 0x30, 0x0c, 0x4a, 0xcd, 0xf3,
|
||||||
|
0x2c, 0x31, 0x46, 0xe4, 0x9c, 0x91, 0x73, 0x7e, 0x04, 0x8c, 0x31, 0x30, 0xc6, 0xa0, 0xeb, 0x3a,
|
||||||
|
0xd0, 0xbe, 0xef, 0x08, 0x21, 0x80, 0x99, 0x9b, 0x00, 0x11, 0x81, 0x99, 0x41, 0xc7, 0x71, 0xe0,
|
||||||
|
0x3c, 0x4f, 0xa4, 0x94, 0x9a, 0x80, 0xb5, 0x16, 0xa5, 0x14, 0x50, 0x8c, 0x11, 0x21, 0x84, 0x57,
|
||||||
|
0xa0, 0x94, 0x02, 0xad, 0xf5, 0x05, 0xc4, 0x18, 0x5f, 0x01, 0x11, 0xb9, 0xa4, 0xa5, 0x94, 0x50,
|
||||||
|
0x0f, 0x33, 0x3f, 0x02, 0x44, 0x74, 0xdf, 0x14, 0x42, 0x40, 0x9d, 0xf2, 0x0d, 0xc8, 0x39, 0x43,
|
||||||
|
0x44, 0x2e, 0x49, 0xcc, 0x8c, 0xea, 0xa3, 0x94, 0xf2, 0x15, 0xb8, 0x27, 0x7c, 0xca, 0x69, 0x79,
|
||||||
|
0xd0, 0x5a, 0x23, 0xa5, 0x74, 0x01, 0xcc, 0xfc, 0xea, 0xe1, 0x06, 0x6a, 0x73, 0x6b, 0x4b, 0x55,
|
||||||
|
0xbf, 0xb5, 0x16, 0xb4, 0xae, 0x2b, 0xb6, 0x6d, 0xc3, 0x79, 0x9e, 0xcd, 0x09, 0xde, 0x7b, 0xf4,
|
||||||
|
0x7d, 0x0f, 0x8d, 0x3f, 0xd6, 0x3f, 0xf0, 0x2b, 0xa0, 0xfe, 0xd7, 0xb7, 0xaa, 0x7d, 0x54, 0x73,
|
||||||
|
0x52, 0x23, 0xdc, 0x8a, 0x86, 0x31, 0x06, 0xe4, 0x9c, 0xbb, 0x5f, 0xd8, 0x5a, 0xfb, 0x2c, 0x43,
|
||||||
|
0x6b, 0x78, 0xef, 0xe1, 0x9c, 0x83, 0x02, 0x80, 0x71, 0x1c, 0x25, 0x84, 0xd0, 0x4c, 0xab, 0x73,
|
||||||
|
0x0e, 0xd3, 0x34, 0xa9, 0x1f, 0x23, 0x30, 0xc3, 0x86, 0xb8, 0x36, 0x6a, 0xe5, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
|
||||||
|
};
|
||||||
|
const int GRRLIBbutton_size = sizeof(GRRLIBbutton);
|
14
GRRLIB/GRRLIB/GRRLIB_addon/GRRLIBbutton.h
Normal file
14
GRRLIB/GRRLIB/GRRLIB_addon/GRRLIBbutton.h
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
/*
|
||||||
|
This file was autogenerated by raw2c.
|
||||||
|
Visit http://www.devkitpro.org
|
||||||
|
*/
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------
|
||||||
|
#ifndef _GRRLIBbutton_h_
|
||||||
|
#define _GRRLIBbutton_h_
|
||||||
|
//---------------------------------------------------------------------------------
|
||||||
|
extern const unsigned char GRRLIBbutton[];
|
||||||
|
extern const int GRRLIBbutton_size;
|
||||||
|
//---------------------------------------------------------------------------------
|
||||||
|
#endif //_GRRLIBbutton_h_
|
||||||
|
//---------------------------------------------------------------------------------
|
BIN
GRRLIB/GRRLIB/GRRLIB_addon/GRRLIBbutton.png
Normal file
BIN
GRRLIB/GRRLIB/GRRLIB_addon/GRRLIBbutton.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 377 B |
231
GRRLIB/GRRLIB/GRRLIB_addon/GRRLIBfont.c
Normal file
231
GRRLIB/GRRLIB/GRRLIB_addon/GRRLIBfont.c
Normal file
|
@ -0,0 +1,231 @@
|
||||||
|
/*
|
||||||
|
This file was autogenerated by raw2c.
|
||||||
|
Visit http://www.devkitpro.org
|
||||||
|
*/
|
||||||
|
|
||||||
|
const unsigned char GRRLIBfont[] = {
|
||||||
|
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
|
||||||
|
0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x08, 0x06, 0x00, 0x00, 0x00, 0xf8, 0xea, 0xc8,
|
||||||
|
0x46, 0x00, 0x00, 0x00, 0x01, 0x73, 0x52, 0x47, 0x42, 0x00, 0xae, 0xce, 0x1c, 0xe9, 0x00, 0x00,
|
||||||
|
0x00, 0x06, 0x62, 0x4b, 0x47, 0x44, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0xa0, 0xbd, 0xa7, 0x93,
|
||||||
|
0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x0b, 0x13, 0x00, 0x00, 0x0b, 0x13,
|
||||||
|
0x01, 0x00, 0x9a, 0x9c, 0x18, 0x00, 0x00, 0x00, 0x07, 0x74, 0x49, 0x4d, 0x45, 0x07, 0xd9, 0x03,
|
||||||
|
0x13, 0x04, 0x1a, 0x0a, 0xab, 0x18, 0xde, 0xff, 0x00, 0x00, 0x0d, 0x67, 0x49, 0x44, 0x41, 0x54,
|
||||||
|
0x78, 0xda, 0xed, 0x9d, 0xdb, 0x8e, 0xe4, 0xaa, 0x0e, 0x40, 0xbb, 0xba, 0xf3, 0xff, 0x5f, 0x9c,
|
||||||
|
0x52, 0xce, 0x53, 0xb6, 0x18, 0x0e, 0x10, 0x03, 0x36, 0x18, 0xb2, 0x96, 0x34, 0xd2, 0xa8, 0x3a,
|
||||||
|
0xdc, 0x6d, 0xc0, 0xe6, 0xf6, 0xf9, 0x31, 0xe0, 0x3c, 0xcf, 0x2b, 0xfe, 0xed, 0x38, 0x8e, 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
|
||||||
|
0xe5, 0xd2, 0xb4, 0xde, 0x05, 0xb0, 0x82, 0x8d, 0xb8, 0xe3, 0x71, 0x6c, 0xce, 0xc0, 0x01, 0x00,
|
||||||
|
0x00, 0x18, 0x1a, 0xe5, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x70, 0x02, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe8, 0xc1, 0x2a, 0x06, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x22, 0xb4, 0x5e, 0x3e, 0x78, 0x1c, 0xc7, 0x47, 0x7c, 0x8b,
|
||||||
|
0xf6, 0xc8, 0x1b, 0x6b, 0x3d, 0xbe, 0x18, 0x30, 0x32, 0x9f, 0xa5, 0x4b, 0x45, 0xb4, 0xd3, 0x1c,
|
||||||
|
0xf5, 0x8e, 0x7a, 0x4b, 0x9c, 0x92, 0x78, 0x3c, 0xe7, 0x1f, 0xf6, 0xe9, 0x50, 0x69, 0xff, 0xb5,
|
||||||
|
0xc8, 0xf5, 0xa1, 0x2d, 0x37, 0x07, 0xd7, 0xb4, 0x7f, 0xea, 0xb9, 0xbc, 0x9f, 0x1f, 0xd9, 0x91,
|
||||||
|
0x81, 0x30, 0xcf, 0x71, 0xb8, 0xdc, 0x4b, 0x2c, 0x57, 0x39, 0xc2, 0x9f, 0x9f, 0x42, 0xb2, 0x9f,
|
||||||
|
0x52, 0xf8, 0xf0, 0xde, 0xb1, 0x4c, 0x1c, 0x9f, 0xa7, 0xf4, 0x1f, 0xd0, 0x08, 0x0f, 0x00, 0x00,
|
||||||
|
0x00, 0x0d, 0x4e, 0x80, 0xd4, 0x8f, 0xbb, 0xdd, 0x74, 0xb8, 0xda, 0xc4, 0x95, 0xba, 0x07, 0x00,
|
||||||
|
0x58, 0xbf, 0x0f, 0xbd, 0xf3, 0xf1, 0xf4, 0x82, 0x40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|
||||||
|
0x99, 0x73, 0x02, 0x84, 0x0e, 0x88, 0x15, 0x8c, 0xff, 0x52, 0x5c, 0x35, 0x61, 0x66, 0x1e, 0x69,
|
||||||
|
0x69, 0x14, 0x9e, 0xb2, 0xf1, 0xbd, 0xf2, 0xb6, 0x7f, 0x9c, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x1c,
|
||||||
|
0x00, 0x3c, 0x5b, 0x57, 0x67, 0x80, 0xc0, 0x00, 0xa1, 0xe6, 0x08, 0xc3, 0x6b, 0xc8, 0x5d, 0x94,
|
||||||
|
0xf7, 0x64, 0xdc, 0x79, 0x75, 0x00, 0xc5, 0xbb, 0x00, 0x62, 0xc7, 0xc5, 0x48, 0x07, 0x44, 0xaa,
|
||||||
|
0x3e, 0xbd, 0x1b, 0xff, 0xb9, 0x63, 0x54, 0x5e, 0xfb, 0x25, 0x17, 0x48, 0xee, 0x0e, 0xc8, 0x39,
|
||||||
|
0x1d, 0x5a, 0x57, 0xf1, 0xfb, 0x05, 0x96, 0xce, 0x0f, 0x00, 0x00, 0x60, 0x96, 0x03, 0x00, 0x03,
|
||||||
|
0x0c, 0x56, 0x04, 0xa7, 0xd5, 0x5e, 0x4e, 0x80, 0xa7, 0x6f, 0x56, 0xe8, 0x7f, 0x9e, 0x76, 0x01,
|
||||||
|
0x58, 0x1a, 0xdf, 0xb9, 0xd7, 0x06, 0xe2, 0x23, 0x09, 0xd6, 0x8e, 0x13, 0xcd, 0x95, 0xff, 0x99,
|
||||||
|
0xba, 0xbe, 0x54, 0xff, 0x52, 0x6b, 0xc4, 0xc7, 0xcd, 0x90, 0x0b, 0x2f, 0x69, 0xae, 0xa7, 0x6f,
|
||||||
|
0x5a, 0xe3, 0x05, 0x00, 0x00, 0x00, 0x3b, 0x07, 0x00, 0x86, 0x54, 0xa2, 0x52, 0x79, 0xbf, 0x1e,
|
||||||
|
0xc0, 0x35, 0x9e, 0xfb, 0xad, 0x11, 0x67, 0xff, 0x25, 0xc6, 0xff, 0x68, 0x27, 0x80, 0x85, 0xf1,
|
||||||
|
0x0f, 0xca, 0x4e, 0x80, 0x5c, 0x33, 0x8c, 0xda, 0x09, 0x80, 0x18, 0x00, 0x00, 0x00, 0xcc, 0x77,
|
||||||
|
0x00, 0x00, 0x40, 0x46, 0xb9, 0x70, 0x04, 0x99, 0x33, 0xfa, 0xc6, 0x7e, 0x7b, 0xfb, 0x26, 0xbd,
|
||||||
|
0x0b, 0xc0, 0xca, 0x00, 0xce, 0x19, 0xff, 0xb9, 0x67, 0x00, 0xad, 0x9c, 0x00, 0x18, 0xff, 0x0b,
|
||||||
|
0x38, 0x01, 0x9e, 0x9a, 0xc1, 0xda, 0x09, 0x80, 0x18, 0x00, 0x00, 0x00, 0xa8, 0xf0, 0xdb, 0x1b,
|
||||||
|
0x41, 0xeb, 0xea, 0x54, 0xef, 0xaa, 0x56, 0xb8, 0x42, 0x35, 0x23, 0xff, 0x5a, 0xe1, 0x67, 0xd5,
|
||||||
|
0x3f, 0xec, 0x51, 0xa7, 0xab, 0xeb, 0x9f, 0xc7, 0xf2, 0xd7, 0xc4, 0x69, 0x55, 0x7e, 0x69, 0xfd,
|
||||||
|
0x6a, 0x94, 0xbf, 0x64, 0xfc, 0xdf, 0x06, 0x78, 0xe9, 0x7b, 0x6f, 0xc6, 0xbf, 0x47, 0xfd, 0x5d,
|
||||||
|
0xa6, 0x4f, 0x29, 0xad, 0xf0, 0xcf, 0x34, 0xd2, 0x31, 0xfe, 0x01, 0x00, 0x00, 0xd4, 0x30, 0xd9,
|
||||||
|
0x01, 0xd0, 0x7b, 0xde, 0x76, 0x54, 0xf8, 0xdc, 0x4a, 0xe1, 0xec, 0xf4, 0x67, 0xd7, 0x3f, 0xac,
|
||||||
|
0xcd, 0x2a, 0xfa, 0xe7, 0xb5, 0xfc, 0x4f, 0x71, 0x3e, 0xe9, 0x6d, 0x6f, 0xfa, 0xf1, 0x2e, 0x80,
|
||||||
|
0x5a, 0x23, 0x38, 0x4c, 0xff, 0x29, 0x2f, 0x35, 0xc6, 0x7c, 0xee, 0x82, 0x42, 0x8d, 0xf2, 0x87,
|
||||||
|
0xf1, 0x85, 0xff, 0x2f, 0xc5, 0x55, 0xd3, 0x7f, 0xde, 0xf1, 0x58, 0xef, 0x0e, 0xd9, 0xa2, 0xef,
|
||||||
|
0x8d, 0x57, 0xf2, 0x6b, 0x8d, 0x6f, 0xed, 0x9d, 0x00, 0x18, 0xff, 0x00, 0x00, 0x00, 0xbe, 0x1c,
|
||||||
|
0x00, 0xb5, 0xb7, 0x70, 0xf7, 0x3e, 0xc3, 0x15, 0x87, 0xaf, 0x4d, 0xbf, 0x37, 0xff, 0xda, 0xe1,
|
||||||
|
0x47, 0xd7, 0x3f, 0xec, 0x55, 0xa7, 0xab, 0xeb, 0x9f, 0xc7, 0xf2, 0xd7, 0xc4, 0xb9, 0x5b, 0xf9,
|
||||||
|
0x4b, 0xbf, 0xe7, 0x8e, 0x26, 0xf4, 0x96, 0x5f, 0xbb, 0xde, 0x3c, 0xe9, 0xaf, 0xd7, 0x67, 0x27,
|
||||||
|
0xc5, 0x46, 0x7c, 0x6b, 0xb6, 0xb5, 0x8a, 0x8b, 0xf1, 0x0f, 0x00, 0x00, 0xa0, 0x3f, 0xcc, 0x53,
|
||||||
|
0x05, 0xef, 0x20, 0x5e, 0x99, 0x4a, 0x6d, 0xf5, 0x25, 0xcf, 0xc8, 0xc5, 0xcf, 0x8f, 0xcd, 0x2a,
|
||||||
|
0xe9, 0x6e, 0x67, 0xf5, 0x01, 0x5d, 0x06, 0x00, 0x00, 0x00, 0x58, 0x11, 0x2e, 0x01, 0xdc, 0xd8,
|
||||||
|
0x90, 0xa3, 0x1c, 0x00, 0x80, 0xde, 0x02, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x80, 0x97, 0xb2, 0xe2,
|
||||||
|
0x96, 0xd4, 0x65, 0xb7, 0xd1, 0x02, 0x00, 0xba, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x0e, 0xa9, 0x5b,
|
||||||
|
0xa3, 0x6b, 0xc2, 0xde, 0x50, 0x93, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7d, 0xfc, 0x5a,
|
||||||
|
0x1b, 0xff, 0xb3, 0x0c, 0x78, 0xad, 0x74, 0x71, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x0e, 0x00, 0xa1, 0xd1, 0x3c, 0xda, 0x88, 0xd6, 0x4e, 0x0f, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0xe0, 0x00, 0x10, 0x1a, 0xcb, 0xa3, 0x8c, 0x68, 0xab, 0x74, 0x70, 0x02, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0xa1, 0x91, 0x6c, 0x6d, 0x44, 0xaf, 0x1e, 0x3f, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x7b, 0x07, 0x80, 0xd4, 0x38, 0x5e, 0x7d, 0x85, 0x1e, 0x27,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xac, 0xc8, 0x67, 0x96, 0x51, 0xfc, 0xf9, 0x7c, 0x3e,
|
||||||
|
0xd2, 0x38, 0x6b, 0xbe, 0xad, 0xcd, 0x43, 0x4f, 0x58, 0xc4, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x56, 0xe1, 0xd0, 0x88, 0x24, 0x65, 0x0c, 0xd7, 0x18, 0xf0, 0x3d, 0xcc, 0x7c, 0x65, 0x00,
|
||||||
|
0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbc, 0xca, 0x01, 0x60, 0x6d, 0xc4, 0xa7, 0xfe,
|
||||||
|
0x7e, 0x1b, 0xdf, 0x3d, 0xab, 0xf8, 0x3d, 0x60, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0,
|
||||||
|
0x4a, 0x0c, 0x59, 0x99, 0x97, 0x18, 0xcb, 0x35, 0x46, 0xfc, 0xd3, 0x8e, 0x03, 0x4d, 0x23, 0xdd,
|
||||||
|
0x2a, 0x5e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x91, 0xfc, 0x7a, 0xc9, 0x88, 0xd4, 0xa8,
|
||||||
|
0xce, 0x7d, 0x37, 0xca, 0x28, 0xc7, 0xf8, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00,
|
||||||
|
0xc6, 0xc6, 0x75, 0xef, 0xdf, 0x31, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x80,
|
||||||
|
0x73, 0x27, 0x40, 0xef, 0x0e, 0x01, 0x8c, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01,
|
||||||
|
0xe0, 0xdc, 0x09, 0x50, 0x6b, 0x7c, 0x6b, 0x1b, 0xeb, 0x18, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x19, 0xae, 0x80, 0x9e, 0x38, 0xa8, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0,
|
||||||
|
0xc3, 0xff, 0x00, 0xe2, 0xe6, 0xa1, 0xf3, 0xf8, 0x5f, 0xec, 0xc5, 0x00, 0x00, 0x00, 0x00, 0x49,
|
||||||
|
0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
|
||||||
|
};
|
||||||
|
const int GRRLIBfont_size = sizeof(GRRLIBfont);
|
14
GRRLIB/GRRLIB/GRRLIB_addon/GRRLIBfont.h
Normal file
14
GRRLIB/GRRLIB/GRRLIB_addon/GRRLIBfont.h
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
/*
|
||||||
|
This file was autogenerated by raw2c.
|
||||||
|
Visit http://www.devkitpro.org
|
||||||
|
*/
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------
|
||||||
|
#ifndef _GRRLIBfont_h_
|
||||||
|
#define _GRRLIBfont_h_
|
||||||
|
//---------------------------------------------------------------------------------
|
||||||
|
extern const unsigned char GRRLIBfont[];
|
||||||
|
extern const int GRRLIBfont_size;
|
||||||
|
//---------------------------------------------------------------------------------
|
||||||
|
#endif //_GRRLIBfont_h_
|
||||||
|
//---------------------------------------------------------------------------------
|
BIN
GRRLIB/GRRLIB/GRRLIB_addon/GRRLIBfont.png
Normal file
BIN
GRRLIB/GRRLIB/GRRLIB_addon/GRRLIBfont.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.5 KiB |
114
GRRLIB/GRRLIB/GRRLIB_bmf.c
Normal file
114
GRRLIB/GRRLIB/GRRLIB_bmf.c
Normal file
|
@ -0,0 +1,114 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
Copyright (c) 2009 The GRRLIB Team
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include <malloc.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <grrlib.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load a ByteMap font structure from a buffer.
|
||||||
|
* @param my_bmf The ByteMap font buffer to load.
|
||||||
|
* @return A GRRLIB_bytemapFont structure filled with BMF informations.
|
||||||
|
*/
|
||||||
|
GRRLIB_bytemapFont* GRRLIB_LoadBMF (const u8 my_bmf[] ) {
|
||||||
|
GRRLIB_bytemapFont *fontArray = (struct GRRLIB_bytemapFont *)malloc(sizeof(GRRLIB_bytemapFont));
|
||||||
|
int i, j = 1;
|
||||||
|
u8 lineheight, usedcolors, highestcolor, nbPalette;
|
||||||
|
short int sizeover, sizeunder, sizeinner, numcolpal;
|
||||||
|
u16 nbPixels;
|
||||||
|
|
||||||
|
if (fontArray != NULL && my_bmf[0]==0xE1 && my_bmf[1]==0xE6 && my_bmf[2]==0xD5 && my_bmf[3]==0x1A) {
|
||||||
|
fontArray->version = my_bmf[4];
|
||||||
|
lineheight = my_bmf[5];
|
||||||
|
sizeover = my_bmf[6];
|
||||||
|
sizeunder = my_bmf[7];
|
||||||
|
fontArray->tracking = my_bmf[8];
|
||||||
|
sizeinner = my_bmf[9];
|
||||||
|
usedcolors = my_bmf[10];
|
||||||
|
highestcolor = my_bmf[11];
|
||||||
|
nbPalette = my_bmf[16];
|
||||||
|
numcolpal = 3 * nbPalette;
|
||||||
|
fontArray->palette = (u32 *)calloc(nbPalette + 1, sizeof(u32));
|
||||||
|
for (i=0; i < numcolpal; i+=3) {
|
||||||
|
fontArray->palette[j++] = ((((my_bmf[i+17]<<2)+3)<<24) | (((my_bmf[i+18]<<2)+3)<<16) | (((my_bmf[i+19]<<2)+3)<<8) | 0xFF);
|
||||||
|
}
|
||||||
|
j = my_bmf[17 + numcolpal];
|
||||||
|
fontArray->name = (char *)calloc(j + 1, sizeof(char));
|
||||||
|
memcpy(fontArray->name, &my_bmf[18 + numcolpal], j);
|
||||||
|
j = 18 + numcolpal + j;
|
||||||
|
fontArray->nbChar = (my_bmf[j] | my_bmf[j+1]<<8);
|
||||||
|
fontArray->charDef = (GRRLIB_bytemapChar *)calloc(fontArray->nbChar, sizeof(GRRLIB_bytemapChar));
|
||||||
|
j++;
|
||||||
|
for (i=0; i < fontArray->nbChar; i++) {
|
||||||
|
fontArray->charDef[i].character = my_bmf[++j];
|
||||||
|
fontArray->charDef[i].width = my_bmf[++j];
|
||||||
|
fontArray->charDef[i].height = my_bmf[++j];
|
||||||
|
fontArray->charDef[i].relx = my_bmf[++j];
|
||||||
|
fontArray->charDef[i].rely = my_bmf[++j];
|
||||||
|
fontArray->charDef[i].kerning = my_bmf[++j];
|
||||||
|
nbPixels = fontArray->charDef[i].width * fontArray->charDef[i].height;
|
||||||
|
fontArray->charDef[i].data = (u8 *)malloc(nbPixels);
|
||||||
|
if (nbPixels && fontArray->charDef[i].data) {
|
||||||
|
memcpy(fontArray->charDef[i].data, &my_bmf[++j], nbPixels);
|
||||||
|
j += (nbPixels - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fontArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Free memory allocated by ByteMap fonts.
|
||||||
|
* @param bmf A GRRLIB_bytemapFont structure.
|
||||||
|
*/
|
||||||
|
void GRRLIB_FreeBMF (const GRRLIB_bytemapFont *bmf) {
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
for (i=0; i<bmf->nbChar; i++) {
|
||||||
|
free(bmf->charDef[i].data);
|
||||||
|
}
|
||||||
|
free(bmf->charDef);
|
||||||
|
free(bmf->palette);
|
||||||
|
free(bmf->name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize a tile set.
|
||||||
|
* @param tex The texture to initialize.
|
||||||
|
* @param tilew Width of the tile.
|
||||||
|
* @param tileh Height of the tile.
|
||||||
|
* @param tilestart Offset for starting position (Used in fonts).
|
||||||
|
*/
|
||||||
|
void GRRLIB_InitTileSet (GRRLIB_texImg *tex,
|
||||||
|
const uint tilew, const uint tileh,
|
||||||
|
const uint tilestart) {
|
||||||
|
tex->tilew = tilew;
|
||||||
|
tex->tileh = tileh;
|
||||||
|
if (tilew) // Avoid division by zero
|
||||||
|
tex->nbtilew = tex->w / tilew;
|
||||||
|
if (tileh) // Avoid division by zero
|
||||||
|
tex->nbtileh = tex->h / tileh;
|
||||||
|
tex->tilestart = tilestart;
|
||||||
|
tex->tiledtex = true;
|
||||||
|
GRRLIB_SetHandle( tex, 0, 0 );
|
||||||
|
}
|
214
GRRLIB/GRRLIB/GRRLIB_bmfx.c
Normal file
214
GRRLIB/GRRLIB/GRRLIB_bmfx.c
Normal file
|
@ -0,0 +1,214 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
Copyright (c) 2009 The GRRLIB Team
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include <grrlib.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flip texture horizontal.
|
||||||
|
* @see GRRLIB_FlushTex
|
||||||
|
* @param texsrc The texture source.
|
||||||
|
* @param texdest The texture destination.
|
||||||
|
*/
|
||||||
|
void GRRLIB_BMFX_FlipH (const GRRLIB_texImg *texsrc, GRRLIB_texImg *texdest) {
|
||||||
|
unsigned int x, y, txtWidth = texsrc->w - 1;
|
||||||
|
|
||||||
|
for (y = 0; y < texsrc->h; y++) {
|
||||||
|
for (x = 0; x < texsrc->w; x++) {
|
||||||
|
GRRLIB_SetPixelTotexImg(txtWidth - x, y, texdest,
|
||||||
|
GRRLIB_GetPixelFromtexImg(x, y, texsrc));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flip texture vertical.
|
||||||
|
* @see GRRLIB_FlushTex
|
||||||
|
* @param texsrc The texture source.
|
||||||
|
* @param texdest The texture destination.
|
||||||
|
*/
|
||||||
|
void GRRLIB_BMFX_FlipV (const GRRLIB_texImg *texsrc, GRRLIB_texImg *texdest) {
|
||||||
|
unsigned int x, y, texHeight = texsrc->h - 1;
|
||||||
|
|
||||||
|
for (y = 0; y < texsrc->h; y++) {
|
||||||
|
for (x = 0; x < texsrc->w; x++) {
|
||||||
|
GRRLIB_SetPixelTotexImg(x, texHeight - y, texdest,
|
||||||
|
GRRLIB_GetPixelFromtexImg(x, y, texsrc));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change a texture to gray scale.
|
||||||
|
* @see GRRLIB_FlushTex
|
||||||
|
* @param texsrc The texture source.
|
||||||
|
* @param texdest The texture grayscaled destination.
|
||||||
|
*/
|
||||||
|
void GRRLIB_BMFX_Grayscale (const GRRLIB_texImg *texsrc,
|
||||||
|
GRRLIB_texImg *texdest) {
|
||||||
|
unsigned int x, y;
|
||||||
|
u8 gray;
|
||||||
|
u32 color;
|
||||||
|
|
||||||
|
for (y = 0; y < texsrc->h; y++) {
|
||||||
|
for (x = 0; x < texsrc->w; x++) {
|
||||||
|
color = GRRLIB_GetPixelFromtexImg(x, y, texsrc);
|
||||||
|
|
||||||
|
gray = (((color >> 24 & 0xFF)*77 + (color >> 16 & 0xFF)*150 + (color >> 8 & 0xFF)*28) / (255));
|
||||||
|
|
||||||
|
GRRLIB_SetPixelTotexImg(x, y, texdest,
|
||||||
|
((gray << 24) | (gray << 16) | (gray << 8) | (color & 0xFF)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
GRRLIB_SetHandle( texdest, 0, 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invert colors of the texture.
|
||||||
|
* @see GRRLIB_FlushTex
|
||||||
|
* @param texsrc The texture source.
|
||||||
|
* @param texdest The texture destination.
|
||||||
|
*/
|
||||||
|
void GRRLIB_BMFX_Invert (const GRRLIB_texImg *texsrc, GRRLIB_texImg *texdest) {
|
||||||
|
unsigned int x, y;
|
||||||
|
u32 color;
|
||||||
|
|
||||||
|
for (y = 0; y < texsrc->h; y++) {
|
||||||
|
for (x = 0; x < texsrc->w; x++) {
|
||||||
|
color = GRRLIB_GetPixelFromtexImg(x, y, texsrc);
|
||||||
|
GRRLIB_SetPixelTotexImg(x, y, texdest,
|
||||||
|
((0xFFFFFF - (color >> 8 & 0xFFFFFF)) << 8) | (color & 0xFF));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A texture effect (Blur).
|
||||||
|
* @see GRRLIB_FlushTex
|
||||||
|
* @param texsrc The texture source.
|
||||||
|
* @param texdest The texture destination.
|
||||||
|
* @param factor The blur factor.
|
||||||
|
*/
|
||||||
|
void GRRLIB_BMFX_Blur (const GRRLIB_texImg *texsrc,
|
||||||
|
GRRLIB_texImg *texdest, const u32 factor) {
|
||||||
|
int numba = (1+(factor<<1))*(1+(factor<<1));
|
||||||
|
u32 x, y;
|
||||||
|
s32 k, l;
|
||||||
|
int tmp = 0;
|
||||||
|
int newr, newg, newb, newa;
|
||||||
|
u32 colours[numba];
|
||||||
|
u32 thiscol;
|
||||||
|
|
||||||
|
for (x = 0; x < texsrc->w; x++) {
|
||||||
|
for (y = 0; y < texsrc->h; y++) {
|
||||||
|
newr = 0;
|
||||||
|
newg = 0;
|
||||||
|
newb = 0;
|
||||||
|
newa = 0;
|
||||||
|
|
||||||
|
tmp = 0;
|
||||||
|
thiscol = GRRLIB_GetPixelFromtexImg(x, y, texsrc);
|
||||||
|
|
||||||
|
for (k = x - factor; k <= x + factor; k++) {
|
||||||
|
for (l = y - factor; l <= y + factor; l++) {
|
||||||
|
if (k < 0) { colours[tmp] = thiscol; }
|
||||||
|
else if (k >= texsrc->w) { colours[tmp] = thiscol; }
|
||||||
|
else if (l < 0) { colours[tmp] = thiscol; }
|
||||||
|
else if (l >= texsrc->h) { colours[tmp] = thiscol; }
|
||||||
|
else { colours[tmp] = GRRLIB_GetPixelFromtexImg(k, l, texsrc); }
|
||||||
|
tmp++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (tmp = 0; tmp < numba; tmp++) {
|
||||||
|
newr += (colours[tmp] >> 24) & 0xFF;
|
||||||
|
newg += (colours[tmp] >> 16) & 0xFF;
|
||||||
|
newb += (colours[tmp] >> 8) & 0xFF;
|
||||||
|
newa += colours[tmp] & 0xFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
newr /= numba;
|
||||||
|
newg /= numba;
|
||||||
|
newb /= numba;
|
||||||
|
newa /= numba;
|
||||||
|
|
||||||
|
GRRLIB_SetPixelTotexImg(x, y, texdest, (newr<<24) | (newg<<16) | (newb<<8) | newa);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A texture effect (Scatter).
|
||||||
|
* @see GRRLIB_FlushTex
|
||||||
|
* @param texsrc The texture source.
|
||||||
|
* @param texdest The texture destination.
|
||||||
|
* @param factor The factor level of the effect.
|
||||||
|
*/
|
||||||
|
void GRRLIB_BMFX_Scatter (const GRRLIB_texImg *texsrc,
|
||||||
|
GRRLIB_texImg *texdest, const u32 factor) {
|
||||||
|
unsigned int x, y;
|
||||||
|
u32 val1, val2;
|
||||||
|
u32 val3, val4;
|
||||||
|
int factorx2 = factor*2;
|
||||||
|
|
||||||
|
for (y = 0; y < texsrc->h; y++) {
|
||||||
|
for (x = 0; x < texsrc->w; x++) {
|
||||||
|
val1 = x + (int) (factorx2 * (rand() / (RAND_MAX + 1.0))) - factor;
|
||||||
|
val2 = y + (int) (factorx2 * (rand() / (RAND_MAX + 1.0))) - factor;
|
||||||
|
|
||||||
|
if ((val1 >= texsrc->w) || (val2 >= texsrc->h)) {
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
val3 = GRRLIB_GetPixelFromtexImg(x, y, texsrc);
|
||||||
|
val4 = GRRLIB_GetPixelFromtexImg(val1, val2, texsrc);
|
||||||
|
GRRLIB_SetPixelTotexImg(x, y, texdest, val4);
|
||||||
|
GRRLIB_SetPixelTotexImg(val1, val2, texdest, val3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A texture effect (Pixelate).
|
||||||
|
* @see GRRLIB_FlushTex
|
||||||
|
* @param texsrc The texture source.
|
||||||
|
* @param texdest The texture destination.
|
||||||
|
* @param factor The factor level of the effect.
|
||||||
|
*/
|
||||||
|
void GRRLIB_BMFX_Pixelate (const GRRLIB_texImg *texsrc,
|
||||||
|
GRRLIB_texImg *texdest, const u32 factor) {
|
||||||
|
unsigned int x, y;
|
||||||
|
unsigned int xx, yy;
|
||||||
|
u32 rgb;
|
||||||
|
|
||||||
|
for (x = 0; x < texsrc->w - 1 - factor; x += factor) {
|
||||||
|
for (y = 0; y < texsrc->h - 1 - factor; y +=factor) {
|
||||||
|
rgb = GRRLIB_GetPixelFromtexImg(x, y, texsrc);
|
||||||
|
for (xx = x; xx < x + factor; xx++) {
|
||||||
|
for (yy = y; yy < y + factor; yy++) {
|
||||||
|
GRRLIB_SetPixelTotexImg(xx, yy, texdest, rgb);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
170
GRRLIB/GRRLIB/GRRLIB_core.c
Normal file
170
GRRLIB/GRRLIB/GRRLIB_core.c
Normal file
|
@ -0,0 +1,170 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
Copyright (c) 2009 The GRRLIB Team
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include <malloc.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <ogc/conf.h>
|
||||||
|
|
||||||
|
#define __GRRLIB_CORE__
|
||||||
|
#include <grrlib.h>
|
||||||
|
|
||||||
|
#define DEFAULT_FIFO_SIZE (256 * 1024) /**< GX fifo buffer size. */
|
||||||
|
|
||||||
|
GRRLIB_drawSettings GRRLIB_Settings;
|
||||||
|
Mtx GXmodelView2D;
|
||||||
|
|
||||||
|
static void *gp_fifo = NULL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize GRRLIB. Call this at the beginning your code.
|
||||||
|
* @see GRRLIB_Exit
|
||||||
|
*/
|
||||||
|
void GRRLIB_Init (void) {
|
||||||
|
f32 yscale;
|
||||||
|
u32 xfbHeight;
|
||||||
|
Mtx44 perspective;
|
||||||
|
|
||||||
|
VIDEO_Init();
|
||||||
|
rmode = VIDEO_GetPreferredMode(NULL);
|
||||||
|
if (rmode == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Video Mode Correction
|
||||||
|
switch (rmode->viTVMode) {
|
||||||
|
case VI_DEBUG_PAL: // PAL 50hz 576i
|
||||||
|
//rmode = &TVPal574IntDfScale;
|
||||||
|
rmode = &TVPal528IntDf; //BC
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Widescreen patch by CashMan's Productions (http://www.CashMan-Productions.fr.nf)
|
||||||
|
if (CONF_GetAspectRatio() == CONF_ASPECT_16_9) {
|
||||||
|
rmode->viWidth = 678;
|
||||||
|
rmode->viXOrigin = (VI_MAX_WIDTH_NTSC - 678)/2;
|
||||||
|
}
|
||||||
|
|
||||||
|
VIDEO_Configure(rmode);
|
||||||
|
xfb[0] = (u32 *)MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
|
||||||
|
xfb[1] = (u32 *)MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
|
||||||
|
if (xfb[0] == NULL || xfb[1] == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
VIDEO_SetNextFramebuffer(xfb[fb]);
|
||||||
|
VIDEO_SetBlack(true);
|
||||||
|
VIDEO_Flush();
|
||||||
|
VIDEO_WaitVSync();
|
||||||
|
if (rmode->viTVMode & VI_NON_INTERLACE) {
|
||||||
|
VIDEO_WaitVSync();
|
||||||
|
}
|
||||||
|
|
||||||
|
gp_fifo = (u8 *) memalign(32, DEFAULT_FIFO_SIZE);
|
||||||
|
if (gp_fifo == NULL)
|
||||||
|
return;
|
||||||
|
memset(gp_fifo, 0, DEFAULT_FIFO_SIZE);
|
||||||
|
GX_Init(gp_fifo, DEFAULT_FIFO_SIZE);
|
||||||
|
|
||||||
|
// Clears the BG to color and clears the z-buffer
|
||||||
|
GX_SetCopyClear((GXColor){ 0, 0, 0, 0xff }, GX_MAX_Z24);
|
||||||
|
|
||||||
|
// Other GX setup
|
||||||
|
yscale = GX_GetYScaleFactor(rmode->efbHeight, rmode->xfbHeight);
|
||||||
|
xfbHeight = GX_SetDispCopyYScale(yscale);
|
||||||
|
GX_SetDispCopySrc(0, 0, rmode->fbWidth, rmode->efbHeight);
|
||||||
|
GX_SetDispCopyDst(rmode->fbWidth, xfbHeight);
|
||||||
|
GX_SetCopyFilter(rmode->aa, rmode->sample_pattern, GX_TRUE, rmode->vfilter);
|
||||||
|
GX_SetFieldMode(rmode->field_rendering, ((rmode->viHeight == 2 * rmode->xfbHeight) ? GX_ENABLE : GX_DISABLE));
|
||||||
|
|
||||||
|
if (rmode->aa) {
|
||||||
|
// Set 16 bit RGB565
|
||||||
|
GX_SetPixelFmt(GX_PF_RGB565_Z16, GX_ZC_LINEAR);
|
||||||
|
} else {
|
||||||
|
// Set 24 bit Z24
|
||||||
|
GX_SetPixelFmt(GX_PF_RGB8_Z24, GX_ZC_LINEAR);
|
||||||
|
}
|
||||||
|
|
||||||
|
GX_SetDispCopyGamma(GX_GM_1_0);
|
||||||
|
|
||||||
|
// Setup the vertex descriptor
|
||||||
|
// Tells the flipper to expect direct data
|
||||||
|
GX_ClearVtxDesc();
|
||||||
|
GX_InvVtxCache();
|
||||||
|
GX_InvalidateTexAll();
|
||||||
|
|
||||||
|
GX_SetVtxDesc(GX_VA_TEX0, GX_NONE);
|
||||||
|
GX_SetVtxDesc(GX_VA_POS, GX_DIRECT);
|
||||||
|
GX_SetVtxDesc(GX_VA_CLR0, GX_DIRECT);
|
||||||
|
|
||||||
|
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
|
||||||
|
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_F32, 0);
|
||||||
|
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0);
|
||||||
|
GX_SetZMode(GX_FALSE, GX_LEQUAL, GX_TRUE);
|
||||||
|
|
||||||
|
GX_SetNumChans(1);
|
||||||
|
GX_SetNumTexGens(1);
|
||||||
|
GX_SetTevOp(GX_TEVSTAGE0, GX_PASSCLR);
|
||||||
|
GX_SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0);
|
||||||
|
GX_SetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY);
|
||||||
|
|
||||||
|
guMtxIdentity(GXmodelView2D);
|
||||||
|
guMtxTransApply(GXmodelView2D, GXmodelView2D, 0.0F, 0.0F, -100.0F);
|
||||||
|
GX_LoadPosMtxImm(GXmodelView2D, GX_PNMTX0);
|
||||||
|
|
||||||
|
guOrtho(perspective, 0, rmode->efbHeight, 0, rmode->fbWidth, 0, 1000.0f);
|
||||||
|
GX_LoadProjectionMtx(perspective, GX_ORTHOGRAPHIC);
|
||||||
|
|
||||||
|
GX_SetViewport(0, 0, rmode->fbWidth, rmode->efbHeight, 0, 1);
|
||||||
|
GX_SetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_CLEAR);
|
||||||
|
GX_SetAlphaUpdate(GX_TRUE);
|
||||||
|
GX_SetAlphaCompare(GX_GREATER, 0, GX_AOP_AND, GX_ALWAYS, 0);
|
||||||
|
GX_SetColorUpdate(GX_ENABLE);
|
||||||
|
GX_SetCullMode(GX_CULL_NONE);
|
||||||
|
GRRLIB_ClipReset();
|
||||||
|
|
||||||
|
VIDEO_SetBlack(false);
|
||||||
|
|
||||||
|
// Default settings
|
||||||
|
GRRLIB_Settings.antialias = true;
|
||||||
|
GRRLIB_Settings.blend = GRRLIB_BLEND_ALPHA;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call this before exiting your application.
|
||||||
|
*/
|
||||||
|
void GRRLIB_Exit (void) {
|
||||||
|
// Allow write access to the full screen
|
||||||
|
GX_SetClipMode( GX_CLIP_DISABLE );
|
||||||
|
GX_SetScissor( 0, 0, rmode->fbWidth, rmode->efbHeight );
|
||||||
|
|
||||||
|
// We empty both frame buffers on our way out
|
||||||
|
// otherwise dead frames are sometimes seen when starting the next app
|
||||||
|
GRRLIB_FillScreen( 0x000000FF ); GRRLIB_Render();
|
||||||
|
GRRLIB_FillScreen( 0x000000FF ); GRRLIB_Render();
|
||||||
|
|
||||||
|
// Shut down the GX engine
|
||||||
|
GX_DrawDone();
|
||||||
|
GX_AbortFrame();
|
||||||
|
|
||||||
|
// Free up memory allocated for frame buffers & FIFOs
|
||||||
|
if (xfb[0] != NULL) { free(MEM_K1_TO_K0(xfb[0])); xfb[0] = NULL; }
|
||||||
|
if (xfb[1] != NULL) { free(MEM_K1_TO_K0(xfb[1])); xfb[0] = NULL; }
|
||||||
|
if (gp_fifo != NULL) { free(gp_fifo); gp_fifo = NULL; }
|
||||||
|
}
|
55
GRRLIB/GRRLIB/GRRLIB_fbAdvanced.c
Normal file
55
GRRLIB/GRRLIB/GRRLIB_fbAdvanced.c
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
Copyright (c) 2009 The GRRLIB Team
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
#include <grrlib.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw a circle.
|
||||||
|
* @author Dark_Link
|
||||||
|
* @param x Specifies the x-coordinate of the circle.
|
||||||
|
* @param y Specifies the y-coordinate of the circle.
|
||||||
|
* @param radius The radius of the circle.
|
||||||
|
* @param color The color of the circle in RGBA format.
|
||||||
|
* @param filled Set to true to fill the circle.
|
||||||
|
*/
|
||||||
|
void GRRLIB_Circle (const f32 x, const f32 y, const f32 radius,
|
||||||
|
const u32 color, const u8 filled) {
|
||||||
|
guVector v[36];
|
||||||
|
u32 ncolor[36];
|
||||||
|
u32 a;
|
||||||
|
f32 ra;
|
||||||
|
f32 G_DTOR = M_DTOR * 10;
|
||||||
|
|
||||||
|
for (a = 0; a < 36; a++) {
|
||||||
|
ra = a * G_DTOR;
|
||||||
|
|
||||||
|
v[a].x = cos(ra) * radius + x;
|
||||||
|
v[a].y = sin(ra) * radius + y;
|
||||||
|
v[a].z = 0.0f;
|
||||||
|
ncolor[a] = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!filled) GRRLIB_GXEngine(v, ncolor, 36, GX_LINESTRIP ) ;
|
||||||
|
else GRRLIB_GXEngine(v, ncolor, 36, GX_TRIANGLEFAN) ;
|
||||||
|
}
|
107
GRRLIB/GRRLIB/GRRLIB_print.c
Normal file
107
GRRLIB/GRRLIB/GRRLIB_print.c
Normal file
|
@ -0,0 +1,107 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
Copyright (c) 2009 The GRRLIB Team
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include <malloc.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <grrlib.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print formatted output.
|
||||||
|
* @param xpos Specifies the x-coordinate of the upper-left corner of the text.
|
||||||
|
* @param ypos Specifies the y-coordinate of the upper-left corner of the text.
|
||||||
|
* @param tex The texture containing the character set.
|
||||||
|
* @param color Text color in RGBA format. The alpha channel is used to change the opacity of the text.
|
||||||
|
* @param zoom This is a factor by which the text size will be increase or decrease.
|
||||||
|
* @param text Text to draw.
|
||||||
|
* @param ... Optional arguments.
|
||||||
|
*/
|
||||||
|
void GRRLIB_Printf (const f32 xpos, const f32 ypos,
|
||||||
|
const GRRLIB_texImg *tex, const u32 color,
|
||||||
|
const f32 zoom, const char *text, ...) {
|
||||||
|
if (tex == NULL || tex->data == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int i, size;
|
||||||
|
char tmp[1024];
|
||||||
|
|
||||||
|
va_list argp;
|
||||||
|
va_start(argp, text);
|
||||||
|
size = vsprintf(tmp, text, argp);
|
||||||
|
va_end(argp);
|
||||||
|
|
||||||
|
for (i = 0; i < size; i++) {
|
||||||
|
u8 c = tmp[i]-tex->tilestart;
|
||||||
|
GRRLIB_DrawTile(xpos+i*tex->tilew*zoom, ypos, tex, 0, zoom, zoom, color, c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print formatted output.
|
||||||
|
* @param xpos Specifies the x-coordinate of the upper-left corner of the text.
|
||||||
|
* @param ypos Specifies the y-coordinate of the upper-left corner of the text.
|
||||||
|
* @param bmf The ByteMap font to use.
|
||||||
|
* @param zoom This is a factor by which the text size will be increase or decrease.
|
||||||
|
* @param text Text to draw.
|
||||||
|
* @param ... Optional arguments.
|
||||||
|
*/
|
||||||
|
void GRRLIB_PrintBMF (const f32 xpos, const f32 ypos,
|
||||||
|
const GRRLIB_bytemapFont *bmf,
|
||||||
|
const f32 zoom, const char *text, ...) {
|
||||||
|
uint i, j, x, y, n, size;
|
||||||
|
char tmp[1024];
|
||||||
|
|
||||||
|
f32 xoff = xpos;
|
||||||
|
|
||||||
|
va_list argp;
|
||||||
|
va_start(argp, text);
|
||||||
|
size = vsprintf(tmp, text, argp);
|
||||||
|
va_end(argp);
|
||||||
|
|
||||||
|
GRRLIB_texImg *tex_BMfont = GRRLIB_CreateEmptyTexture(rmode->fbWidth, rmode->xfbHeight);
|
||||||
|
|
||||||
|
for (i=0; i<size; i++) {
|
||||||
|
for (j=0; j<bmf->nbChar; j++) {
|
||||||
|
if (tmp[i] == bmf->charDef[j].character) {
|
||||||
|
n=0;
|
||||||
|
for (y=0; y<bmf->charDef[j].height; y++) {
|
||||||
|
for (x=0; x<bmf->charDef[j].width; x++) {
|
||||||
|
if (bmf->charDef[j].data[n]) {
|
||||||
|
GRRLIB_SetPixelTotexImg(xoff + x + bmf->charDef[j].relx, ypos + y + bmf->charDef[j].rely,
|
||||||
|
tex_BMfont, bmf->palette[bmf->charDef[j].data[n]]);
|
||||||
|
}
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
xoff += bmf->charDef[j].kerning + bmf->tracking;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GRRLIB_FlushTex( tex_BMfont );
|
||||||
|
GRRLIB_DrawImg(0, 0, tex_BMfont, 0, 1, 1, 0xFFFFFFFF);
|
||||||
|
free(tex_BMfont->data);
|
||||||
|
free(tex_BMfont);
|
||||||
|
}
|
306
GRRLIB/GRRLIB/GRRLIB_render.c
Normal file
306
GRRLIB/GRRLIB/GRRLIB_render.c
Normal file
|
@ -0,0 +1,306 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
Copyright (c) 2009 The GRRLIB Team
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
#include <grrlib.h>
|
||||||
|
|
||||||
|
extern GRRLIB_drawSettings GRRLIB_Settings;
|
||||||
|
extern Mtx GXmodelView2D;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw a texture.
|
||||||
|
* @param xpos Specifies the x-coordinate of the upper-left corner.
|
||||||
|
* @param ypos Specifies the y-coordinate of the upper-left corner.
|
||||||
|
* @param tex The texture to draw.
|
||||||
|
* @param degrees Angle of rotation.
|
||||||
|
* @param scaleX Specifies the x-coordinate scale. -1 could be used for flipping the texture horizontally.
|
||||||
|
* @param scaleY Specifies the y-coordinate scale. -1 could be used for flipping the texture vertically.
|
||||||
|
* @param color Color in RGBA format.
|
||||||
|
*/
|
||||||
|
void GRRLIB_DrawImg (const f32 xpos, const f32 ypos, const GRRLIB_texImg *tex,
|
||||||
|
const f32 degrees, const f32 scaleX, const f32 scaleY,
|
||||||
|
const u32 color) {
|
||||||
|
if (tex == NULL || tex->data == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GXTexObj texObj;
|
||||||
|
u16 width, height;
|
||||||
|
Mtx m, m1, m2, mv;
|
||||||
|
|
||||||
|
GX_InitTexObj(&texObj, tex->data, tex->w, tex->h, GX_TF_RGBA8, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||||
|
if (GRRLIB_Settings.antialias == false) {
|
||||||
|
GX_InitTexObjLOD(&texObj, GX_NEAR, GX_NEAR, 0.0f, 0.0f, 0.0f, 0, 0, GX_ANISO_1);
|
||||||
|
}
|
||||||
|
|
||||||
|
GX_LoadTexObj(&texObj, GX_TEXMAP0);
|
||||||
|
GX_SetTevOp(GX_TEVSTAGE0, GX_MODULATE);
|
||||||
|
GX_SetVtxDesc(GX_VA_TEX0, GX_DIRECT);
|
||||||
|
|
||||||
|
width = tex->w * 0.5;
|
||||||
|
height = tex->h * 0.5;
|
||||||
|
guMtxIdentity(m1);
|
||||||
|
guMtxScaleApply(m1, m1, scaleX, scaleY, 1.0);
|
||||||
|
guVector axis = (guVector) {0, 0, 1};
|
||||||
|
guMtxRotAxisDeg (m2, &axis, degrees);
|
||||||
|
guMtxConcat(m2, m1, m);
|
||||||
|
|
||||||
|
guMtxTransApply(m, m, xpos+width+tex->handlex-tex->offsetx+(scaleX*( -tex->handley*sin(-DegToRad(degrees)) - tex->handlex*cos(-DegToRad(degrees)) )), ypos+height+tex->handley-tex->offsety+(scaleX*( -tex->handley*cos(-DegToRad(degrees)) + tex->handlex*sin(-DegToRad(degrees)) )), 0);
|
||||||
|
guMtxConcat(GXmodelView2D, m, mv);
|
||||||
|
|
||||||
|
GX_LoadPosMtxImm(mv, GX_PNMTX0);
|
||||||
|
GX_Begin(GX_QUADS, GX_VTXFMT0, 4);
|
||||||
|
GX_Position3f32(-width, -height, 0);
|
||||||
|
GX_Color1u32(color);
|
||||||
|
GX_TexCoord2f32(0, 0);
|
||||||
|
|
||||||
|
GX_Position3f32(width, -height, 0);
|
||||||
|
GX_Color1u32(color);
|
||||||
|
GX_TexCoord2f32(1, 0);
|
||||||
|
|
||||||
|
GX_Position3f32(width, height, 0);
|
||||||
|
GX_Color1u32(color);
|
||||||
|
GX_TexCoord2f32(1, 1);
|
||||||
|
|
||||||
|
GX_Position3f32(-width, height, 0);
|
||||||
|
GX_Color1u32(color);
|
||||||
|
GX_TexCoord2f32(0, 1);
|
||||||
|
GX_End();
|
||||||
|
GX_LoadPosMtxImm(GXmodelView2D, GX_PNMTX0);
|
||||||
|
|
||||||
|
GX_SetTevOp(GX_TEVSTAGE0, GX_PASSCLR);
|
||||||
|
GX_SetVtxDesc(GX_VA_TEX0, GX_NONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw a textured quad.
|
||||||
|
* @param pos Vector array of the 4 points.
|
||||||
|
* @param tex The texture to draw.
|
||||||
|
* @param color Color in RGBA format.
|
||||||
|
*/
|
||||||
|
void GRRLIB_DrawImgQuad (const guVector pos[4], GRRLIB_texImg *tex,
|
||||||
|
const u32 color) {
|
||||||
|
if (tex == NULL || tex->data == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GXTexObj texObj;
|
||||||
|
Mtx m, m1, m2, mv;
|
||||||
|
|
||||||
|
GX_InitTexObj(&texObj, tex->data, tex->w, tex->h, GX_TF_RGBA8, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||||
|
if (GRRLIB_Settings.antialias == false) {
|
||||||
|
GX_InitTexObjLOD(&texObj, GX_NEAR, GX_NEAR, 0.0f, 0.0f, 0.0f, 0, 0, GX_ANISO_1);
|
||||||
|
}
|
||||||
|
|
||||||
|
GX_LoadTexObj(&texObj, GX_TEXMAP0);
|
||||||
|
GX_SetTevOp(GX_TEVSTAGE0, GX_MODULATE);
|
||||||
|
GX_SetVtxDesc(GX_VA_TEX0, GX_DIRECT);
|
||||||
|
|
||||||
|
guMtxIdentity(m1);
|
||||||
|
guMtxScaleApply(m1, m1, 1, 1, 1.0);
|
||||||
|
guVector axis = (guVector) {0, 0, 1};
|
||||||
|
guMtxRotAxisDeg (m2, &axis, 0);
|
||||||
|
guMtxConcat(m2, m1, m);
|
||||||
|
|
||||||
|
guMtxConcat(GXmodelView2D, m, mv);
|
||||||
|
|
||||||
|
GX_LoadPosMtxImm(mv, GX_PNMTX0);
|
||||||
|
GX_Begin(GX_QUADS, GX_VTXFMT0, 4);
|
||||||
|
GX_Position3f32(pos[0].x, pos[0].y, 0);
|
||||||
|
GX_Color1u32(color);
|
||||||
|
GX_TexCoord2f32(0, 0);
|
||||||
|
|
||||||
|
GX_Position3f32(pos[1].x, pos[1].y, 0);
|
||||||
|
GX_Color1u32(color);
|
||||||
|
GX_TexCoord2f32(1, 0);
|
||||||
|
|
||||||
|
GX_Position3f32(pos[2].x, pos[2].y, 0);
|
||||||
|
GX_Color1u32(color);
|
||||||
|
GX_TexCoord2f32(1, 1);
|
||||||
|
|
||||||
|
GX_Position3f32(pos[3].x, pos[3].y, 0);
|
||||||
|
GX_Color1u32(color);
|
||||||
|
GX_TexCoord2f32(0, 1);
|
||||||
|
GX_End();
|
||||||
|
GX_LoadPosMtxImm(GXmodelView2D, GX_PNMTX0);
|
||||||
|
|
||||||
|
GX_SetTevOp(GX_TEVSTAGE0, GX_PASSCLR);
|
||||||
|
GX_SetVtxDesc(GX_VA_TEX0, GX_NONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw a tile.
|
||||||
|
* @param xpos Specifies the x-coordinate of the upper-left corner.
|
||||||
|
* @param ypos Specifies the y-coordinate of the upper-left corner.
|
||||||
|
* @param tex The texture containing the tile to draw.
|
||||||
|
* @param degrees Angle of rotation.
|
||||||
|
* @param scaleX Specifies the x-coordinate scale. -1 could be used for flipping the texture horizontally.
|
||||||
|
* @param scaleY Specifies the y-coordinate scale. -1 could be used for flipping the texture vertically.
|
||||||
|
* @param color Color in RGBA format.
|
||||||
|
* @param frame Specifies the frame to draw.
|
||||||
|
*/
|
||||||
|
void GRRLIB_DrawTile (const f32 xpos, const f32 ypos, const GRRLIB_texImg *tex,
|
||||||
|
const f32 degrees, const f32 scaleX, const f32 scaleY,
|
||||||
|
const u32 color, const int frame) {
|
||||||
|
if (tex == NULL || tex->data == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GXTexObj texObj;
|
||||||
|
f32 width, height;
|
||||||
|
Mtx m, m1, m2, mv;
|
||||||
|
|
||||||
|
// Frame Correction by spiffen
|
||||||
|
f32 FRAME_CORR = 0.001f;
|
||||||
|
f32 s1 = (((frame%tex->nbtilew))/(f32)tex->nbtilew)+(FRAME_CORR/tex->w);
|
||||||
|
f32 s2 = (((frame%tex->nbtilew)+1)/(f32)tex->nbtilew)-(FRAME_CORR/tex->w);
|
||||||
|
f32 t1 = (((int)(frame/tex->nbtilew))/(f32)tex->nbtileh)+(FRAME_CORR/tex->h);
|
||||||
|
f32 t2 = (((int)(frame/tex->nbtilew)+1)/(f32)tex->nbtileh)-(FRAME_CORR/tex->h);
|
||||||
|
|
||||||
|
GX_InitTexObj(&texObj, tex->data, tex->tilew*tex->nbtilew, tex->tileh*tex->nbtileh, GX_TF_RGBA8, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||||
|
if (GRRLIB_Settings.antialias == false) {
|
||||||
|
GX_InitTexObjLOD(&texObj, GX_NEAR, GX_NEAR, 0.0f, 0.0f, 0.0f, 0, 0, GX_ANISO_1);
|
||||||
|
}
|
||||||
|
GX_LoadTexObj(&texObj, GX_TEXMAP0);
|
||||||
|
|
||||||
|
GX_SetTevOp(GX_TEVSTAGE0, GX_MODULATE);
|
||||||
|
GX_SetVtxDesc(GX_VA_TEX0, GX_DIRECT);
|
||||||
|
|
||||||
|
width = tex->tilew * 0.5f;
|
||||||
|
height = tex->tileh * 0.5f;
|
||||||
|
guMtxIdentity(m1);
|
||||||
|
guMtxScaleApply(m1, m1, scaleX, scaleY, 1.0f);
|
||||||
|
|
||||||
|
guVector axis = (guVector) {0, 0, 1};
|
||||||
|
guMtxRotAxisDeg(m2, &axis, degrees);
|
||||||
|
guMtxConcat(m2, m1, m);
|
||||||
|
guMtxTransApply(m, m, xpos+width+tex->handlex-tex->offsetx+(scaleX*( -tex->handley*sin(-DegToRad(degrees)) - tex->handlex*cos(-DegToRad(degrees)) )), ypos+height+tex->handley-tex->offsety+(scaleX*( -tex->handley*cos(-DegToRad(degrees)) + tex->handlex*sin(-DegToRad(degrees)) )), 0);
|
||||||
|
guMtxConcat(GXmodelView2D, m, mv);
|
||||||
|
|
||||||
|
GX_LoadPosMtxImm(mv, GX_PNMTX0);
|
||||||
|
GX_Begin(GX_QUADS, GX_VTXFMT0, 4);
|
||||||
|
GX_Position3f32(-width, -height, 0);
|
||||||
|
GX_Color1u32(color);
|
||||||
|
GX_TexCoord2f32(s1, t1);
|
||||||
|
|
||||||
|
GX_Position3f32(width, -height, 0);
|
||||||
|
GX_Color1u32(color);
|
||||||
|
GX_TexCoord2f32(s2, t1);
|
||||||
|
|
||||||
|
GX_Position3f32(width, height, 0);
|
||||||
|
GX_Color1u32(color);
|
||||||
|
GX_TexCoord2f32(s2, t2);
|
||||||
|
|
||||||
|
GX_Position3f32(-width, height, 0);
|
||||||
|
GX_Color1u32(color);
|
||||||
|
GX_TexCoord2f32(s1, t2);
|
||||||
|
GX_End();
|
||||||
|
GX_LoadPosMtxImm(GXmodelView2D, GX_PNMTX0);
|
||||||
|
|
||||||
|
GX_SetTevOp(GX_TEVSTAGE0, GX_PASSCLR);
|
||||||
|
GX_SetVtxDesc(GX_VA_TEX0, GX_NONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw a tile in a quad.
|
||||||
|
* @param pos Vector array of the 4 points.
|
||||||
|
* @param tex The texture to draw.
|
||||||
|
* @param color Color in RGBA format.
|
||||||
|
* @param frame Specifies the frame to draw.
|
||||||
|
*/
|
||||||
|
void GRRLIB_DrawTileQuad (const guVector pos[4], GRRLIB_texImg *tex,
|
||||||
|
const u32 color, const int frame) {
|
||||||
|
if (tex == NULL || tex->data == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GXTexObj texObj;
|
||||||
|
Mtx m, m1, m2, mv;
|
||||||
|
|
||||||
|
// Frame Correction by spiffen
|
||||||
|
f32 FRAME_CORR = 0.001f;
|
||||||
|
f32 s1 = (((frame%tex->nbtilew))/(f32)tex->nbtilew)+(FRAME_CORR/tex->w);
|
||||||
|
f32 s2 = (((frame%tex->nbtilew)+1)/(f32)tex->nbtilew)-(FRAME_CORR/tex->w);
|
||||||
|
f32 t1 = (((int)(frame/tex->nbtilew))/(f32)tex->nbtileh)+(FRAME_CORR/tex->h);
|
||||||
|
f32 t2 = (((int)(frame/tex->nbtilew)+1)/(f32)tex->nbtileh)-(FRAME_CORR/tex->h);
|
||||||
|
|
||||||
|
GX_InitTexObj(&texObj, tex->data, tex->tilew*tex->nbtilew, tex->tileh*tex->nbtileh, GX_TF_RGBA8, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||||
|
if (GRRLIB_Settings.antialias == false) {
|
||||||
|
GX_InitTexObjLOD(&texObj, GX_NEAR, GX_NEAR, 0.0f, 0.0f, 0.0f, 0, 0, GX_ANISO_1);
|
||||||
|
}
|
||||||
|
GX_LoadTexObj(&texObj, GX_TEXMAP0);
|
||||||
|
|
||||||
|
GX_SetTevOp(GX_TEVSTAGE0, GX_MODULATE);
|
||||||
|
GX_SetVtxDesc(GX_VA_TEX0, GX_DIRECT);
|
||||||
|
|
||||||
|
guMtxIdentity(m1);
|
||||||
|
guMtxScaleApply(m1, m1, 1, 1, 1.0f);
|
||||||
|
|
||||||
|
guVector axis = (guVector) {0, 0, 1};
|
||||||
|
guMtxRotAxisDeg(m2, &axis, 0);
|
||||||
|
guMtxConcat(m2, m1, m);
|
||||||
|
|
||||||
|
guMtxConcat(GXmodelView2D, m, mv);
|
||||||
|
|
||||||
|
GX_LoadPosMtxImm(mv, GX_PNMTX0);
|
||||||
|
GX_Begin(GX_QUADS, GX_VTXFMT0, 4);
|
||||||
|
GX_Position3f32(pos[0].x, pos[0].y, 0);
|
||||||
|
GX_Color1u32(color);
|
||||||
|
GX_TexCoord2f32(s1, t1);
|
||||||
|
|
||||||
|
GX_Position3f32(pos[1].x, pos[1].y, 0);
|
||||||
|
GX_Color1u32(color);
|
||||||
|
GX_TexCoord2f32(s2, t1);
|
||||||
|
|
||||||
|
GX_Position3f32(pos[2].x, pos[2].y, 0);
|
||||||
|
GX_Color1u32(color);
|
||||||
|
GX_TexCoord2f32(s2, t2);
|
||||||
|
|
||||||
|
GX_Position3f32(pos[3].x, pos[3].y, 0);
|
||||||
|
GX_Color1u32(color);
|
||||||
|
GX_TexCoord2f32(s1, t2);
|
||||||
|
GX_End();
|
||||||
|
GX_LoadPosMtxImm(GXmodelView2D, GX_PNMTX0);
|
||||||
|
|
||||||
|
GX_SetTevOp(GX_TEVSTAGE0, GX_PASSCLR);
|
||||||
|
GX_SetVtxDesc(GX_VA_TEX0, GX_NONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call this function after drawing.
|
||||||
|
*/
|
||||||
|
void GRRLIB_Render (void) {
|
||||||
|
GX_DrawDone();
|
||||||
|
GX_InvalidateTexAll();
|
||||||
|
|
||||||
|
fb ^= 1; // Flip framebuffer
|
||||||
|
GX_SetZMode(GX_TRUE, GX_LEQUAL, GX_TRUE);
|
||||||
|
GX_SetColorUpdate(GX_TRUE);
|
||||||
|
GX_CopyDisp(xfb[fb], GX_TRUE);
|
||||||
|
|
||||||
|
VIDEO_SetNextFramebuffer(xfb[fb]);
|
||||||
|
VIDEO_Flush();
|
||||||
|
|
||||||
|
VIDEO_WaitVSync();
|
||||||
|
if (rmode->viTVMode &VI_NON_INTERLACE) VIDEO_WaitVSync() ;
|
||||||
|
}
|
37
GRRLIB/GRRLIB/GRRLIB_snapshot.c
Normal file
37
GRRLIB/GRRLIB/GRRLIB_snapshot.c
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
Copyright (c) 2009 The GRRLIB Team
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include <grrlib.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make a snapshot of the screen in a texture.
|
||||||
|
* @param tex A pointer to a texture representing the screen or NULL if an error occurs.
|
||||||
|
*/
|
||||||
|
void GRRLIB_Screen2Texture (GRRLIB_texImg *tex) {
|
||||||
|
if(tex->data != NULL) {
|
||||||
|
GX_SetTexCopySrc(0, 0, rmode->fbWidth, rmode->efbHeight);
|
||||||
|
GX_SetTexCopyDst(rmode->fbWidth, rmode->efbHeight, GX_TF_RGBA8, GX_FALSE);
|
||||||
|
GX_CopyTex(tex->data, GX_FALSE);
|
||||||
|
GX_PixModeSync();
|
||||||
|
GRRLIB_FlushTex(tex);
|
||||||
|
}
|
||||||
|
}
|
239
GRRLIB/GRRLIB/GRRLIB_texEdit.c
Normal file
239
GRRLIB/GRRLIB/GRRLIB_texEdit.c
Normal file
|
@ -0,0 +1,239 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
Copyright (c) 2009 The GRRLIB Team
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include <jpeglib.h>
|
||||||
|
#include <malloc.h>
|
||||||
|
#include <pngu.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <grrlib.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a raw BMP (RGB, no alpha) to 4x4RGBA.
|
||||||
|
* @author DragonMinded
|
||||||
|
* @param src
|
||||||
|
* @param dst
|
||||||
|
* @param width
|
||||||
|
* @param height
|
||||||
|
*/
|
||||||
|
static
|
||||||
|
void RawTo4x4RGBA (const u8 *src, void *dst,
|
||||||
|
const uint width, const uint height) {
|
||||||
|
uint block;
|
||||||
|
uint i;
|
||||||
|
uint c;
|
||||||
|
uint ar;
|
||||||
|
uint gb;
|
||||||
|
|
||||||
|
u8 *p = (u8*)dst;
|
||||||
|
|
||||||
|
for (block = 0; block < height; block += 4) {
|
||||||
|
for (i = 0; i < width; i += 4) {
|
||||||
|
/* Alpha and Red */
|
||||||
|
for (c = 0; c < 4; ++c) {
|
||||||
|
for (ar = 0; ar < 4; ++ar) {
|
||||||
|
/* Alpha pixels */
|
||||||
|
*p++ = 255;
|
||||||
|
/* Red pixels */
|
||||||
|
*p++ = src[((i + ar) + ((block + c) * width)) * 3];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Green and Blue */
|
||||||
|
for (c = 0; c < 4; ++c) {
|
||||||
|
for (gb = 0; gb < 4; ++gb) {
|
||||||
|
/* Green pixels */
|
||||||
|
*p++ = src[(((i + gb) + ((block + c) * width)) * 3) + 1];
|
||||||
|
/* Blue pixels */
|
||||||
|
*p++ = src[(((i + gb) + ((block + c) * width)) * 3) + 2];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} /* i */
|
||||||
|
} /* block */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load a texture from a buffer.
|
||||||
|
* @param my_img The JPEG or PNG buffer to load.
|
||||||
|
* @return A GRRLIB_texImg structure filled with image informations.
|
||||||
|
*/
|
||||||
|
GRRLIB_texImg* GRRLIB_LoadTexture (const u8 my_img[]) {
|
||||||
|
if (my_img[0]==0xFF && my_img[1]==0xD8 && my_img[2]==0xFF) {
|
||||||
|
return (GRRLIB_LoadTextureJPG(my_img));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return (GRRLIB_LoadTexturePNG(my_img));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load a texture from a buffer.
|
||||||
|
* @param my_png the PNG buffer to load.
|
||||||
|
* @return A GRRLIB_texImg structure filled with image informations.
|
||||||
|
*/
|
||||||
|
GRRLIB_texImg* GRRLIB_LoadTexturePNG (const u8 *my_png) {
|
||||||
|
PNGUPROP imgProp;
|
||||||
|
IMGCTX ctx;
|
||||||
|
GRRLIB_texImg *my_texture = (struct GRRLIB_texImg *)calloc(1, sizeof(GRRLIB_texImg));
|
||||||
|
|
||||||
|
if(my_texture != NULL) {
|
||||||
|
ctx = PNGU_SelectImageFromBuffer(my_png);
|
||||||
|
PNGU_GetImageProperties(ctx, &imgProp);
|
||||||
|
my_texture->data = memalign(32, imgProp.imgWidth * imgProp.imgHeight * 4);
|
||||||
|
if(my_texture->data != NULL) {
|
||||||
|
PNGU_DecodeTo4x4RGBA8(ctx, imgProp.imgWidth, imgProp.imgHeight, my_texture->data, 255);
|
||||||
|
PNGU_ReleaseImageContext(ctx);
|
||||||
|
my_texture->w = imgProp.imgWidth;
|
||||||
|
my_texture->h = imgProp.imgHeight;
|
||||||
|
GRRLIB_SetHandle( my_texture, 0, 0 );
|
||||||
|
GRRLIB_FlushTex( my_texture );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return my_texture;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load a texture from a buffer.
|
||||||
|
* Take care to have the JPG finnish with 0xFF 0xD9!!
|
||||||
|
* @author DrTwox
|
||||||
|
* @param my_jpg The JPEG buffer to load.
|
||||||
|
* @return A GRRLIB_texImg structure filled with image informations.
|
||||||
|
*/
|
||||||
|
GRRLIB_texImg* GRRLIB_LoadTextureJPG (const u8 *my_jpg) {
|
||||||
|
struct jpeg_decompress_struct cinfo;
|
||||||
|
struct jpeg_error_mgr jerr;
|
||||||
|
GRRLIB_texImg *my_texture = (struct GRRLIB_texImg *)calloc(1, sizeof(GRRLIB_texImg));
|
||||||
|
int n = 0;
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
if(my_texture == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if ((my_jpg[0]==0xFF) && (my_jpg[1]==0xD8) && (my_jpg[2]==0xFF)) {
|
||||||
|
while(true) {
|
||||||
|
if ((my_jpg[n]==0xFF) && (my_jpg[n+1]==0xD9))
|
||||||
|
break;
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
n+=2;
|
||||||
|
}
|
||||||
|
|
||||||
|
jpeg_create_decompress(&cinfo);
|
||||||
|
cinfo.err = jpeg_std_error(&jerr);
|
||||||
|
cinfo.progress = NULL;
|
||||||
|
jpeg_memory_src(&cinfo, my_jpg, n);
|
||||||
|
jpeg_read_header(&cinfo, TRUE);
|
||||||
|
jpeg_start_decompress(&cinfo);
|
||||||
|
unsigned char *tempBuffer = (unsigned char*) malloc(cinfo.output_width * cinfo.output_height * cinfo.num_components);
|
||||||
|
JSAMPROW row_pointer[1];
|
||||||
|
row_pointer[0] = (unsigned char*) malloc(cinfo.output_width * cinfo.num_components);
|
||||||
|
size_t location = 0;
|
||||||
|
while (cinfo.output_scanline < cinfo.output_height) {
|
||||||
|
jpeg_read_scanlines(&cinfo, row_pointer, 1);
|
||||||
|
for (i = 0; i < cinfo.image_width * cinfo.num_components; i++) {
|
||||||
|
/* Put the decoded scanline into the tempBuffer */
|
||||||
|
tempBuffer[ location++ ] = row_pointer[0][i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Create a buffer to hold the final texture */
|
||||||
|
my_texture->data = memalign(32, cinfo.output_width * cinfo.output_height * 4);
|
||||||
|
RawTo4x4RGBA(tempBuffer, my_texture->data, cinfo.output_width, cinfo.output_height);
|
||||||
|
|
||||||
|
/* Done - Do cleanup and release allocated memory */
|
||||||
|
jpeg_finish_decompress(&cinfo);
|
||||||
|
jpeg_destroy_decompress(&cinfo);
|
||||||
|
free(row_pointer[0]);
|
||||||
|
free(tempBuffer);
|
||||||
|
|
||||||
|
my_texture->w = cinfo.output_width;
|
||||||
|
my_texture->h = cinfo.output_height;
|
||||||
|
GRRLIB_SetHandle( my_texture, 0, 0 );
|
||||||
|
GRRLIB_FlushTex( my_texture );
|
||||||
|
return my_texture;
|
||||||
|
}
|
||||||
|
|
||||||
|
//==============================================================================
|
||||||
|
/**
|
||||||
|
* Compose a layer/sprite to a canvas/textured-image
|
||||||
|
* Currently only performs "a-over-b (normal) alpha compositing" (opacity)
|
||||||
|
* Ie. Light source is behind the eye, not behind the canvas!
|
||||||
|
* @author BlueChip
|
||||||
|
* @param xoff : The x-offset within the canvas (negative values allowed)
|
||||||
|
* @param yoff : The y-offset within the canvas (negative values allowed)
|
||||||
|
* @param layer : The layer/sprite to draw
|
||||||
|
* @param canvas : The canvas/textured-image on which to draw
|
||||||
|
* @param mode : Currently unused - will be composition mode
|
||||||
|
*/
|
||||||
|
//==============================================================================
|
||||||
|
void GRRLIB_Compose( int xoff, int yoff, GRRLIB_texImg* layer,
|
||||||
|
GRRLIB_texImg* canvas, GRRLIB_ComposeMode mode )
|
||||||
|
{
|
||||||
|
int x, y; // x & y on layer
|
||||||
|
int cnv_x, cnv_y; // x & y on canvas
|
||||||
|
|
||||||
|
float cnv_a, lyr_a, alpha; // Alpha of canvas & layer & result
|
||||||
|
u32 cnv_c, lyr_c; // Colour of pixel from canvas & layer
|
||||||
|
u32 new_r, new_g, new_b, new_a; // R, G, B & A values of result
|
||||||
|
|
||||||
|
// Loop through the layer, one pixel at a time
|
||||||
|
for (y = 0; y < layer->h; y++) {
|
||||||
|
cnv_y = y +yoff; // y coord of canvas pixel to be changed
|
||||||
|
if (cnv_y < 0) continue ; // not on the canvas yet
|
||||||
|
if (cnv_y >= canvas->h) break; // off the bottom of the canvas
|
||||||
|
|
||||||
|
for (x = 0; x < layer->w; x++) {
|
||||||
|
cnv_x = x +xoff; // x coord of canvas pixel to be changed
|
||||||
|
if (cnv_x < 0) continue ; // not on the canvas yet
|
||||||
|
if (cnv_x >= canvas->h) break; // off the right of the canvas
|
||||||
|
|
||||||
|
// Grab the working pixels from the canvas and layer
|
||||||
|
cnv_c = GRRLIB_GetPixelFromtexImg(cnv_x,cnv_y, canvas);
|
||||||
|
lyr_c = GRRLIB_GetPixelFromtexImg(x,y, layer);
|
||||||
|
|
||||||
|
// Calculate alpha value as 0.0 to 1.0 in 255th's
|
||||||
|
cnv_a = A(cnv_c) /255.0;
|
||||||
|
lyr_a = A(lyr_c) /255.0;
|
||||||
|
|
||||||
|
// Perform desired composition
|
||||||
|
switch (mode) {
|
||||||
|
default:
|
||||||
|
case GRRLIB_COMPOSE_NORMAL :
|
||||||
|
// Perform "a-over-b (normal) alpha compositing" (opacity)
|
||||||
|
// http://en.wikipedia.org/wiki/Alpha_compositing
|
||||||
|
new_a = (u32)( A(lyr_c) + (A(cnv_c) *(1.0 -lyr_a)) );
|
||||||
|
alpha = new_a /255.0;
|
||||||
|
new_r = ( (R(lyr_c) *lyr_a) + (R(cnv_c) *cnv_a *(1 -lyr_a)) ) /alpha;
|
||||||
|
new_g = ( (G(lyr_c) *lyr_a) + (G(cnv_c) *cnv_a *(1 -lyr_a)) ) /alpha;
|
||||||
|
new_b = ( (B(lyr_c) *lyr_a) + (B(cnv_c) *cnv_a *(1 -lyr_a)) ) /alpha;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Replace the old canvas pixel with the new one
|
||||||
|
GRRLIB_SetPixelTotexImg( cnv_x,cnv_y, canvas,
|
||||||
|
RGBA(new_r, new_g, new_b, new_a) );
|
||||||
|
}//for x
|
||||||
|
}// for y
|
||||||
|
|
||||||
|
GRRLIB_FlushTex(canvas);
|
||||||
|
}
|
242
GRRLIB/GRRLIB/grrlib.h
Normal file
242
GRRLIB/GRRLIB/grrlib.h
Normal file
|
@ -0,0 +1,242 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
Copyright (c) 2009 The GRRLIB Team
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
Library : GRRLIB (GX inside)
|
||||||
|
Version : 4.1.0
|
||||||
|
Project Leader : NoNameNo
|
||||||
|
Documentation : Crayon
|
||||||
|
Lead Coder : NoNameNo,
|
||||||
|
Support Coders : BlueChip, DragonMinded, Xane
|
||||||
|
Advisors : RedShade
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file GRRLIB.h
|
||||||
|
* GRRLIB library.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __GRRLIB_H__
|
||||||
|
#define __GRRLIB_H__
|
||||||
|
|
||||||
|
#define __HAVE_GRRLIB__
|
||||||
|
|
||||||
|
//==============================================================================
|
||||||
|
// Includes
|
||||||
|
//==============================================================================
|
||||||
|
#include <gccore.h>
|
||||||
|
|
||||||
|
//==============================================================================
|
||||||
|
/*
|
||||||
|
*** Temporary fix ***
|
||||||
|
After the release of libogc v1.7.1a, Vector was renamed to guVector
|
||||||
|
"to avoid collisions" [svn 3650]
|
||||||
|
...also Quaternion was renamed to guQuaternion - but GRRLIB does not use these!
|
||||||
|
|
||||||
|
The main codebase of GRRLIB has been updated to reflect this change.
|
||||||
|
But until the new libogc is officially released,
|
||||||
|
if you are using a version of libogc later than v1.7.1a/svn3649,
|
||||||
|
you will need to add:
|
||||||
|
-DNOGUFIX
|
||||||
|
to the compiler flags in your makefile
|
||||||
|
|
||||||
|
When the libogc changes are officially released,
|
||||||
|
this *temporary fix* should be removed
|
||||||
|
The requirement for -DNOGUFIX will be deprecated,
|
||||||
|
but its lingering presence will not be a hinderance
|
||||||
|
|
||||||
|
Thanks to Nicksasa for reporting this problem :)
|
||||||
|
*/
|
||||||
|
//==============================================================================
|
||||||
|
#ifndef NOGUFIX
|
||||||
|
// If you are getting a compile error here, read the above comment!
|
||||||
|
typedef Vector guVector ;
|
||||||
|
typedef Quaternion guQuaternion ;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//==============================================================================
|
||||||
|
// C++ header
|
||||||
|
//==============================================================================
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
//==============================================================================
|
||||||
|
// Extra standard declarations
|
||||||
|
//==============================================================================
|
||||||
|
typedef unsigned int uint;
|
||||||
|
|
||||||
|
//==============================================================================
|
||||||
|
// Primitive colour macros
|
||||||
|
//==============================================================================
|
||||||
|
// Feel free to convert these to inline functions if it floats your boat
|
||||||
|
#define R(c) (((c) >>24) &0xFF) // Exract RED component of colour
|
||||||
|
#define G(c) (((c) >>16) &0xFF) // Exract GREEN component of colour
|
||||||
|
#define B(c) (((c) >> 8) &0xFF) // Exract BLUE component of colour
|
||||||
|
#define A(c) ( (c) &0xFF) // Exract ALPHA component of colour
|
||||||
|
|
||||||
|
// Build an RGB pixel from components
|
||||||
|
#define RGBA(r,g,b,a) ( (u32)( ( ((u32)(r)) <<24) | \
|
||||||
|
((((u32)(g)) &0xFF) <<16) | \
|
||||||
|
((((u32)(b)) &0xFF) << 8) | \
|
||||||
|
( ((u32)(a)) &0xFF ) ) )
|
||||||
|
|
||||||
|
//==============================================================================
|
||||||
|
// typedefs, enumerators & structs
|
||||||
|
//==============================================================================
|
||||||
|
/**
|
||||||
|
* Compositions Modes
|
||||||
|
* NORMAL : a-over-b alpha composition (normal)
|
||||||
|
* ...more to come
|
||||||
|
*/
|
||||||
|
typedef enum Composition_Modes {
|
||||||
|
GRRLIB_COMPOSE_NORMAL,
|
||||||
|
} GRRLIB_ComposeMode;
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* GRRLIB Blending Modes
|
||||||
|
*/
|
||||||
|
typedef enum GRRLIB_blendMode {
|
||||||
|
GRRLIB_BLEND_ALPHA = 0, /**< Alpha Blending. */
|
||||||
|
GRRLIB_BLEND_ADD = 1, /**< Additive Blending. */
|
||||||
|
GRRLIB_BLEND_SCREEN = 2, /**< Alpha Light Blending. */
|
||||||
|
GRRLIB_BLEND_MULTI = 3, /**< Multiply Blending. */
|
||||||
|
GRRLIB_BLEND_INV = 4, /**< Invert Color Blending. */
|
||||||
|
} GRRLIB_blendMode;
|
||||||
|
|
||||||
|
// Blending mode aliases
|
||||||
|
#define GRRLIB_BLEND_NONE (GRRLIB_BLEND_ALPHA)
|
||||||
|
#define GRRLIB_BLEND_LIGHT (GRRLIB_BLEND_ADD)
|
||||||
|
#define GRRLIB_BLEND_SHADE (GRRLIB_BLEND_MULTI)
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* Structure to hold the current drawing settings.
|
||||||
|
*/
|
||||||
|
typedef struct GRRLIB_drawSettings {
|
||||||
|
bool antialias; /**< true => AntiAlias enabled. */
|
||||||
|
int blend; /**< Blending Mode. */
|
||||||
|
} GRRLIB_drawSettings;
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* Structure to hold the texture informations.
|
||||||
|
*/
|
||||||
|
typedef struct GRRLIB_texImg {
|
||||||
|
uint w; /**< Texture Width. */
|
||||||
|
uint h; /**< Texture Height. */
|
||||||
|
int handlex; /**< Texture Handle x. */
|
||||||
|
int handley; /**< Texture Handle y. */
|
||||||
|
int offsetx; /**< Texture Offset x. */
|
||||||
|
int offsety; /**< Texture Offset y. */
|
||||||
|
|
||||||
|
bool tiledtex; /**< true => Texture is tiled. */
|
||||||
|
uint tilew; /**< Width of one tile. */
|
||||||
|
uint tileh; /**< Height of one tile. */
|
||||||
|
uint nbtilew; /**< Number of tiles for the x axis. */
|
||||||
|
uint nbtileh; /**< Number of tiles for the y axis. */
|
||||||
|
uint tilestart; /**< Offset to tile starting position. */
|
||||||
|
|
||||||
|
void *data; /**< Pointer to the texture data. */
|
||||||
|
} GRRLIB_texImg;
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* Structure to hold the bytemap character informations.
|
||||||
|
*/
|
||||||
|
typedef struct GRRLIB_bytemapChar {
|
||||||
|
u8 character; /**< Character identity. */
|
||||||
|
u8 width; /**< Character width. */
|
||||||
|
u8 height; /**< Character height. */
|
||||||
|
s8 relx; /**< Horizontal offset relative to cursor (-128 to 127). */
|
||||||
|
s8 rely; /**< Vertical offset relative to cursor (-128 to 127). */
|
||||||
|
u8 kerning; /**< Kerning (Horizontal cursor shift after drawing the character). */
|
||||||
|
u8 *data; /**< Character data (uncompressed, 8 bits per pixel). */
|
||||||
|
} GRRLIB_bytemapChar;
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* Structure to hold the bytemap font informations.
|
||||||
|
*/
|
||||||
|
typedef
|
||||||
|
struct GRRLIB_bytemapFont {
|
||||||
|
//! the order of the fields here is changed
|
||||||
|
//! to encourage efficient structure packing in the compiler
|
||||||
|
char *name; /**< Font name. */
|
||||||
|
u32 *palette; /**< Font palette. */
|
||||||
|
u16 nbChar; /**< Number of characters in font. */
|
||||||
|
u8 version; /**< Version. */
|
||||||
|
s8 tracking; /**< Tracking (Add-space after each char) (-128 to 127). */
|
||||||
|
|
||||||
|
GRRLIB_bytemapChar *charDef; /**< Array of bitmap characters. */
|
||||||
|
}
|
||||||
|
GRRLIB_bytemapFont;
|
||||||
|
|
||||||
|
//==============================================================================
|
||||||
|
// Allow general access to screen and frame information
|
||||||
|
//==============================================================================
|
||||||
|
#if defined __GRRLIB_CORE__
|
||||||
|
# define GRR_EXTERN
|
||||||
|
# define GRR_INIT(v) = v
|
||||||
|
# define GRR_INITS(...) = { __VA_ARGS__ }
|
||||||
|
#else
|
||||||
|
# define GRR_EXTERN extern
|
||||||
|
# define GRR_INIT(v)
|
||||||
|
# define GRR_INITS(...)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
GRR_EXTERN GXRModeObj *rmode;
|
||||||
|
GRR_EXTERN void *xfb[2] GRR_INITS(NULL, NULL) ;
|
||||||
|
GRR_EXTERN u32 fb GRR_INIT(0) ;
|
||||||
|
|
||||||
|
//==============================================================================
|
||||||
|
// procedure and function prototypes
|
||||||
|
// Inline function handling - http://www.greenend.org.uk/rjk/2003/03/inline.html
|
||||||
|
//==============================================================================
|
||||||
|
#include "grrlib/GRRLIB__lib.h"
|
||||||
|
|
||||||
|
#if defined __GRRLIB_CORE__
|
||||||
|
# define INLINE
|
||||||
|
#else
|
||||||
|
# if __GNUC__ && !__GNUC_STDC_INLINE__
|
||||||
|
# define INLINE extern inline
|
||||||
|
# else
|
||||||
|
# define INLINE inline
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
#include "grrlib/GRRLIB__inline.h"
|
||||||
|
|
||||||
|
//==============================================================================
|
||||||
|
// C++ footer
|
||||||
|
//==============================================================================
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#endif // __GRRLIB_H__
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @mainpage GRRLIB Documentation
|
||||||
|
* @image html grrlib_logo.png
|
||||||
|
* Welcome to the GRRLIB documentation.
|
||||||
|
*/
|
136
GRRLIB/GRRLIB/grrlib/GRRLIB__inline.h
Normal file
136
GRRLIB/GRRLIB/grrlib/GRRLIB__inline.h
Normal file
|
@ -0,0 +1,136 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
Copyright (c) 2009 The GRRLIB Team
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file GRRLIB_fnLibrary.h
|
||||||
|
* GRRLIB inline functions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __GRRLIB_H__
|
||||||
|
# error Do not include GRRLIB_fnInline.h directly, include only GRRLIB.h
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __GRRLIB_FNINLINE_H__
|
||||||
|
#define __GRRLIB_FNINLINE_H__
|
||||||
|
|
||||||
|
//==============================================================================
|
||||||
|
// Prototypes for inlined functions
|
||||||
|
//==============================================================================
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// GRRLIB_cExtn.h - C extensions (helper functions)
|
||||||
|
INLINE u8 GRRLIB_ClampVar8 (f32 Value) ;
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// GRRLIB_clipping.h - Clipping control
|
||||||
|
INLINE void GRRLIB_ClipReset (void) ;
|
||||||
|
INLINE void GRRLIB_ClipDrawing (const int x, const int y,
|
||||||
|
const int width, const int height) ;
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// GRRLIB_collision.h - Collision detection
|
||||||
|
INLINE bool GRRLIB_PtInRect (const int hotx, const int hoty,
|
||||||
|
const int hotw, const int hoth,
|
||||||
|
const int wpadx, const int wpady) ;
|
||||||
|
|
||||||
|
INLINE bool GRRLIB_RectInRect (const int rect1x, const int rect1y,
|
||||||
|
const int rect1w, const int rect1h,
|
||||||
|
const int rect2x, const int rect2y,
|
||||||
|
const int rect2w, const int rect2h) ;
|
||||||
|
|
||||||
|
INLINE bool GRRLIB_RectOnRect (const int rect1x, const int rect1y,
|
||||||
|
const int rect1w, const int rect1h,
|
||||||
|
const int rect2x, const int rect2y,
|
||||||
|
const int rect2w, const int rect2h) ;
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// GRRLIB_fbComplex.h -
|
||||||
|
INLINE void GRRLIB_NPlot (const guVector v[], const u32 color[],
|
||||||
|
const long n) ;
|
||||||
|
INLINE void GRRLIB_NGone (const guVector v[], const u32 color[],
|
||||||
|
const long n) ;
|
||||||
|
INLINE void GRRLIB_NGoneFilled (const guVector v[], const u32 color[],
|
||||||
|
const long n) ;
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// GRRLIB_fbGX.h -
|
||||||
|
INLINE void GRRLIB_GXEngine (const guVector v[], const u32 color[],
|
||||||
|
const long n, const u8 fmt) ;
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// GRRLIB_fbSimple.h -
|
||||||
|
INLINE void GRRLIB_FillScreen (const u32 color) ;
|
||||||
|
INLINE void GRRLIB_Plot (const f32 x, const f32 y, const u32 color) ;
|
||||||
|
INLINE void GRRLIB_Line (const f32 x1, const f32 y1,
|
||||||
|
const f32 x2, const f32 y2, const u32 color) ;
|
||||||
|
INLINE void GRRLIB_Rectangle (const f32 x, const f32 y,
|
||||||
|
const f32 width, const f32 height,
|
||||||
|
const u32 color, const u8 filled) ;
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// GRRLIB_handle.h - Texture handle manipulation
|
||||||
|
INLINE void GRRLIB_SetHandle (GRRLIB_texImg *tex, const int x, const int y) ;
|
||||||
|
INLINE void GRRLIB_SetMidHandle (GRRLIB_texImg *tex, const bool enabled) ;
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// GRRLIB_pixel.h - Pixel manipulation
|
||||||
|
INLINE u32 GRRLIB_GetPixelFromtexImg (const int x, const int y,
|
||||||
|
const GRRLIB_texImg *tex) ;
|
||||||
|
|
||||||
|
INLINE void GRRLIB_SetPixelTotexImg (const int x, const int y,
|
||||||
|
GRRLIB_texImg *tex, const u32 color) ;
|
||||||
|
|
||||||
|
INLINE u32 GRRLIB_GetColor (const u8 r, const u8 g, const u8 b, const u8 a) ;
|
||||||
|
|
||||||
|
INLINE void GRRLIB_GetPixelFromFB (int x, int y,
|
||||||
|
u8 *R1, u8 *G1, u8 *B1,
|
||||||
|
u8 *R2, u8 *G2, u8 *B2) ;
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// GRRLIB_settings.h - Rendering functions
|
||||||
|
INLINE void GRRLIB_SetBlend (const int blendmode) ;
|
||||||
|
INLINE int GRRLIB_GetBlend (void) ;
|
||||||
|
INLINE void GRRLIB_SetAntiAliasing (const bool aa) ;
|
||||||
|
INLINE bool GRRLIB_GetAntiAliasing (void) ;
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// GRRLIB_texSetup.h - Create and setup textures
|
||||||
|
INLINE GRRLIB_texImg* GRRLIB_CreateEmptyTexture (const uint w, const uint h) ;
|
||||||
|
INLINE void GRRLIB_ClearTex (GRRLIB_texImg* tex) ;
|
||||||
|
INLINE void GRRLIB_FlushTex (GRRLIB_texImg *tex) ;
|
||||||
|
INLINE void GRRLIB_FreeTexture (GRRLIB_texImg *tex) ;
|
||||||
|
|
||||||
|
//==============================================================================
|
||||||
|
// Definitions of inlined functions
|
||||||
|
//==============================================================================
|
||||||
|
#include <grrlib/GRRLIB_cExtn.h> // C extensions (helper functions)
|
||||||
|
#include <grrlib/GRRLIB_clipping.h> // Clipping control
|
||||||
|
#include <grrlib/GRRLIB_collision.h> // Collision detection
|
||||||
|
#include <grrlib/GRRLIB_fbComplex.h> // Render to framebuffer: Complex primitives
|
||||||
|
#include <grrlib/GRRLIB_fbGX.h> // Render to framebuffer: Simple GX wrapper
|
||||||
|
#include <grrlib/GRRLIB_fbSimple.h> // Render to framebuffer: Simple primitives
|
||||||
|
#include <grrlib/GRRLIB_handle.h> // Texture handle manipulation
|
||||||
|
#include <grrlib/GRRLIB_pixel.h> // Pixel manipulation
|
||||||
|
#include <grrlib/GRRLIB_settings.h> // GRRLIB Settings
|
||||||
|
#include <grrlib/GRRLIB_texSetup.h> // Setup for textures
|
||||||
|
|
||||||
|
#endif // __GRRLIB_FNINLINE_H__
|
123
GRRLIB/GRRLIB/grrlib/GRRLIB__lib.h
Normal file
123
GRRLIB/GRRLIB/grrlib/GRRLIB__lib.h
Normal file
|
@ -0,0 +1,123 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
Copyright (c) 2009 The GRRLIB Team
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file GRRLIB_fnLibrary.h
|
||||||
|
* GRRLIB library functions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __GRRLIB_H__
|
||||||
|
# error Do not include GRRLIB_fnLib.h directly, include only GRRLIB.h
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __GRRLIB_FNLIB_H__
|
||||||
|
#define __GRRLIB_FNLIB_H__
|
||||||
|
|
||||||
|
//==============================================================================
|
||||||
|
// Prototypes for library contained functions
|
||||||
|
//==============================================================================
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// GRRLIB_bmf.c - BitMapFont functions
|
||||||
|
GRRLIB_bytemapFont* GRRLIB_LoadBMF (const u8 my_bmf[] ) ;
|
||||||
|
void GRRLIB_FreeBMF (const GRRLIB_bytemapFont *bmf) ;
|
||||||
|
|
||||||
|
void GRRLIB_InitTileSet (GRRLIB_texImg *tex,
|
||||||
|
const uint tilew, const uint tileh,
|
||||||
|
const uint tilestart) ;
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// GRRLIB_bmfx.c - Bitmap f/x
|
||||||
|
void GRRLIB_BMFX_FlipH (const GRRLIB_texImg *texsrc,
|
||||||
|
GRRLIB_texImg *texdest) ;
|
||||||
|
|
||||||
|
void GRRLIB_BMFX_FlipV (const GRRLIB_texImg *texsrc,
|
||||||
|
GRRLIB_texImg *texdest) ;
|
||||||
|
|
||||||
|
void GRRLIB_BMFX_Grayscale (const GRRLIB_texImg *texsrc,
|
||||||
|
GRRLIB_texImg *texdest) ;
|
||||||
|
|
||||||
|
void GRRLIB_BMFX_Invert (const GRRLIB_texImg *texsrc,
|
||||||
|
GRRLIB_texImg *texdest) ;
|
||||||
|
|
||||||
|
void GRRLIB_BMFX_Blur (const GRRLIB_texImg *texsrc,
|
||||||
|
GRRLIB_texImg *texdest, const u32 factor) ;
|
||||||
|
|
||||||
|
void GRRLIB_BMFX_Scatter (const GRRLIB_texImg *texsrc,
|
||||||
|
GRRLIB_texImg *texdest, const u32 factor) ;
|
||||||
|
|
||||||
|
void GRRLIB_BMFX_Pixelate (const GRRLIB_texImg *texsrc,
|
||||||
|
GRRLIB_texImg *texdest, const u32 factor) ;
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// GRRLIB_core.c - GRRLIB core functions
|
||||||
|
void GRRLIB_Init (void) ;
|
||||||
|
void GRRLIB_Exit (void) ;
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// GRRLIB_fbAdvanced.c - Render to framebuffer: Advanced primitives
|
||||||
|
void GRRLIB_Circle (const f32 x, const f32 y, const f32 radius,
|
||||||
|
const u32 color, const u8 filled) ;
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
//! GRRLIB_print.c - Will someome please tell me what these are :)
|
||||||
|
void GRRLIB_Printf (const f32 xpos, const f32 ypos,
|
||||||
|
const GRRLIB_texImg *tex, const u32 color,
|
||||||
|
const f32 zoom, const char *text, ...) ;
|
||||||
|
|
||||||
|
void GRRLIB_PrintBMF (const f32 xpos, const f32 ypos,
|
||||||
|
const GRRLIB_bytemapFont *bmf,
|
||||||
|
const f32 zoom, const char *text, ...) ;
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// GRRLIB_render.c - Rendering functions
|
||||||
|
void GRRLIB_DrawImg (const f32 xpos, const f32 ypos, const GRRLIB_texImg *tex,
|
||||||
|
const f32 degrees, const f32 scaleX, const f32 scaleY,
|
||||||
|
const u32 color) ;
|
||||||
|
|
||||||
|
void GRRLIB_DrawImgQuad (const guVector pos[4], GRRLIB_texImg *tex,
|
||||||
|
const u32 color) ;
|
||||||
|
|
||||||
|
void GRRLIB_DrawTile (const f32 xpos, const f32 ypos, const GRRLIB_texImg *tex,
|
||||||
|
const f32 degrees, const f32 scaleX, const f32 scaleY,
|
||||||
|
const u32 color, const int frame) ;
|
||||||
|
|
||||||
|
void GRRLIB_DrawTileQuad (const guVector pos[4], GRRLIB_texImg *tex,
|
||||||
|
const u32 color, const int frame) ;
|
||||||
|
|
||||||
|
void GRRLIB_Render (void) ;
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// GRRLIB_snapshot.c - Create a texture containing a snapshot of the framebuffer
|
||||||
|
void GRRLIB_Screen2Texture (GRRLIB_texImg *tex) ;
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// GRRLIB_texEdit.c - Modifying the content of a texture
|
||||||
|
|
||||||
|
GRRLIB_texImg* GRRLIB_LoadTexture (const u8 *my_img) ;
|
||||||
|
GRRLIB_texImg* GRRLIB_LoadTexturePNG (const u8 *my_png) ;
|
||||||
|
GRRLIB_texImg* GRRLIB_LoadTextureJPG (const u8 *my_jpg) ;
|
||||||
|
void GRRLIB_Compose (int xoff, int yoff, GRRLIB_texImg* layer,
|
||||||
|
GRRLIB_texImg* canvas,
|
||||||
|
GRRLIB_ComposeMode mode) ;
|
||||||
|
|
||||||
|
#endif // __GRRLIB_FNLIB_H__
|
40
GRRLIB/GRRLIB/grrlib/GRRLIB_cExtn.h
Normal file
40
GRRLIB/GRRLIB/grrlib/GRRLIB_cExtn.h
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
Copyright (c) 2009 The GRRLIB Team
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A helper function for the YCbCr -> RGB conversion.
|
||||||
|
* Clamps the given value into a range of 0 - 255 and thus preventing an overflow.
|
||||||
|
* @param Value The value to clamp.
|
||||||
|
* @return Returns a clean, clamped unsigned char.
|
||||||
|
*/
|
||||||
|
INLINE
|
||||||
|
u8 GRRLIB_ClampVar8 (f32 Value) {
|
||||||
|
/* Using float to increase the precision.
|
||||||
|
This makes a full spectrum (0 - 255) possible. */
|
||||||
|
Value = roundf(Value);
|
||||||
|
if (Value < 0) Value = 0 ;
|
||||||
|
else if (Value > 255) Value = 255 ;
|
||||||
|
|
||||||
|
return (u8)Value;
|
||||||
|
}
|
44
GRRLIB/GRRLIB/grrlib/GRRLIB_clipping.h
Normal file
44
GRRLIB/GRRLIB/grrlib/GRRLIB_clipping.h
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
Copyright (c) 2009 The GRRLIB Team
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset the clipping to normal.
|
||||||
|
*/
|
||||||
|
INLINE
|
||||||
|
void GRRLIB_ClipReset (void) {
|
||||||
|
GX_SetClipMode( GX_CLIP_ENABLE );
|
||||||
|
GX_SetScissor( 0, 0, rmode->fbWidth, rmode->efbHeight );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clip the drawing area to an rectangle.
|
||||||
|
* @param x The x-coordinate of the rectangle.
|
||||||
|
* @param y The y-coordinate of the rectangle.
|
||||||
|
* @param width The width of the rectangle.
|
||||||
|
* @param height The height of the rectangle.
|
||||||
|
*/
|
||||||
|
INLINE
|
||||||
|
void GRRLIB_ClipDrawing (const int x, const int y,
|
||||||
|
const int width, const int height) {
|
||||||
|
GX_SetClipMode( GX_CLIP_ENABLE );
|
||||||
|
GX_SetScissor( x, y, width, height );
|
||||||
|
}
|
84
GRRLIB/GRRLIB/grrlib/GRRLIB_collision.h
Normal file
84
GRRLIB/GRRLIB/grrlib/GRRLIB_collision.h
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
Copyright (c) 2009 The GRRLIB Team
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the specified point lies within the specified rectangle.
|
||||||
|
* @param hotx Specifies the x-coordinate of the upper-left corner of the rectangle.
|
||||||
|
* @param hoty Specifies the y-coordinate of the upper-left corner of the rectangle.
|
||||||
|
* @param hotw The width of the rectangle.
|
||||||
|
* @param hoth The height of the rectangle.
|
||||||
|
* @param wpadx Specifies the x-coordinate of the point.
|
||||||
|
* @param wpady Specifies the y-coordinate of the point.
|
||||||
|
* @return If the specified point lies within the rectangle, the return value is true otherwise it's false.
|
||||||
|
*/
|
||||||
|
INLINE
|
||||||
|
bool GRRLIB_PtInRect (const int hotx, const int hoty,
|
||||||
|
const int hotw, const int hoth,
|
||||||
|
const int wpadx, const int wpady) {
|
||||||
|
return( ((wpadx>=hotx) && (wpadx<=(hotx+hotw))) &&
|
||||||
|
((wpady>=hoty) && (wpady<=(hoty+hoth))) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether a specified rectangle lies within another rectangle.
|
||||||
|
* @param rect1x Specifies the x-coordinate of the upper-left corner of the rectangle.
|
||||||
|
* @param rect1y Specifies the y-coordinate of the upper-left corner of the rectangle.
|
||||||
|
* @param rect1w Specifies the width of the rectangle.
|
||||||
|
* @param rect1h Specifies the height of the rectangle.
|
||||||
|
* @param rect2x Specifies the x-coordinate of the upper-left corner of the rectangle.
|
||||||
|
* @param rect2y Specifies the y-coordinate of the upper-left corner of the rectangle.
|
||||||
|
* @param rect2w Specifies the width of the rectangle.
|
||||||
|
* @param rect2h Specifies the height of the rectangle.
|
||||||
|
* @return If the specified rectangle lies within the other rectangle, the return value is true otherwise it's false.
|
||||||
|
*/
|
||||||
|
INLINE
|
||||||
|
bool GRRLIB_RectInRect (const int rect1x, const int rect1y,
|
||||||
|
const int rect1w, const int rect1h,
|
||||||
|
const int rect2x, const int rect2y,
|
||||||
|
const int rect2w, const int rect2h) {
|
||||||
|
return ( (rect1x >= rect2x) && (rect1y >= rect2y) &&
|
||||||
|
(rect1x+rect1w <= rect2x+rect2w) &&
|
||||||
|
(rect1y+rect1h <= rect2y+rect2h) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether a part of a specified rectangle lies on another rectangle.
|
||||||
|
* @param rect1x Specifies the x-coordinate of the upper-left corner of the first rectangle.
|
||||||
|
* @param rect1y Specifies the y-coordinate of the upper-left corner of the first rectangle.
|
||||||
|
* @param rect1w Specifies the width of the first rectangle.
|
||||||
|
* @param rect1h Specifies the height of the first rectangle.
|
||||||
|
* @param rect2x Specifies the x-coordinate of the upper-left corner of the second rectangle.
|
||||||
|
* @param rect2y Specifies the y-coordinate of the upper-left corner of the second rectangle.
|
||||||
|
* @param rect2w Specifies the width of the second rectangle.
|
||||||
|
* @param rect2h Specifies the height of the second rectangle.
|
||||||
|
* @return If the specified rectangle lies on the other rectangle, the return value is true otherwise it's false.
|
||||||
|
*/
|
||||||
|
INLINE
|
||||||
|
bool GRRLIB_RectOnRect (const int rect1x, const int rect1y,
|
||||||
|
const int rect1w, const int rect1h,
|
||||||
|
const int rect2x, const int rect2y,
|
||||||
|
const int rect2w, const int rect2h) {
|
||||||
|
return GRRLIB_PtInRect(rect1x, rect1y, rect1w, rect1h, rect2x, rect2y) ||
|
||||||
|
GRRLIB_PtInRect(rect1x, rect1y, rect1w, rect1h, rect2x+rect2w, rect2y) ||
|
||||||
|
GRRLIB_PtInRect(rect1x, rect1y, rect1w, rect1h, rect2x+rect2w, rect2y+rect2h) ||
|
||||||
|
GRRLIB_PtInRect(rect1x, rect1y, rect1w, rect1h, rect2x, rect2y+rect2h) ;
|
||||||
|
}
|
54
GRRLIB/GRRLIB/grrlib/GRRLIB_fbComplex.h
Normal file
54
GRRLIB/GRRLIB/grrlib/GRRLIB_fbComplex.h
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
Copyright (c) 2009 The GRRLIB Team
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw an array of points.
|
||||||
|
* @param v Array containing the points.
|
||||||
|
* @param color The color of the points in RGBA format.
|
||||||
|
* @param n Number of points in the vector array.
|
||||||
|
*/
|
||||||
|
INLINE
|
||||||
|
void GRRLIB_NPlot (const guVector v[], const u32 color[], const long n) {
|
||||||
|
GRRLIB_GXEngine(v, color, n, GX_POINTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw a polygon.
|
||||||
|
* @param v The vector containing the coordinates of the polygon.
|
||||||
|
* @param color The color of the filled polygon in RGBA format.
|
||||||
|
* @param n Number of points in the vector.
|
||||||
|
*/
|
||||||
|
INLINE
|
||||||
|
void GRRLIB_NGone (const guVector v[], const u32 color[], const long n) {
|
||||||
|
GRRLIB_GXEngine(v, color, n, GX_LINESTRIP);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw a filled polygon.
|
||||||
|
* @param v The vector containing the coordinates of the polygon.
|
||||||
|
* @param color The color of the filled polygon in RGBA format.
|
||||||
|
* @param n Number of points in the vector.
|
||||||
|
*/
|
||||||
|
INLINE
|
||||||
|
void GRRLIB_NGoneFilled (const guVector v[], const u32 color[], const long n) {
|
||||||
|
GRRLIB_GXEngine(v, color, n, GX_TRIANGLEFAN);
|
||||||
|
}
|
37
GRRLIB/GRRLIB/grrlib/GRRLIB_fbGX.h
Normal file
37
GRRLIB/GRRLIB/grrlib/GRRLIB_fbGX.h
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
Copyright (c) 2009 The GRRLIB Team
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draws a vector.
|
||||||
|
*/
|
||||||
|
INLINE
|
||||||
|
void GRRLIB_GXEngine (const guVector v[], const u32 color[], const long n,
|
||||||
|
const u8 fmt) {
|
||||||
|
int i;
|
||||||
|
|
||||||
|
GX_Begin(fmt, GX_VTXFMT0, n);
|
||||||
|
for (i = 0; i < n; i++) {
|
||||||
|
GX_Position3f32(v[i].x, v[i].y, v[i].z);
|
||||||
|
GX_Color1u32(color[i]);
|
||||||
|
}
|
||||||
|
GX_End();
|
||||||
|
}
|
88
GRRLIB/GRRLIB/grrlib/GRRLIB_fbSimple.h
Normal file
88
GRRLIB/GRRLIB/grrlib/GRRLIB_fbSimple.h
Normal file
|
@ -0,0 +1,88 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
Copyright (c) 2009 The GRRLIB Team
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear screen with a specific color.
|
||||||
|
* @param color The color to use to fill the screen.
|
||||||
|
*/
|
||||||
|
INLINE
|
||||||
|
void GRRLIB_FillScreen (const u32 color) {
|
||||||
|
GRRLIB_Rectangle(-40, -40,
|
||||||
|
rmode->fbWidth +80, rmode->xfbHeight +80,
|
||||||
|
color, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw a dot.
|
||||||
|
* @param x Specifies the x-coordinate of the dot.
|
||||||
|
* @param y Specifies the y-coordinate of the dot.
|
||||||
|
* @param color The color of the dot in RGBA format.
|
||||||
|
*/
|
||||||
|
INLINE
|
||||||
|
void GRRLIB_Plot (const f32 x, const f32 y, const u32 color) {
|
||||||
|
guVector v[] = {{x,y,0.0f}};
|
||||||
|
u32 ncolor[] = {color};
|
||||||
|
|
||||||
|
GRRLIB_NPlot(v, ncolor, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw a line.
|
||||||
|
* @param x1 Starting point for line for the x coordinate.
|
||||||
|
* @param y1 Starting point for line for the y coordinate.
|
||||||
|
* @param x2 Ending point for line for the x coordinate.
|
||||||
|
* @param y2 Ending point for line for the x coordinate.
|
||||||
|
* @param color Line color in RGBA format.
|
||||||
|
*/
|
||||||
|
INLINE
|
||||||
|
void GRRLIB_Line (const f32 x1, const f32 y1,
|
||||||
|
const f32 x2, const f32 y2, const u32 color) {
|
||||||
|
guVector v[] = {{x1,y1,0.0f}, {x2,y2,0.0f}};
|
||||||
|
u32 ncolor[] = {color,color};
|
||||||
|
|
||||||
|
GRRLIB_NGone(v, ncolor, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw a rectangle.
|
||||||
|
* @param x Specifies the x-coordinate of the upper-left corner of the rectangle.
|
||||||
|
* @param y Specifies the y-coordinate of the upper-left corner of the rectangle.
|
||||||
|
* @param width The width of the rectangle.
|
||||||
|
* @param height The height of the rectangle.
|
||||||
|
* @param color The color of the rectangle in RGBA format.
|
||||||
|
* @param filled Set to true to fill the rectangle.
|
||||||
|
*/
|
||||||
|
INLINE
|
||||||
|
void GRRLIB_Rectangle (const f32 x, const f32 y,
|
||||||
|
const f32 width, const f32 height,
|
||||||
|
const u32 color, const u8 filled) {
|
||||||
|
f32 x2 = x+width;
|
||||||
|
f32 y2 = y+height;
|
||||||
|
guVector v[] = { {x,y,0.0f}, {x2,y,0.0f}, {x2,y2,0.0f}, {x,y2,0.0f},
|
||||||
|
{x,y,0.0f} };
|
||||||
|
u32 ncolor[] = {color,color,color,color,color};
|
||||||
|
|
||||||
|
if (!filled) GRRLIB_NGone (v, ncolor, 5) ;
|
||||||
|
else GRRLIB_NGoneFilled(v, ncolor, 4) ;
|
||||||
|
}
|
61
GRRLIB/GRRLIB/grrlib/GRRLIB_handle.h
Normal file
61
GRRLIB/GRRLIB/grrlib/GRRLIB_handle.h
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
Copyright (c) 2009 The GRRLIB Team
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a texture's X and Y handles. e.g. for rotation.
|
||||||
|
* @param tex The texture to set the handle on.
|
||||||
|
* @param x The x-coordinate of the handle.
|
||||||
|
* @param y The y-coordinate of the handle.
|
||||||
|
*/
|
||||||
|
INLINE
|
||||||
|
void GRRLIB_SetHandle (GRRLIB_texImg *tex, const int x, const int y) {
|
||||||
|
if (tex->tiledtex) {
|
||||||
|
tex->handlex = -(((int)tex->tilew)/2) + x;
|
||||||
|
tex->handley = -(((int)tex->tileh)/2) + y;
|
||||||
|
} else {
|
||||||
|
tex->handlex = -(((int)tex->w)/2) + x;
|
||||||
|
tex->handley = -(((int)tex->h)/2) + y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Center a texture's handles. e.g. for rotation.
|
||||||
|
* @param tex The texture to center.
|
||||||
|
* @param enabled
|
||||||
|
*/
|
||||||
|
INLINE
|
||||||
|
void GRRLIB_SetMidHandle (GRRLIB_texImg *tex, const bool enabled) {
|
||||||
|
if (enabled) {
|
||||||
|
if (tex->tiledtex) {
|
||||||
|
tex->offsetx = (((int)tex->tilew)/2);
|
||||||
|
tex->offsety = (((int)tex->tileh)/2);
|
||||||
|
} else {
|
||||||
|
tex->offsetx = (((int)tex->w)/2);
|
||||||
|
tex->offsety = (((int)tex->h)/2);
|
||||||
|
}
|
||||||
|
GRRLIB_SetHandle(tex, tex->offsetx, tex->offsety);
|
||||||
|
} else {
|
||||||
|
GRRLIB_SetHandle(tex, 0, 0);
|
||||||
|
tex->offsetx = 0;
|
||||||
|
tex->offsety = 0;
|
||||||
|
}
|
||||||
|
}
|
118
GRRLIB/GRRLIB/grrlib/GRRLIB_pixel.h
Normal file
118
GRRLIB/GRRLIB/grrlib/GRRLIB_pixel.h
Normal file
|
@ -0,0 +1,118 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
Copyright (c) 2009 The GRRLIB Team
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the color value of a pixel from a GRRLIB_texImg.
|
||||||
|
* @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 The texture to get the color from.
|
||||||
|
* @return The color of a pixel in RGBA format.
|
||||||
|
*/
|
||||||
|
INLINE
|
||||||
|
u32 GRRLIB_GetPixelFromtexImg (const int x, const int y,
|
||||||
|
const GRRLIB_texImg *tex) {
|
||||||
|
u8 *truc = (u8*)tex->data;
|
||||||
|
u32 offset;
|
||||||
|
|
||||||
|
offset = (((y >> 2)<<4)*tex->w) + ((x >> 2)<<6) + ((((y&3) << 2) + (x&3) ) << 1); // Fuckin equation found by NoNameNo ;)
|
||||||
|
|
||||||
|
return ((*(truc+offset+1)<<24) | (*(truc+offset+32)<<16) | (*(truc+offset+33)<<8) | *(truc+offset));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the color value of a pixel to a GRRLIB_texImg.
|
||||||
|
* @see GRRLIB_FlushTex
|
||||||
|
* @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 The texture to set the color to.
|
||||||
|
* @param color The color of the pixel in RGBA format.
|
||||||
|
*/
|
||||||
|
INLINE
|
||||||
|
void GRRLIB_SetPixelTotexImg (const int x, const int y,
|
||||||
|
GRRLIB_texImg *tex, const u32 color) {
|
||||||
|
u8 *truc = (u8*)tex->data;
|
||||||
|
u32 offset;
|
||||||
|
|
||||||
|
offset = (((y >> 2)<<4)*tex->w) + ((x >> 2)<<6) + ((((y&3) << 2) + (x&3) ) << 1); // Fuckin equation found by NoNameNo ;)
|
||||||
|
|
||||||
|
*(truc+offset) = color & 0xFF;
|
||||||
|
*(truc+offset+1) = (color>>24) & 0xFF;
|
||||||
|
*(truc+offset+32) = (color>>16) & 0xFF;
|
||||||
|
*(truc+offset+33) = (color>>8) & 0xFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts RGBA values to u32 color.
|
||||||
|
* @param r Amount of red (0 - 255).
|
||||||
|
* @param g Amount of green (0 - 255).
|
||||||
|
* @param b Amount of blue (0 - 255).
|
||||||
|
* @param a Amount of alpha (0 - 255).
|
||||||
|
* @return Returns the color in u32 format.
|
||||||
|
*/
|
||||||
|
INLINE
|
||||||
|
u32 GRRLIB_GetColor (const u8 r, const u8 g, const u8 b, const u8 a) {
|
||||||
|
return (r << 24) | (g << 16) | (b << 8) | a;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads a pixel directly from the FrontBuffer.
|
||||||
|
* Since the FB is stored in YCbCr,
|
||||||
|
* @param x The x-coordinate within the FB.
|
||||||
|
* @param y The y-coordinate within the FB.
|
||||||
|
* @param R1 A pointer to a variable receiving the first Red value.
|
||||||
|
* @param G1 A pointer to a variable receiving the first Green value.
|
||||||
|
* @param B1 A pointer to a variable receiving the first Blue value.
|
||||||
|
* @param R2 A pointer to a variable receiving the second Red value.
|
||||||
|
* @param G2 A pointer to a variable receiving the second Green value.
|
||||||
|
* @param B2 A pointer to a variable receiving the second Blue value.
|
||||||
|
*/
|
||||||
|
INLINE
|
||||||
|
void GRRLIB_GetPixelFromFB (int x, int y,
|
||||||
|
u8 *R1, u8 *G1, u8 *B1,
|
||||||
|
u8 *R2, u8 *G2, u8 *B2) {
|
||||||
|
u32 Buffer;
|
||||||
|
u8 *Colors;
|
||||||
|
|
||||||
|
// Position Correction
|
||||||
|
if (x > (rmode->fbWidth/2)) { x = (rmode->fbWidth/2); }
|
||||||
|
if (x < 0) { x = 0; }
|
||||||
|
if (y > rmode->efbHeight) { y = rmode->efbHeight; }
|
||||||
|
if (y < 0) { y = 0; }
|
||||||
|
|
||||||
|
// Preparing FB for reading
|
||||||
|
Buffer = ((u32 *)xfb[fb])[y*(rmode->fbWidth/2)+x];
|
||||||
|
Colors = (u8 *) &Buffer;
|
||||||
|
|
||||||
|
/** Color channel:
|
||||||
|
Colors[0] = Y1
|
||||||
|
Colors[1] = Cb
|
||||||
|
Colors[2] = Y2
|
||||||
|
Colors[3] = Cr */
|
||||||
|
|
||||||
|
*R1 = GRRLIB_ClampVar8( 1.164 * (Colors[0] - 16) + 1.596 * (Colors[3] - 128) );
|
||||||
|
*G1 = GRRLIB_ClampVar8( 1.164 * (Colors[0] - 16) - 0.813 * (Colors[3] - 128) - 0.392 * (Colors[1] - 128) );
|
||||||
|
*B1 = GRRLIB_ClampVar8( 1.164 * (Colors[0] - 16) + 2.017 * (Colors[1] - 128) );
|
||||||
|
|
||||||
|
*R2 = GRRLIB_ClampVar8( 1.164 * (Colors[2] - 16) + 1.596 * (Colors[3] - 128) );
|
||||||
|
*G2 = GRRLIB_ClampVar8( 1.164 * (Colors[2] - 16) - 0.813 * (Colors[3] - 128) - 0.392 * (Colors[1] - 128) );
|
||||||
|
*B2 = GRRLIB_ClampVar8( 1.164 * (Colors[2] - 16) + 2.017 * (Colors[1] - 128) );
|
||||||
|
}
|
80
GRRLIB/GRRLIB/grrlib/GRRLIB_settings.h
Normal file
80
GRRLIB/GRRLIB/grrlib/GRRLIB_settings.h
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
Copyright (c) 2009 The GRRLIB Team
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
#include "GRRLIB.h"
|
||||||
|
|
||||||
|
extern GRRLIB_drawSettings GRRLIB_Settings;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a blending mode.
|
||||||
|
* @param blendmode The blending mode to use (Default: GRRLIB_BLEND_ALPHA).
|
||||||
|
*/
|
||||||
|
INLINE
|
||||||
|
void GRRLIB_SetBlend (const int blendmode) {
|
||||||
|
GRRLIB_Settings.blend = blendmode;
|
||||||
|
switch (GRRLIB_Settings.blend) {
|
||||||
|
case GRRLIB_BLEND_ALPHA:
|
||||||
|
GX_SetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_CLEAR);
|
||||||
|
break;
|
||||||
|
case GRRLIB_BLEND_ADD:
|
||||||
|
GX_SetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_DSTALPHA, GX_LO_CLEAR);
|
||||||
|
break;
|
||||||
|
case GRRLIB_BLEND_SCREEN:
|
||||||
|
GX_SetBlendMode(GX_BM_BLEND, GX_BL_SRCCLR, GX_BL_DSTALPHA, GX_LO_CLEAR);
|
||||||
|
break;
|
||||||
|
case GRRLIB_BLEND_MULTI:
|
||||||
|
GX_SetBlendMode(GX_BM_SUBSTRACT, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_CLEAR);
|
||||||
|
break;
|
||||||
|
case GRRLIB_BLEND_INV:
|
||||||
|
GX_SetBlendMode(GX_BM_BLEND, GX_BL_INVSRCCLR, GX_BL_INVSRCCLR, GX_LO_CLEAR);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current blending mode.
|
||||||
|
* @return The current blending mode.
|
||||||
|
*/
|
||||||
|
INLINE
|
||||||
|
int GRRLIB_GetBlend (void) {
|
||||||
|
return GRRLIB_Settings.blend;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Turn AntiAliasing on/off.
|
||||||
|
* @param aa Set to true to enable AntiAliasing (Default: Enabled).
|
||||||
|
*/
|
||||||
|
INLINE
|
||||||
|
void GRRLIB_SetAntiAliasing (const bool aa) {
|
||||||
|
GRRLIB_Settings.antialias = aa;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get current AntiAliasing setting.
|
||||||
|
* @return True if AntiAliasing is enabled.
|
||||||
|
*/
|
||||||
|
INLINE
|
||||||
|
bool GRRLIB_GetAntiAliasing (void) {
|
||||||
|
return GRRLIB_Settings.antialias;
|
||||||
|
}
|
87
GRRLIB/GRRLIB/grrlib/GRRLIB_texSetup.h
Normal file
87
GRRLIB/GRRLIB/grrlib/GRRLIB_texSetup.h
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
Copyright (c) 2009 The GRRLIB Team
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include <malloc.h>
|
||||||
|
#include <pngu.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <jpeglib.h> // this bad header file must be included last :(
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an empty texture.
|
||||||
|
* @param w Width of the new texture to create.
|
||||||
|
* @param h Height of the new texture to create.
|
||||||
|
* @return A GRRLIB_texImg structure newly created.
|
||||||
|
*/
|
||||||
|
INLINE
|
||||||
|
GRRLIB_texImg* GRRLIB_CreateEmptyTexture (const uint w, const uint h)
|
||||||
|
{
|
||||||
|
GRRLIB_texImg *my_texture = (struct GRRLIB_texImg *)calloc(1, sizeof(GRRLIB_texImg));
|
||||||
|
|
||||||
|
if(my_texture != NULL) {
|
||||||
|
my_texture->data = memalign(32, h * w * 4);
|
||||||
|
my_texture->w = w;
|
||||||
|
my_texture->h = h;
|
||||||
|
|
||||||
|
// Initialize the texture
|
||||||
|
memset(my_texture->data, '\0', (h * w) << 2);
|
||||||
|
|
||||||
|
GRRLIB_SetHandle(my_texture, 0, 0);
|
||||||
|
GRRLIB_FlushTex(my_texture);
|
||||||
|
}
|
||||||
|
return my_texture;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write the contents of a texture in the data cache down to main memory.
|
||||||
|
* For performance the CPU holds a data cache where modifications are stored before they get written down to mainmemory.
|
||||||
|
* @param tex The texture to flush.
|
||||||
|
*/
|
||||||
|
INLINE
|
||||||
|
void GRRLIB_FlushTex (GRRLIB_texImg *tex) {
|
||||||
|
DCFlushRange(tex->data, tex->w * tex->h * 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Free memory allocated for texture.
|
||||||
|
* @param tex A GRRLIB_texImg structure.
|
||||||
|
*/
|
||||||
|
INLINE
|
||||||
|
void GRRLIB_FreeTexture (GRRLIB_texImg *tex) {
|
||||||
|
free(tex->data);
|
||||||
|
free(tex);
|
||||||
|
tex = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
//==============================================================================
|
||||||
|
/**
|
||||||
|
* Clear a texture to transparent black
|
||||||
|
* @param tex : Texture to clear
|
||||||
|
*/
|
||||||
|
//==============================================================================
|
||||||
|
INLINE
|
||||||
|
void GRRLIB_ClearTex(GRRLIB_texImg* tex)
|
||||||
|
{
|
||||||
|
bzero(tex->data, (tex->h *tex->w) <<2);
|
||||||
|
GRRLIB_FlushTex(tex);
|
||||||
|
}
|
43
GRRLIB/GRRLIB/makefile
Normal file
43
GRRLIB/GRRLIB/makefile
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
# Quick'n'dirty makefile [BC] v2
|
||||||
|
|
||||||
|
ifeq ($(strip $(DEVKITPPC)),)
|
||||||
|
$(error "Use export DEVKITPPC=<path to>devkitPPC and try again")
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(strip $(DEVKITPRO)),)
|
||||||
|
$(error "Use export DEVKITPRO=<path to>devkitPRO and try again")
|
||||||
|
endif
|
||||||
|
|
||||||
|
PWD := $(shell pwd)
|
||||||
|
|
||||||
|
CC := $(DEVKITPPC)/bin/powerpc-gekko-gcc
|
||||||
|
AR := $(DEVKITPPC)/bin/powerpc-gekko-ar
|
||||||
|
|
||||||
|
OGC := $(DEVKITPRO)/libogc
|
||||||
|
INCD := $(OGC)/include
|
||||||
|
LIBD := $(OGC)/lib/wii
|
||||||
|
|
||||||
|
MACHDEP := -DGEKKO -mrvl -mcpu=750 -meabi -mhard-float
|
||||||
|
CFLAGS := -O2 -Wall $(MACHDEP) -I$(PWD) -I$(INCD)
|
||||||
|
|
||||||
|
LIB := grrlib
|
||||||
|
SRC := $(wildcard *.c)
|
||||||
|
OBJ := $(patsubst %.c,%.o,$(SRC))
|
||||||
|
ARC := lib$(LIB).a
|
||||||
|
HDR := $(LIB).h
|
||||||
|
INL := $(wildcard $(LIB)/*.h)
|
||||||
|
|
||||||
|
all : $(OBJ)
|
||||||
|
$(AR) -r $(ARC) $(OBJ)
|
||||||
|
|
||||||
|
clean :
|
||||||
|
rm -f $(OBJ) $(ARC)
|
||||||
|
|
||||||
|
install :
|
||||||
|
mkdir -p $(LIBD) $(INCD) $(INCD)/grrlib
|
||||||
|
cp -f $(ARC) $(LIBD)/
|
||||||
|
cp -f $(HDR) $(INCD)/
|
||||||
|
cp -f $(INL) $(INCD)/grrlib
|
||||||
|
|
||||||
|
%.o : %.c
|
||||||
|
$(CC) $(CFLAGS) -c $< -o $@
|
43
GRRLIB/lib/install.bat
Normal file
43
GRRLIB/lib/install.bat
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
@echo off
|
||||||
|
|
||||||
|
Rem -- Quick'n'dirty library installation util [BC]
|
||||||
|
|
||||||
|
Rem -- JPEG library
|
||||||
|
echo.
|
||||||
|
echo ---------------------------------------------------------------------------
|
||||||
|
echo Installing JPEG Library...
|
||||||
|
echo.
|
||||||
|
cd jpeg
|
||||||
|
make install
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
Rem -- PNG & PNGU libraries
|
||||||
|
echo.
|
||||||
|
echo ---------------------------------------------------------------------------
|
||||||
|
echo Installing PNG Library...
|
||||||
|
echo.
|
||||||
|
cd png
|
||||||
|
make install
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ---------------------------------------------------------------------------
|
||||||
|
echo Building PNGU Library...
|
||||||
|
echo.
|
||||||
|
cd pngu
|
||||||
|
make clean
|
||||||
|
make all
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ---------------------------------------------------------------------------
|
||||||
|
echo Installing PNGU Library...
|
||||||
|
echo.
|
||||||
|
cd pngu
|
||||||
|
make install
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
Rem -- The End
|
||||||
|
echo.
|
||||||
|
echo Done
|
||||||
|
echo.
|
35
GRRLIB/lib/install.sh
Normal file
35
GRRLIB/lib/install.sh
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
|
# Quick'n'dirty library installation util [BC]
|
||||||
|
|
||||||
|
# JPEG library
|
||||||
|
echo -e "\n--------------------------------------------------------------------"
|
||||||
|
echo -e "Installing JPEG Library...\n"
|
||||||
|
pushd jpeg
|
||||||
|
make install
|
||||||
|
popd
|
||||||
|
|
||||||
|
# PNG & PNGU libraries
|
||||||
|
echo -e "\n--------------------------------------------------------------------"
|
||||||
|
echo -e "Installing PNG Library...\n"
|
||||||
|
cd png
|
||||||
|
make install
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
echo -e "\n--------------------------------------------------------------------"
|
||||||
|
echo -e "Building PNGU Library...\n"
|
||||||
|
cd pngu
|
||||||
|
make clean
|
||||||
|
make all
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
echo -e "\n--------------------------------------------------------------------"
|
||||||
|
echo -e "Installing PNGU Library...\n"
|
||||||
|
cd pngu
|
||||||
|
make install
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
# The End
|
||||||
|
echo -e "\nDone\n"
|
45
GRRLIB/lib/jpeg/include/jconfig.h
Normal file
45
GRRLIB/lib/jpeg/include/jconfig.h
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
/* jconfig.h. Generated automatically by configure. */
|
||||||
|
/* jconfig.cfg --- source file edited by configure script */
|
||||||
|
/* see jconfig.doc for explanations */
|
||||||
|
|
||||||
|
#define HAVE_PROTOTYPES
|
||||||
|
#define HAVE_UNSIGNED_CHAR
|
||||||
|
#define HAVE_UNSIGNED_SHORT
|
||||||
|
#undef void
|
||||||
|
#undef const
|
||||||
|
#undef CHAR_IS_UNSIGNED
|
||||||
|
#define HAVE_STDDEF_H
|
||||||
|
#define HAVE_STDLIB_H
|
||||||
|
#undef NEED_BSD_STRINGS
|
||||||
|
#undef NEED_SYS_TYPES_H
|
||||||
|
#undef NEED_FAR_POINTERS
|
||||||
|
#undef NEED_SHORT_EXTERNAL_NAMES
|
||||||
|
/* Define this if you get warnings about undefined structures. */
|
||||||
|
#undef INCOMPLETE_TYPES_BROKEN
|
||||||
|
|
||||||
|
#ifdef JPEG_INTERNALS
|
||||||
|
|
||||||
|
#undef RIGHT_SHIFT_IS_UNSIGNED
|
||||||
|
#define INLINE __inline__
|
||||||
|
/* These are for configuring the JPEG memory manager. */
|
||||||
|
#undef DEFAULT_MAX_MEM
|
||||||
|
#undef NO_MKTEMP
|
||||||
|
|
||||||
|
#endif /* JPEG_INTERNALS */
|
||||||
|
|
||||||
|
#ifdef JPEG_CJPEG_DJPEG
|
||||||
|
|
||||||
|
#define BMP_SUPPORTED /* BMP image file format */
|
||||||
|
#define GIF_SUPPORTED /* GIF image file format */
|
||||||
|
#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */
|
||||||
|
#undef RLE_SUPPORTED /* Utah RLE image file format */
|
||||||
|
#define TARGA_SUPPORTED /* Targa image file format */
|
||||||
|
|
||||||
|
#undef TWO_FILE_COMMANDLINE
|
||||||
|
#undef NEED_SIGNAL_CATCHER
|
||||||
|
#undef DONT_USE_B_MODE
|
||||||
|
|
||||||
|
/* Define this if you want percent-done progress reports from cjpeg/djpeg. */
|
||||||
|
#undef PROGRESS_REPORT
|
||||||
|
|
||||||
|
#endif /* JPEG_CJPEG_DJPEG */
|
368
GRRLIB/lib/jpeg/include/jmorecfg.h
Normal file
368
GRRLIB/lib/jpeg/include/jmorecfg.h
Normal file
|
@ -0,0 +1,368 @@
|
||||||
|
/*
|
||||||
|
* jmorecfg.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||||
|
* This file is part of the Independent JPEG Group's software.
|
||||||
|
* For conditions of distribution and use, see the accompanying README file.
|
||||||
|
*
|
||||||
|
* This file contains additional configuration options that customize the
|
||||||
|
* JPEG software for special applications or support machine-dependent
|
||||||
|
* optimizations. Most users will not need to touch this file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Define BITS_IN_JSAMPLE as either
|
||||||
|
* 8 for 8-bit sample values (the usual setting)
|
||||||
|
* 12 for 12-bit sample values
|
||||||
|
* Only 8 and 12 are legal data precisions for lossy JPEG according to the
|
||||||
|
* JPEG standard, and the IJG code does not support anything else!
|
||||||
|
* We do not support run-time selection of data precision, sorry.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define BITS_IN_JSAMPLE 8 /* use 8 or 12 */
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Maximum number of components (color channels) allowed in JPEG image.
|
||||||
|
* To meet the letter of the JPEG spec, set this to 255. However, darn
|
||||||
|
* few applications need more than 4 channels (maybe 5 for CMYK + alpha
|
||||||
|
* mask). We recommend 10 as a reasonable compromise; use 4 if you are
|
||||||
|
* really short on memory. (Each allowed component costs a hundred or so
|
||||||
|
* bytes of storage, whether actually used in an image or not.)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define MAX_COMPONENTS 10 /* maximum number of image components */
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Basic data types.
|
||||||
|
* You may need to change these if you have a machine with unusual data
|
||||||
|
* type sizes; for example, "char" not 8 bits, "short" not 16 bits,
|
||||||
|
* or "long" not 32 bits. We don't care whether "int" is 16 or 32 bits,
|
||||||
|
* but it had better be at least 16.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Representation of a single sample (pixel element value).
|
||||||
|
* We frequently allocate large arrays of these, so it's important to keep
|
||||||
|
* them small. But if you have memory to burn and access to char or short
|
||||||
|
* arrays is very slow on your hardware, you might want to change these.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if BITS_IN_JSAMPLE == 8
|
||||||
|
/* JSAMPLE should be the smallest type that will hold the values 0..255.
|
||||||
|
* You can use a signed char by having GETJSAMPLE mask it with 0xFF.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_UNSIGNED_CHAR
|
||||||
|
|
||||||
|
typedef unsigned char JSAMPLE;
|
||||||
|
#define GETJSAMPLE(value) ((int) (value))
|
||||||
|
|
||||||
|
#else /* not HAVE_UNSIGNED_CHAR */
|
||||||
|
|
||||||
|
typedef char JSAMPLE;
|
||||||
|
#ifdef CHAR_IS_UNSIGNED
|
||||||
|
#define GETJSAMPLE(value) ((int) (value))
|
||||||
|
#else
|
||||||
|
#define GETJSAMPLE(value) ((int) (value) & 0xFF)
|
||||||
|
#endif /* CHAR_IS_UNSIGNED */
|
||||||
|
|
||||||
|
#endif /* HAVE_UNSIGNED_CHAR */
|
||||||
|
|
||||||
|
#define MAXJSAMPLE 255
|
||||||
|
#define CENTERJSAMPLE 128
|
||||||
|
|
||||||
|
#endif /* BITS_IN_JSAMPLE == 8 */
|
||||||
|
|
||||||
|
|
||||||
|
#if BITS_IN_JSAMPLE == 12
|
||||||
|
/* JSAMPLE should be the smallest type that will hold the values 0..4095.
|
||||||
|
* On nearly all machines "short" will do nicely.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef short JSAMPLE;
|
||||||
|
#define GETJSAMPLE(value) ((int) (value))
|
||||||
|
|
||||||
|
#define MAXJSAMPLE 4095
|
||||||
|
#define CENTERJSAMPLE 2048
|
||||||
|
|
||||||
|
#endif /* BITS_IN_JSAMPLE == 12 */
|
||||||
|
|
||||||
|
|
||||||
|
/* Representation of a DCT frequency coefficient.
|
||||||
|
* This should be a signed value of at least 16 bits; "short" is usually OK.
|
||||||
|
* Again, we allocate large arrays of these, but you can change to int
|
||||||
|
* if you have memory to burn and "short" is really slow.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef short JCOEF;
|
||||||
|
|
||||||
|
|
||||||
|
/* Compressed datastreams are represented as arrays of JOCTET.
|
||||||
|
* These must be EXACTLY 8 bits wide, at least once they are written to
|
||||||
|
* external storage. Note that when using the stdio data source/destination
|
||||||
|
* managers, this is also the data type passed to fread/fwrite.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_UNSIGNED_CHAR
|
||||||
|
|
||||||
|
typedef unsigned char JOCTET;
|
||||||
|
#define GETJOCTET(value) (value)
|
||||||
|
|
||||||
|
#else /* not HAVE_UNSIGNED_CHAR */
|
||||||
|
|
||||||
|
typedef char JOCTET;
|
||||||
|
#ifdef CHAR_IS_UNSIGNED
|
||||||
|
#define GETJOCTET(value) (value)
|
||||||
|
#else
|
||||||
|
#define GETJOCTET(value) ((value) & 0xFF)
|
||||||
|
#endif /* CHAR_IS_UNSIGNED */
|
||||||
|
|
||||||
|
#endif /* HAVE_UNSIGNED_CHAR */
|
||||||
|
|
||||||
|
|
||||||
|
/* These typedefs are used for various table entries and so forth.
|
||||||
|
* They must be at least as wide as specified; but making them too big
|
||||||
|
* won't cost a huge amount of memory, so we don't provide special
|
||||||
|
* extraction code like we did for JSAMPLE. (In other words, these
|
||||||
|
* typedefs live at a different point on the speed/space tradeoff curve.)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* UINT8 must hold at least the values 0..255. */
|
||||||
|
|
||||||
|
#ifdef HAVE_UNSIGNED_CHAR
|
||||||
|
typedef unsigned char UINT8;
|
||||||
|
#else /* not HAVE_UNSIGNED_CHAR */
|
||||||
|
#ifdef CHAR_IS_UNSIGNED
|
||||||
|
typedef char UINT8;
|
||||||
|
#else /* not CHAR_IS_UNSIGNED */
|
||||||
|
typedef short UINT8;
|
||||||
|
#endif /* CHAR_IS_UNSIGNED */
|
||||||
|
#endif /* HAVE_UNSIGNED_CHAR */
|
||||||
|
|
||||||
|
/* UINT16 must hold at least the values 0..65535. */
|
||||||
|
|
||||||
|
#ifdef HAVE_UNSIGNED_SHORT
|
||||||
|
typedef unsigned short UINT16;
|
||||||
|
#else /* not HAVE_UNSIGNED_SHORT */
|
||||||
|
typedef unsigned int UINT16;
|
||||||
|
#endif /* HAVE_UNSIGNED_SHORT */
|
||||||
|
|
||||||
|
/* INT16 must hold at least the values -32768..32767. */
|
||||||
|
|
||||||
|
#ifndef XMD_H /* X11/xmd.h correctly defines INT16 */
|
||||||
|
typedef short INT16;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* INT32 must hold at least signed 32-bit values. */
|
||||||
|
|
||||||
|
#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */
|
||||||
|
typedef long INT32;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Datatype used for image dimensions. The JPEG standard only supports
|
||||||
|
* images up to 64K*64K due to 16-bit fields in SOF markers. Therefore
|
||||||
|
* "unsigned int" is sufficient on all machines. However, if you need to
|
||||||
|
* handle larger images and you don't mind deviating from the spec, you
|
||||||
|
* can change this datatype.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef unsigned int JDIMENSION;
|
||||||
|
|
||||||
|
#define JPEG_MAX_DIMENSION 65500L /* a tad under 64K to prevent overflows */
|
||||||
|
|
||||||
|
|
||||||
|
/* These macros are used in all function definitions and extern declarations.
|
||||||
|
* You could modify them if you need to change function linkage conventions;
|
||||||
|
* in particular, you'll need to do that to make the library a Windows DLL.
|
||||||
|
* Another application is to make all functions global for use with debuggers
|
||||||
|
* or code profilers that require it.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* a function called through method pointers: */
|
||||||
|
#define METHODDEF(type) static type
|
||||||
|
/* a function used only in its module: */
|
||||||
|
#define LOCAL(type) static type
|
||||||
|
/* a function referenced thru EXTERNs: */
|
||||||
|
#define GLOBAL(type) type
|
||||||
|
/* a reference to a GLOBAL function: */
|
||||||
|
#define EXTERN(type) extern type
|
||||||
|
|
||||||
|
|
||||||
|
/* This macro is used to declare a "method", that is, a function pointer.
|
||||||
|
* We want to supply prototype parameters if the compiler can cope.
|
||||||
|
* Note that the arglist parameter must be parenthesized!
|
||||||
|
* Again, you can customize this if you need special linkage keywords.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_PROTOTYPES
|
||||||
|
#define JMETHOD(type,methodname,arglist) type (*methodname) arglist
|
||||||
|
#else
|
||||||
|
#define JMETHOD(type,methodname,arglist) type (*methodname) ()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Here is the pseudo-keyword for declaring pointers that must be "far"
|
||||||
|
* on 80x86 machines. Most of the specialized coding for 80x86 is handled
|
||||||
|
* by just saying "FAR *" where such a pointer is needed. In a few places
|
||||||
|
* explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef NEED_FAR_POINTERS
|
||||||
|
#define FAR far
|
||||||
|
#else
|
||||||
|
#define FAR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* On a few systems, type boolean and/or its values FALSE, TRUE may appear
|
||||||
|
* in standard header files. Or you may have conflicts with application-
|
||||||
|
* specific header files that you want to include together with these files.
|
||||||
|
* Defining HAVE_BOOLEAN before including jpeglib.h should make it work.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HAVE_BOOLEAN
|
||||||
|
# ifndef boolean /* this works around the bug in gctypes.h */
|
||||||
|
typedef int boolean;
|
||||||
|
# endif
|
||||||
|
#define HAVE_BOOLEAN
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef FALSE /* in case these macros already exist */
|
||||||
|
#define FALSE 0 /* values of boolean */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef TRUE
|
||||||
|
#define TRUE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The remaining options affect code selection within the JPEG library,
|
||||||
|
* but they don't need to be visible to most applications using the library.
|
||||||
|
* To minimize application namespace pollution, the symbols won't be
|
||||||
|
* defined unless JPEG_INTERNALS or JPEG_INTERNAL_OPTIONS has been defined.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef JPEG_INTERNALS
|
||||||
|
#define JPEG_INTERNAL_OPTIONS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef JPEG_INTERNAL_OPTIONS
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These defines indicate whether to include various optional functions.
|
||||||
|
* Undefining some of these symbols will produce a smaller but less capable
|
||||||
|
* library. Note that you can leave certain source files out of the
|
||||||
|
* compilation/linking process if you've #undef'd the corresponding symbols.
|
||||||
|
* (You may HAVE to do that if your compiler doesn't like null source files.)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Arithmetic coding is unsupported for legal reasons. Complaints to IBM. */
|
||||||
|
|
||||||
|
/* Capability options common to encoder and decoder: */
|
||||||
|
|
||||||
|
#define DCT_ISLOW_SUPPORTED /* slow but accurate integer algorithm */
|
||||||
|
#define DCT_IFAST_SUPPORTED /* faster, less accurate integer method */
|
||||||
|
#define DCT_FLOAT_SUPPORTED /* floating-point: accurate, fast on fast HW */
|
||||||
|
|
||||||
|
/* Encoder capability options: */
|
||||||
|
|
||||||
|
#undef C_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
|
||||||
|
#define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
|
||||||
|
#define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/
|
||||||
|
#define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? */
|
||||||
|
/* Note: if you selected 12-bit data precision, it is dangerous to turn off
|
||||||
|
* ENTROPY_OPT_SUPPORTED. The standard Huffman tables are only good for 8-bit
|
||||||
|
* precision, so jchuff.c normally uses entropy optimization to compute
|
||||||
|
* usable tables for higher precision. If you don't want to do optimization,
|
||||||
|
* you'll have to supply different default Huffman tables.
|
||||||
|
* The exact same statements apply for progressive JPEG: the default tables
|
||||||
|
* don't work for progressive mode. (This may get fixed, however.)
|
||||||
|
*/
|
||||||
|
#define INPUT_SMOOTHING_SUPPORTED /* Input image smoothing option? */
|
||||||
|
|
||||||
|
/* Decoder capability options: */
|
||||||
|
|
||||||
|
#undef D_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
|
||||||
|
#define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
|
||||||
|
#define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/
|
||||||
|
#define SAVE_MARKERS_SUPPORTED /* jpeg_save_markers() needed? */
|
||||||
|
#define BLOCK_SMOOTHING_SUPPORTED /* Block smoothing? (Progressive only) */
|
||||||
|
#define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? */
|
||||||
|
#undef UPSAMPLE_SCALING_SUPPORTED /* Output rescaling at upsample stage? */
|
||||||
|
#define UPSAMPLE_MERGING_SUPPORTED /* Fast path for sloppy upsampling? */
|
||||||
|
#define QUANT_1PASS_SUPPORTED /* 1-pass color quantization? */
|
||||||
|
#define QUANT_2PASS_SUPPORTED /* 2-pass color quantization? */
|
||||||
|
|
||||||
|
/* more capability options later, no doubt */
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Ordering of RGB data in scanlines passed to or from the application.
|
||||||
|
* If your application wants to deal with data in the order B,G,R, just
|
||||||
|
* change these macros. You can also deal with formats such as R,G,B,X
|
||||||
|
* (one extra byte per pixel) by changing RGB_PIXELSIZE. Note that changing
|
||||||
|
* the offsets will also change the order in which colormap data is organized.
|
||||||
|
* RESTRICTIONS:
|
||||||
|
* 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats.
|
||||||
|
* 2. These macros only affect RGB<=>YCbCr color conversion, so they are not
|
||||||
|
* useful if you are using JPEG color spaces other than YCbCr or grayscale.
|
||||||
|
* 3. The color quantizer modules will not behave desirably if RGB_PIXELSIZE
|
||||||
|
* is not 3 (they don't understand about dummy color components!). So you
|
||||||
|
* can't use color quantization if you change that value.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define RGB_RED 0 /* Offset of Red in an RGB scanline element */
|
||||||
|
#define RGB_GREEN 1 /* Offset of Green */
|
||||||
|
#define RGB_BLUE 2 /* Offset of Blue */
|
||||||
|
#define RGB_PIXELSIZE 3 /* JSAMPLEs per RGB scanline element */
|
||||||
|
|
||||||
|
|
||||||
|
/* Definitions for speed-related optimizations. */
|
||||||
|
|
||||||
|
|
||||||
|
/* If your compiler supports inline functions, define INLINE
|
||||||
|
* as the inline keyword; otherwise define it as empty.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef INLINE
|
||||||
|
#ifdef __GNUC__ /* for instance, GNU C knows about inline */
|
||||||
|
#define INLINE __inline__
|
||||||
|
#endif
|
||||||
|
#ifndef INLINE
|
||||||
|
#define INLINE /* default is to define it as empty */
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* On some machines (notably 68000 series) "int" is 32 bits, but multiplying
|
||||||
|
* two 16-bit shorts is faster than multiplying two ints. Define MULTIPLIER
|
||||||
|
* as short on such a machine. MULTIPLIER must be at least 16 bits wide.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MULTIPLIER
|
||||||
|
#define MULTIPLIER int /* type for fastest integer multiply */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* FAST_FLOAT should be either float or double, whichever is done faster
|
||||||
|
* by your compiler. (Note that this type is only used in the floating point
|
||||||
|
* DCT routines, so it only matters if you've defined DCT_FLOAT_SUPPORTED.)
|
||||||
|
* Typically, float is faster in ANSI C compilers, while double is faster in
|
||||||
|
* pre-ANSI compilers (because they insist on converting to double anyway).
|
||||||
|
* The code below therefore chooses float if we have ANSI-style prototypes.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FAST_FLOAT
|
||||||
|
#ifdef HAVE_PROTOTYPES
|
||||||
|
#define FAST_FLOAT float
|
||||||
|
#else
|
||||||
|
#define FAST_FLOAT double
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* JPEG_INTERNAL_OPTIONS */
|
1100
GRRLIB/lib/jpeg/include/jpeglib.h
Normal file
1100
GRRLIB/lib/jpeg/include/jpeglib.h
Normal file
File diff suppressed because it is too large
Load diff
29
GRRLIB/lib/jpeg/include/jpgogc.h
Normal file
29
GRRLIB/lib/jpeg/include/jpgogc.h
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
/****************************************************************************
|
||||||
|
* libjpeg - 6b wrapper
|
||||||
|
*
|
||||||
|
* The version of libjpeg used in libOGC has been modified to include a memory
|
||||||
|
* source data manager (jmemsrc.c).
|
||||||
|
*
|
||||||
|
* softdev November 2006
|
||||||
|
****************************************************************************/
|
||||||
|
#ifndef __JPGLIB__
|
||||||
|
#define __JPGLIB__
|
||||||
|
|
||||||
|
#include <jpeglib.h>
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
char *inbuffer;
|
||||||
|
char *outbuffer;
|
||||||
|
int inbufferlength;
|
||||||
|
int outbufferlength;
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
|
int num_colours;
|
||||||
|
int dct_method;
|
||||||
|
int dither_mode;
|
||||||
|
int greyscale;
|
||||||
|
} JPEGIMG;
|
||||||
|
|
||||||
|
int JPEG_Decompress(JPEGIMG * jpgimg);
|
||||||
|
|
||||||
|
#endif
|
27
GRRLIB/lib/jpeg/makefile
Normal file
27
GRRLIB/lib/jpeg/makefile
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
# Quick'n'dirty makefile [BC]
|
||||||
|
|
||||||
|
ifeq ($(strip $(DEVKITPPC)),)
|
||||||
|
$(error "Use export DEVKITPPC=<path to>devkitPPC and try again")
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(strip $(DEVKITPRO)),)
|
||||||
|
$(error "Use export DEVKITPRO=<path to>devkitPRO and try again")
|
||||||
|
endif
|
||||||
|
|
||||||
|
OGC := $(DEVKITPRO)/libogc
|
||||||
|
|
||||||
|
HDR := $(shell ls include/*.h)
|
||||||
|
ARC := $(shell ls lib/wii/*.a)
|
||||||
|
|
||||||
|
.PHONY : all install
|
||||||
|
|
||||||
|
all :
|
||||||
|
@echo -e "\nWe must track down the svn repo for the source"
|
||||||
|
@echo " and add it as an SVN Vendor Branch"
|
||||||
|
@echo " http://svnbook.red-bean.com/en/1.1/ch07s05.html"
|
||||||
|
@echo "...For now, all you get is precompiled libraries"
|
||||||
|
|
||||||
|
install :
|
||||||
|
mkdir -p $(OGC)/lib/wii/ $(OGC)/include/
|
||||||
|
cp -rf $(ARC) $(OGC)/lib/wii/
|
||||||
|
cp -rf $(HDR) $(OGC)/include/
|
3569
GRRLIB/lib/png/include/png.h
Normal file
3569
GRRLIB/lib/png/include/png.h
Normal file
File diff suppressed because it is too large
Load diff
1481
GRRLIB/lib/png/include/pngconf.h
Normal file
1481
GRRLIB/lib/png/include/pngconf.h
Normal file
File diff suppressed because it is too large
Load diff
27
GRRLIB/lib/png/makefile
Normal file
27
GRRLIB/lib/png/makefile
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
# Quick'n'dirty makefile [BC]
|
||||||
|
|
||||||
|
ifeq ($(strip $(DEVKITPPC)),)
|
||||||
|
$(error "Use export DEVKITPPC=<path to>devkitPPC and try again")
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(strip $(DEVKITPRO)),)
|
||||||
|
$(error "Use export DEVKITPRO=<path to>devkitPRO and try again")
|
||||||
|
endif
|
||||||
|
|
||||||
|
OGC := $(DEVKITPRO)/libogc
|
||||||
|
|
||||||
|
HDR := $(shell ls include/*.h)
|
||||||
|
ARC := $(shell ls lib/wii/*.a)
|
||||||
|
|
||||||
|
.PHONY : all install
|
||||||
|
|
||||||
|
all :
|
||||||
|
@echo -e "\nWe must track down the svn repo for the source"
|
||||||
|
@echo " and add it as an SVN Vendor Branch"
|
||||||
|
@echo " http://svnbook.red-bean.com/en/1.1/ch07s05.html"
|
||||||
|
@echo "...For now, all you get is precompiled libraries"
|
||||||
|
|
||||||
|
install :
|
||||||
|
mkdir -p $(OGC)/lib/wii/ $(OGC)/include/
|
||||||
|
cp -rf $(ARC) $(OGC)/lib/wii/
|
||||||
|
cp -rf $(HDR) $(OGC)/include/
|
39
GRRLIB/lib/pngu/makefile
Normal file
39
GRRLIB/lib/pngu/makefile
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
# Quick'n'dirty makefile [BC] v2
|
||||||
|
|
||||||
|
ifeq ($(strip $(DEVKITPPC)),)
|
||||||
|
$(error "Use export DEVKITPPC=<path to>devkitPPC and try again")
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(strip $(DEVKITPRO)),)
|
||||||
|
$(error "Use export DEVKITPRO=<path to>devkitPRO and try again")
|
||||||
|
endif
|
||||||
|
|
||||||
|
CC := $(DEVKITPPC)/bin/powerpc-gekko-gcc
|
||||||
|
AR := $(DEVKITPPC)/bin/powerpc-gekko-ar
|
||||||
|
|
||||||
|
OGC := $(DEVKITPRO)/libogc
|
||||||
|
INCD := $(OGC)/include
|
||||||
|
LIBD := $(OGC)/lib/wii
|
||||||
|
|
||||||
|
MACHDEP := -DGEKKO -mrvl -mcpu=750 -meabi -mhard-float
|
||||||
|
CFLAGS := -O2 -Wall $(MACHDEP) -I $(INCD)
|
||||||
|
|
||||||
|
LIB := pngu
|
||||||
|
SRC := $(shell ls *.c)
|
||||||
|
OBJ := $(patsubst %.c,%.o,$(SRC))
|
||||||
|
ARC := lib$(LIB).a
|
||||||
|
HDR := $(LIB).h
|
||||||
|
|
||||||
|
all : $(OBJ)
|
||||||
|
$(AR) -r $(ARC) $(OBJ)
|
||||||
|
|
||||||
|
clean :
|
||||||
|
rm -f $(OBJ) $(ARC)
|
||||||
|
|
||||||
|
install :
|
||||||
|
mkdir -p $(LIBD) $(INCD)
|
||||||
|
cp -f $(ARC) $(LIBD)/
|
||||||
|
cp -f $(HDR) $(INCD)/
|
||||||
|
|
||||||
|
%.o : %.c
|
||||||
|
$(CC) $(CFLAGS) -c $< -o $@
|
1132
GRRLIB/lib/pngu/pngu.c
Normal file
1132
GRRLIB/lib/pngu/pngu.c
Normal file
File diff suppressed because it is too large
Load diff
171
GRRLIB/lib/pngu/pngu.h
Normal file
171
GRRLIB/lib/pngu/pngu.h
Normal file
|
@ -0,0 +1,171 @@
|
||||||
|
/********************************************************************************************
|
||||||
|
|
||||||
|
PNGU Version : 0.2a
|
||||||
|
|
||||||
|
Coder : frontier
|
||||||
|
|
||||||
|
More info : http://frontier-dev.net
|
||||||
|
|
||||||
|
********************************************************************************************/
|
||||||
|
#ifndef __PNGU__
|
||||||
|
#define __PNGU__
|
||||||
|
|
||||||
|
// Return codes
|
||||||
|
#define PNGU_OK 0
|
||||||
|
#define PNGU_ODD_WIDTH 1
|
||||||
|
#define PNGU_ODD_STRIDE 2
|
||||||
|
#define PNGU_INVALID_WIDTH_OR_HEIGHT 3
|
||||||
|
#define PNGU_FILE_IS_NOT_PNG 4
|
||||||
|
#define PNGU_UNSUPPORTED_COLOR_TYPE 5
|
||||||
|
#define PNGU_NO_FILE_SELECTED 6
|
||||||
|
#define PNGU_CANT_OPEN_FILE 7
|
||||||
|
#define PNGU_CANT_READ_FILE 8
|
||||||
|
#define PNGU_LIB_ERROR 9
|
||||||
|
|
||||||
|
// Color types
|
||||||
|
#define PNGU_COLOR_TYPE_GRAY 1
|
||||||
|
#define PNGU_COLOR_TYPE_GRAY_ALPHA 2
|
||||||
|
#define PNGU_COLOR_TYPE_PALETTE 3
|
||||||
|
#define PNGU_COLOR_TYPE_RGB 4
|
||||||
|
#define PNGU_COLOR_TYPE_RGB_ALPHA 5
|
||||||
|
#define PNGU_COLOR_TYPE_UNKNOWN 6
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Types
|
||||||
|
typedef unsigned char PNGU_u8;
|
||||||
|
typedef unsigned short PNGU_u16;
|
||||||
|
typedef unsigned int PNGU_u32;
|
||||||
|
typedef unsigned long long PNGU_u64;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
PNGU_u8 r;
|
||||||
|
PNGU_u8 g;
|
||||||
|
PNGU_u8 b;
|
||||||
|
} PNGUCOLOR;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
PNGU_u32 imgWidth; // In pixels
|
||||||
|
PNGU_u32 imgHeight; // In pixels
|
||||||
|
PNGU_u32 imgBitDepth; // In bitx
|
||||||
|
PNGU_u32 imgColorType; // PNGU_COLOR_TYPE_*
|
||||||
|
PNGU_u32 validBckgrnd; // Non zero if there is a background color
|
||||||
|
PNGUCOLOR bckgrnd; // Backgroun color
|
||||||
|
PNGU_u32 numTrans; // Number of transparent colors
|
||||||
|
PNGUCOLOR *trans; // Transparent colors
|
||||||
|
} PNGUPROP;
|
||||||
|
|
||||||
|
// Image context, always initialize with SelectImageFrom* and free with ReleaseImageContext
|
||||||
|
struct _IMGCTX;
|
||||||
|
typedef struct _IMGCTX *IMGCTX;
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pixel conversion *
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
// Macro to convert RGB8 values to RGB565
|
||||||
|
#define PNGU_RGB8_TO_RGB565(r,g,b) ( ((((PNGU_u16) r) & 0xF8U) << 8) | ((((PNGU_u16) g) & 0xFCU) << 3) | (((PNGU_u16) b) >> 3) )
|
||||||
|
|
||||||
|
// Macro to convert RGBA8 values to RGB5A3
|
||||||
|
#define PNGU_RGB8_TO_RGB5A3(r,g,b,a) (PNGU_u16) (((a & 0xE0U) == 0xE0U) ? \
|
||||||
|
(0x8000U | ((((PNGU_u16) r) & 0xF8U) << 7) | ((((PNGU_u16) g) & 0xF8U) << 2) | (((PNGU_u16) b) >> 3)) : \
|
||||||
|
(((((PNGU_u16) a) & 0xE0U) << 7) | ((((PNGU_u16) r) & 0xF0U) << 4) | (((PNGU_u16) g) & 0xF0U) | ((((PNGU_u16) b) & 0xF0U) >> 4)))
|
||||||
|
|
||||||
|
// Function to convert two RGB8 values to YCbYCr
|
||||||
|
PNGU_u32 PNGU_RGB8_TO_YCbYCr (PNGU_u8 r1, PNGU_u8 g1, PNGU_u8 b1, PNGU_u8 r2, PNGU_u8 g2, PNGU_u8 b2);
|
||||||
|
|
||||||
|
// Function to convert an YCbYCr to two RGB8 values.
|
||||||
|
void PNGU_YCbYCr_TO_RGB8 (PNGU_u32 ycbycr, PNGU_u8 *r1, PNGU_u8 *g1, PNGU_u8 *b1, PNGU_u8 *r2, PNGU_u8 *g2, PNGU_u8 *b2);
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Image context handling *
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
// Selects a PNG file, previosly loaded into a buffer, and creates an image context for subsequent procesing.
|
||||||
|
IMGCTX PNGU_SelectImageFromBuffer (const void *buffer);
|
||||||
|
|
||||||
|
// Selects a PNG file, from any devoptab device, and creates an image context for subsequent procesing.
|
||||||
|
IMGCTX PNGU_SelectImageFromDevice (const char *filename);
|
||||||
|
|
||||||
|
// Frees resources associated with an image context. Always call this function when you no longer need the IMGCTX.
|
||||||
|
void PNGU_ReleaseImageContext (IMGCTX ctx);
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Miscelaneous *
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
// Retrieves info from selected PNG file, including image dimensions, color format, background and transparency colors.
|
||||||
|
int PNGU_GetImageProperties (IMGCTX ctx, PNGUPROP *fileproperties);
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Image conversion *
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
// Expands selected image into an YCbYCr buffer. You need to specify context, image dimensions,
|
||||||
|
// destination address and stride in pixels (stride = buffer width - image width).
|
||||||
|
int PNGU_DecodeToYCbYCr (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u32 stride);
|
||||||
|
|
||||||
|
// Macro for decoding an image inside a buffer at given coordinates.
|
||||||
|
#define PNGU_DECODE_TO_COORDS_YCbYCr(ctx,coordX,coordY,imgWidth,imgHeight,bufferWidth,bufferHeight,buffer) \
|
||||||
|
\
|
||||||
|
PNGU_DecodeToYCbYCr (ctx, imgWidth, imgHeight, ((void *) buffer) + (coordY) * (bufferWidth) * 2 + \
|
||||||
|
(coordX) * 2, (bufferWidth) - (imgWidth))
|
||||||
|
|
||||||
|
// Expands selected image into a linear RGB565 buffer. You need to specify context, image dimensions,
|
||||||
|
// destination address and stride in pixels (stride = buffer width - image width).
|
||||||
|
int PNGU_DecodeToRGB565 (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u32 stride);
|
||||||
|
|
||||||
|
// Macro for decoding an image inside a buffer at given coordinates.
|
||||||
|
#define PNGU_DECODE_TO_COORDS_RGB565(ctx,coordX,coordY,imgWidth,imgHeight,bufferWidth,bufferHeight,buffer) \
|
||||||
|
\
|
||||||
|
PNGU_DecodeToRGB565 (ctx, imgWidth, imgHeight, ((void *) buffer) + (coordY) * (bufferWidth) * 2 + \
|
||||||
|
(coordX) * 2, (bufferWidth) - (imgWidth))
|
||||||
|
|
||||||
|
// Expands selected image into a linear RGBA8 buffer. You need to specify context, image dimensions,
|
||||||
|
// destination address, stride in pixels and default alpha value, which is used if the source image
|
||||||
|
// doesn't have an alpha channel.
|
||||||
|
int PNGU_DecodeToRGBA8 (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u32 stride, PNGU_u8 default_alpha);
|
||||||
|
|
||||||
|
// Macro for decoding an image inside a buffer at given coordinates.
|
||||||
|
#define PNGU_DECODE_TO_COORDS_RGBA8(ctx,coordX,coordY,imgWidth,imgHeight,default_alpha,bufferWidth,bufferHeight,buffer) \
|
||||||
|
\
|
||||||
|
PNGU_DecodeToRGBA8 (ctx, imgWidth, imgHeight, ((void *) buffer) + (coordY) * (bufferWidth) * 2 + \
|
||||||
|
(coordX) * 2, (bufferWidth) - (imgWidth), default_alpha)
|
||||||
|
|
||||||
|
// Expands selected image into a 4x4 tiled RGB565 buffer. You need to specify context, image dimensions
|
||||||
|
// and destination address.
|
||||||
|
int PNGU_DecodeTo4x4RGB565 (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer);
|
||||||
|
|
||||||
|
// Expands selected image into a 4x4 tiled RGB5A3 buffer. You need to specify context, image dimensions,
|
||||||
|
// destination address and default alpha value, which is used if the source image doesn't have an alpha channel.
|
||||||
|
int PNGU_DecodeTo4x4RGB5A3 (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u8 default_alpha);
|
||||||
|
|
||||||
|
// Expands selected image into a 4x4 tiled RGBA8 buffer. You need to specify context, image dimensions,
|
||||||
|
// destination address and default alpha value, which is used if the source image doesn't have an alpha channel.
|
||||||
|
int PNGU_DecodeTo4x4RGBA8 (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u8 default_alpha);
|
||||||
|
|
||||||
|
// Encodes an YCbYCr image in PNG format and stores it in the selected device or memory buffer. You need to
|
||||||
|
// specify context, image dimensions, destination address and stride in pixels (stride = buffer width - image width).
|
||||||
|
int PNGU_EncodeFromYCbYCr (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u32 stride);
|
||||||
|
|
||||||
|
// Macro for encoding an image stored into an YCbYCr buffer at given coordinates.
|
||||||
|
#define PNGU_ENCODE_TO_COORDS_YCbYCr(ctx,coordX,coordY,imgWidth,imgHeight,bufferWidth,bufferHeight,buffer) \
|
||||||
|
\
|
||||||
|
PNGU_EncodeFromYCbYCr (ctx, imgWidth, imgHeight, ((void *) buffer) + (coordY) * (bufferWidth) * 2 + \
|
||||||
|
(coordX) * 2, (bufferWidth) - (imgWidth))
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
BIN
examples/bluechip/composition/blue70.png
Normal file
BIN
examples/bluechip/composition/blue70.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
153
examples/bluechip/composition/composition.c
Normal file
153
examples/bluechip/composition/composition.c
Normal file
|
@ -0,0 +1,153 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
Copyright (c) 2009 The GRRLIB Team
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Test Harness for alpha composition functions
|
||||||
|
/*
|
||||||
|
PaintShopPro_X2 readings:
|
||||||
|
| | Blue-over-Red | Red-over-Blue |
|
||||||
|
|--------+---------------+---------------|
|
||||||
|
| Normal | 0x2D'00'D2'D8 | 0x96'00'69'D8 |
|
||||||
|
| | | |
|
||||||
|
*/
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include <stdlib.h> // exit
|
||||||
|
#include <wiiuse/wpad.h>
|
||||||
|
#include <grrlib.h>
|
||||||
|
|
||||||
|
#include "red50.h"
|
||||||
|
#include "blue70.h"
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
void wscan(ir_t* ir) ;
|
||||||
|
|
||||||
|
// Wiimote overscan (to allow the cursor to move off the dge of the screen)
|
||||||
|
#define WOVERX (200)
|
||||||
|
#define WOVERY (300)
|
||||||
|
|
||||||
|
#define WMU_MAX (2) // How many wiimotes to read
|
||||||
|
|
||||||
|
ir_t ir[WMU_MAX];
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
void test_compose(void)
|
||||||
|
{
|
||||||
|
int redOnTop = 0; // Red square starts behind the blue one
|
||||||
|
|
||||||
|
// Our two translucent test images
|
||||||
|
GRRLIB_texImg* red = GRRLIB_LoadTexture(red50);
|
||||||
|
GRRLIB_texImg* blu = GRRLIB_LoadTexture(blue70);
|
||||||
|
|
||||||
|
// The canvas we will be composing on
|
||||||
|
GRRLIB_texImg* cnv = GRRLIB_CreateEmptyTexture(400,400);
|
||||||
|
|
||||||
|
// Loop until home key pressed
|
||||||
|
do {
|
||||||
|
// Scan the wiimotes
|
||||||
|
wscan(ir);
|
||||||
|
|
||||||
|
// 'A' toggles z-coord of red sqaure (on-top / behind)
|
||||||
|
if (WPAD_ButtonsDown(0) & WPAD_BUTTON_A) redOnTop ^= 1 ;
|
||||||
|
|
||||||
|
// Clear canvas
|
||||||
|
GRRLIB_ClearTex(cnv);
|
||||||
|
|
||||||
|
// Compose canvas
|
||||||
|
if (!redOnTop)
|
||||||
|
GRRLIB_Compose(ir[0].x-180,ir[0].y-180, red, cnv, GRRLIB_COMPOSE_NORMAL);
|
||||||
|
GRRLIB_Compose(125,125, blu, cnv, GRRLIB_COMPOSE_NORMAL) ;
|
||||||
|
if ( redOnTop)
|
||||||
|
GRRLIB_Compose(ir[0].x-180,ir[0].y-180, red, cnv, GRRLIB_COMPOSE_NORMAL);
|
||||||
|
|
||||||
|
// Paint the screen black
|
||||||
|
GRRLIB_FillScreen(0x000000FF);
|
||||||
|
|
||||||
|
// Draw frame
|
||||||
|
GRRLIB_Rectangle(38,38,404,404,0x808080FF,false);
|
||||||
|
GRRLIB_Rectangle(39,39,402,402,0x808080FF,false);
|
||||||
|
|
||||||
|
// Draw Test bar
|
||||||
|
GRRLIB_Rectangle(283,50,20,380,0xFFFFFFFF, true);
|
||||||
|
|
||||||
|
// Draw Composed Canvas
|
||||||
|
GRRLIB_DrawImg(40,40, cnv,0.0, 1.0,1.0, 0xFFFFFFFF);
|
||||||
|
|
||||||
|
// Test card (alpha performed by Wii)
|
||||||
|
GRRLIB_Rectangle(570,50,20,450,0xFFFFFFFF, true);
|
||||||
|
GRRLIB_DrawImg(450, 65, red,0.0, 1.0,1.0, 0xFFFFFFFF);
|
||||||
|
GRRLIB_DrawImg(450,165, blu,0.0, 1.0,1.0, 0xFFFFFFFF);
|
||||||
|
GRRLIB_DrawImg(450,265, red,0.0, 1.0,1.0, 0xFFFFFFFF);
|
||||||
|
|
||||||
|
// Draw it [and workaround bug in GRRLIB]
|
||||||
|
GRRLIB_Render();
|
||||||
|
if (rmode->viTVMode &VI_NON_INTERLACE) VIDEO_WaitVSync() ;
|
||||||
|
|
||||||
|
} while(!(WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME)); // Exit on home key
|
||||||
|
|
||||||
|
// Free up the resources we are using to hold the canvas and layers
|
||||||
|
GRRLIB_FreeTexture(blu);
|
||||||
|
GRRLIB_FreeTexture(red);
|
||||||
|
GRRLIB_FreeTexture(cnv);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
void wscan(ir_t* ir)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
WPAD_ScanPads();
|
||||||
|
|
||||||
|
for (i = 0; i < WMU_MAX; i++) {
|
||||||
|
WPAD_IR(i, &ir[i]);
|
||||||
|
ir->x -= WOVERX/2;
|
||||||
|
ir->y -= WOVERY/2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
int main(int argc, char** argv)
|
||||||
|
{
|
||||||
|
(void)argc;
|
||||||
|
(void)argv;
|
||||||
|
|
||||||
|
int i;
|
||||||
|
|
||||||
|
// Init graphics subsystem
|
||||||
|
GRRLIB_Init();
|
||||||
|
|
||||||
|
// Init the Wiimotes
|
||||||
|
WPAD_Init();
|
||||||
|
for (i = 0; i < WMU_MAX; i++) {
|
||||||
|
WPAD_SetVRes(i, rmode->fbWidth+WOVERX, rmode->xfbHeight+WOVERY);
|
||||||
|
WPAD_SetDataFormat(i, WPAD_FMT_BTNS_ACC_IR);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Call the demo
|
||||||
|
test_compose();
|
||||||
|
|
||||||
|
// Clear up memory
|
||||||
|
GRRLIB_Exit();
|
||||||
|
|
||||||
|
exit(0);
|
||||||
|
}
|
76
examples/bluechip/composition/makefile
Normal file
76
examples/bluechip/composition/makefile
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
# Quick'n'dirty makefile [BC] v2
|
||||||
|
|
||||||
|
ifeq ($(strip $(DEVKITPPC)),)
|
||||||
|
$(error "Use export DEVKITPPC=<path to>devkitPPC and try again")
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(strip $(DEVKITPRO)),)
|
||||||
|
$(error "Use export DEVKITPRO=<path to>devkitPRO and try again")
|
||||||
|
endif
|
||||||
|
|
||||||
|
APP := compose
|
||||||
|
ELF := $(APP).elf
|
||||||
|
DOL := $(APP).dol
|
||||||
|
MAP := $(notdir $(ELF)).map
|
||||||
|
|
||||||
|
LIBS := -lgrrlib -lpngu -lpng -ljpeg -lz
|
||||||
|
LIBS += -lwiiuse
|
||||||
|
#LIBS += -lmodplay -lasnd
|
||||||
|
LIBS += -lbte -logc
|
||||||
|
LIBS += -lm
|
||||||
|
|
||||||
|
BINDIR := $(DEVKITPPC)/bin
|
||||||
|
PREFIX := $(BINDIR)/powerpc-gekko-
|
||||||
|
CC := $(PREFIX)gcc
|
||||||
|
CXX := $(PREFIX)g++
|
||||||
|
AR := $(PREFIX)ar
|
||||||
|
AS := $(PREFIX)as
|
||||||
|
LD := $(CC)
|
||||||
|
OBJCOPY := $(PREFIX)objcopy
|
||||||
|
ELF2DOL := $(BINDIR)/elf2dol
|
||||||
|
UPLOAD := $(BINDIR)/wiiload
|
||||||
|
|
||||||
|
OGC := $(DEVKITPRO)/libogc
|
||||||
|
INCD := $(OGC)/include
|
||||||
|
LIBD := $(OGC)/lib/wii
|
||||||
|
|
||||||
|
MACHDEP := -DGEKKO -mrvl -mcpu=750 -meabi -mhard-float
|
||||||
|
CFLAGS := -O2 -Wall $(MACHDEP) -I $(INCD)
|
||||||
|
|
||||||
|
LDFLAGS = $(MACHDEP) -Wl,-Map,$(MAP)
|
||||||
|
LIBPATHS := -L$(DEVKITPRO)/libogc/lib/wii
|
||||||
|
|
||||||
|
SRC := $(shell ls *.c)
|
||||||
|
SRCOBJ := $(patsubst %.c,%.o,$(SRC))
|
||||||
|
|
||||||
|
RES := $(shell ls *.png)
|
||||||
|
RESOBJ := $(patsubst %.png,%.o,$(RES))
|
||||||
|
RESC := $(patsubst %.png,%.c,$(RES))
|
||||||
|
RESH := $(patsubst %.png,%.h,$(RES))
|
||||||
|
|
||||||
|
OBJ := $(RESOBJ) $(SRCOBJ)
|
||||||
|
|
||||||
|
all : $(DOL)
|
||||||
|
|
||||||
|
$(DOL) : $(ELF)
|
||||||
|
@echo Converting to: $@
|
||||||
|
@$(ELF2DOL) $< $@
|
||||||
|
|
||||||
|
$(ELF) : $(OBJ)
|
||||||
|
@echo Linking as: $@
|
||||||
|
@$(CC) $^ $(LDFLAGS) $(LIBPATHS) $(LIBS) -o $@
|
||||||
|
|
||||||
|
clean :
|
||||||
|
rm -f $(OBJ) $(RESC) $(RESH) $(ELF) $(DOL) $(MAP)
|
||||||
|
|
||||||
|
run : $(DOL)
|
||||||
|
$(UPLOAD) $(DOL)
|
||||||
|
|
||||||
|
%.o : %.c
|
||||||
|
@echo Compiling: $<
|
||||||
|
@$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
.PRECIOUS : %.c
|
||||||
|
%.c : %.png
|
||||||
|
@echo Converting resource: $<
|
||||||
|
@./raw2c.exe $<
|
BIN
examples/bluechip/composition/raw2c.exe
Normal file
BIN
examples/bluechip/composition/raw2c.exe
Normal file
Binary file not shown.
BIN
examples/bluechip/composition/red50.png
Normal file
BIN
examples/bluechip/composition/red50.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
Loading…
Reference in a new issue