mirror of
https://github.com/GRRLIB/GRRLIB.git
synced 2024-11-26 08:42:19 +00:00
[CHG] Now checks if the struct is valid / not NULL before drawing it.
This commit is contained in:
parent
6197d0e717
commit
9608deb240
2 changed files with 23 additions and 8 deletions
|
@ -1,9 +1,10 @@
|
||||||
/*===========================================
|
/*===========================================
|
||||||
GRRLIB (GX version) 4.0.0
|
GRRLIB (GX version) 4.0.0
|
||||||
Code : NoNameNo
|
Code : NoNameNo
|
||||||
Additional Code : Crayon
|
Additional Code : Crayon & Xane
|
||||||
GX hints : RedShade
|
GX hints : RedShade
|
||||||
===========================================*/
|
===========================================*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
@ -18,6 +19,7 @@
|
||||||
|
|
||||||
#define DEFAULT_FIFO_SIZE (256 * 1024) /**< GX fifo buffer size. */
|
#define DEFAULT_FIFO_SIZE (256 * 1024) /**< GX fifo buffer size. */
|
||||||
|
|
||||||
|
|
||||||
u32 fb = 0;
|
u32 fb = 0;
|
||||||
static void *xfb[2] = {NULL, NULL};
|
static void *xfb[2] = {NULL, NULL};
|
||||||
GXRModeObj *rmode;
|
GXRModeObj *rmode;
|
||||||
|
@ -544,7 +546,9 @@ GRRLIB_texImg *GRRLIB_CreateEmptyTexture(unsigned int w, unsigned int h) {
|
||||||
* @param color Color in RGBA format.
|
* @param color Color in RGBA format.
|
||||||
*/
|
*/
|
||||||
inline void GRRLIB_DrawImg(f32 xpos, f32 ypos, struct GRRLIB_texImg *tex, float degrees, float scaleX, f32 scaleY, u32 color) {
|
inline void GRRLIB_DrawImg(f32 xpos, f32 ypos, struct GRRLIB_texImg *tex, float degrees, float scaleX, f32 scaleY, u32 color) {
|
||||||
if (!tex->data) { return; }
|
if (tex == NULL) { return; }
|
||||||
|
if (tex->data == NULL) { return; }
|
||||||
|
|
||||||
GXTexObj texObj;
|
GXTexObj texObj;
|
||||||
u16 width, height;
|
u16 width, height;
|
||||||
Mtx m, m1, m2, mv;
|
Mtx m, m1, m2, mv;
|
||||||
|
@ -599,6 +603,9 @@ inline void GRRLIB_DrawImg(f32 xpos, f32 ypos, struct GRRLIB_texImg *tex, float
|
||||||
* @param color Color in RGBA format.
|
* @param color Color in RGBA format.
|
||||||
*/
|
*/
|
||||||
inline void GRRLIB_DrawImgQuad(Vector pos[4], struct GRRLIB_texImg *tex, u32 color) {
|
inline void GRRLIB_DrawImgQuad(Vector pos[4], struct GRRLIB_texImg *tex, u32 color) {
|
||||||
|
if (tex == NULL) { return; }
|
||||||
|
if (tex->data == NULL) { return; }
|
||||||
|
|
||||||
GXTexObj texObj;
|
GXTexObj texObj;
|
||||||
Mtx m, m1, m2, mv;
|
Mtx m, m1, m2, mv;
|
||||||
|
|
||||||
|
@ -655,6 +662,10 @@ inline void GRRLIB_DrawImgQuad(Vector pos[4], struct GRRLIB_texImg *tex, u32 col
|
||||||
* @param frame Specifies the frame to draw.
|
* @param frame Specifies the frame to draw.
|
||||||
*/
|
*/
|
||||||
inline void GRRLIB_DrawTile(f32 xpos, f32 ypos, struct GRRLIB_texImg *tex, float degrees, float scaleX, f32 scaleY, u32 color, int frame) {
|
inline void GRRLIB_DrawTile(f32 xpos, f32 ypos, struct GRRLIB_texImg *tex, float degrees, float scaleX, f32 scaleY, u32 color, int frame) {
|
||||||
|
if (tex == NULL) { return; }
|
||||||
|
if (tex->data == NULL) { return; }
|
||||||
|
if (tex->frame > (tex->nbtilew+tex->nbtileh)) { return; }
|
||||||
|
|
||||||
GXTexObj texObj;
|
GXTexObj texObj;
|
||||||
f32 width, height;
|
f32 width, height;
|
||||||
Mtx m, m1, m2, mv;
|
Mtx m, m1, m2, mv;
|
||||||
|
@ -721,6 +732,9 @@ inline void GRRLIB_DrawTile(f32 xpos, f32 ypos, struct GRRLIB_texImg *tex, float
|
||||||
* @param ... Optional arguments.
|
* @param ... Optional arguments.
|
||||||
*/
|
*/
|
||||||
void GRRLIB_Printf(f32 xpos, f32 ypos, struct GRRLIB_texImg *tex, u32 color, f32 zoom, const char *text, ...) {
|
void GRRLIB_Printf(f32 xpos, f32 ypos, struct GRRLIB_texImg *tex, u32 color, f32 zoom, const char *text, ...) {
|
||||||
|
if (tex == NULL) { return; }
|
||||||
|
if (tex->data == NULL) { return; }
|
||||||
|
|
||||||
int i, size;
|
int i, size;
|
||||||
char tmp[1024];
|
char tmp[1024];
|
||||||
|
|
||||||
|
@ -1201,6 +1215,7 @@ void GRRLIB_Render() {
|
||||||
GX_SetZMode(GX_TRUE, GX_LEQUAL, GX_TRUE);
|
GX_SetZMode(GX_TRUE, GX_LEQUAL, GX_TRUE);
|
||||||
GX_SetColorUpdate(GX_TRUE);
|
GX_SetColorUpdate(GX_TRUE);
|
||||||
GX_CopyDisp(xfb[fb], GX_TRUE);
|
GX_CopyDisp(xfb[fb], GX_TRUE);
|
||||||
|
|
||||||
VIDEO_SetNextFramebuffer(xfb[fb]);
|
VIDEO_SetNextFramebuffer(xfb[fb]);
|
||||||
VIDEO_Flush();
|
VIDEO_Flush();
|
||||||
VIDEO_WaitVSync();
|
VIDEO_WaitVSync();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*===========================================
|
/*===========================================
|
||||||
GRRLIB (GX version) 4.0.0
|
GRRLIB (GX version) 4.0.0
|
||||||
Code : NoNameNo
|
Code : NoNameNo
|
||||||
Additional Code : Crayon
|
Additional Code : Crayon & Xane
|
||||||
GX hints : RedShade
|
GX hints : RedShade
|
||||||
===========================================*/
|
===========================================*/
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue