diff --git a/GRRLIB/GRRLIB/GRRLIB_core.c b/GRRLIB/GRRLIB/GRRLIB_core.c index ce55b45..bb53683 100644 --- a/GRRLIB/GRRLIB/GRRLIB_core.c +++ b/GRRLIB/GRRLIB/GRRLIB_core.c @@ -144,10 +144,10 @@ int GRRLIB_Init (void) { 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); + guOrtho(perspective, 0.0f, rmode->efbHeight, 0.0f, rmode->fbWidth, 0.0f, 1000.0f); GX_LoadProjectionMtx(perspective, GX_ORTHOGRAPHIC); - GX_SetViewport(0, 0, rmode->fbWidth, rmode->efbHeight, 0, 1); + GX_SetViewport(0.0f, 0.0f, rmode->fbWidth, rmode->efbHeight, 0.0f, 1.0f); 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); diff --git a/GRRLIB/GRRLIB/grrlib.h b/GRRLIB/GRRLIB/grrlib.h index fede460..62c5347 100644 --- a/GRRLIB/GRRLIB/grrlib.h +++ b/GRRLIB/GRRLIB/grrlib.h @@ -37,7 +37,7 @@ THE SOFTWARE. /** * Version information for GRRLIB. */ -#define GRRLIB_VER_STRING "4.3.1" +#define GRRLIB_VER_STRING "4.3.2 alpha" //============================================================================== // Includes diff --git a/GRRLIB/GRRLIB/grrlib/GRRLIB__inline.h b/GRRLIB/GRRLIB/grrlib/GRRLIB__inline.h index 36139f7..977a44a 100644 --- a/GRRLIB/GRRLIB/grrlib/GRRLIB__inline.h +++ b/GRRLIB/GRRLIB/grrlib/GRRLIB__inline.h @@ -41,10 +41,6 @@ THE SOFTWARE. // 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); @@ -89,7 +85,7 @@ 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); + const u32 color, const bool filled); //------------------------------------------------------------------------------ // GRRLIB_handle.h - Texture handle manipulation @@ -124,7 +120,6 @@ INLINE void GRRLIB_FreeTexture (GRRLIB_texImg *tex); //============================================================================== // Definitions of inlined functions //============================================================================== -#include // C extensions (helper functions) #include // Clipping control #include // Collision detection #include // Render to framebuffer: Complex primitives diff --git a/GRRLIB/GRRLIB/grrlib/GRRLIB_cExtn.h b/GRRLIB/GRRLIB/grrlib/GRRLIB_cExtn.h deleted file mode 100644 index a374f57..0000000 --- a/GRRLIB/GRRLIB/grrlib/GRRLIB_cExtn.h +++ /dev/null @@ -1,43 +0,0 @@ -/*------------------------------------------------------------------------------ -Copyright (c) 2010 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_cExtn.h - * Inline functions to offer additional C primitives. - */ - -#include - -/** - * 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. Using float to increase the precision. This makes a full spectrum (0 - 255) possible. - * @return Returns a clean, clamped unsigned char. - */ -INLINE -u8 GRRLIB_ClampVar8 (f32 Value) { - Value = roundf(Value); - if (Value < 0) Value = 0; - else if (Value > 255) Value = 255; - - return (u8)Value; -} diff --git a/GRRLIB/GRRLIB/grrlib/GRRLIB_fbSimple.h b/GRRLIB/GRRLIB/grrlib/GRRLIB_fbSimple.h index 8d62073..ec61057 100644 --- a/GRRLIB/GRRLIB/grrlib/GRRLIB_fbSimple.h +++ b/GRRLIB/GRRLIB/grrlib/GRRLIB_fbSimple.h @@ -31,7 +31,7 @@ THE SOFTWARE. */ INLINE void GRRLIB_FillScreen (const u32 color) { - GRRLIB_Rectangle(-40, -40, rmode->fbWidth +80, rmode->xfbHeight +80, color, 1); + GRRLIB_Rectangle(-40.0f, -40.0f, rmode->fbWidth + 80.0f, rmode->xfbHeight + 80.0f, color, true); } /** @@ -44,7 +44,7 @@ void GRRLIB_FillScreen (const u32 color) { INLINE void GRRLIB_Plot (const f32 x, const f32 y, const u32 color) { GX_Begin(GX_POINTS, GX_VTXFMT0, 1); - GX_Position3f32(x, y, 0); + GX_Position3f32(x, y, 0.0f); GX_Color1u32(color); GX_End(); } @@ -62,9 +62,9 @@ INLINE void GRRLIB_Line (const f32 x1, const f32 y1, const f32 x2, const f32 y2, const u32 color) { GX_Begin(GX_LINES, GX_VTXFMT0, 2); - GX_Position3f32(x1, y1, 0); + GX_Position3f32(x1, y1, 0.0f); GX_Color1u32(color); - GX_Position3f32(x2, y2, 0); + GX_Position3f32(x2, y2, 0.0f); GX_Color1u32(color); GX_End(); } @@ -81,7 +81,7 @@ void GRRLIB_Line (const f32 x1, const f32 y1, INLINE void GRRLIB_Rectangle (const f32 x, const f32 y, const f32 width, const f32 height, - const u32 color, const u8 filled) { + const u32 color, const bool filled) { f32 x2 = x + width; f32 y2 = y + height; diff --git a/examples/3D_Light1/source/main.c b/examples/3D_Light1/source/main.c index 50247aa..47a049c 100644 --- a/examples/3D_Light1/source/main.c +++ b/examples/3D_Light1/source/main.c @@ -11,8 +11,6 @@ #include "gfx/Letter_Gothic_Std_14_Bold.h" -extern Mtx _GRR_view; - int main() { float l1=0, l2=0; float a=0; diff --git a/examples/3D_Light2/source/main.c b/examples/3D_Light2/source/main.c index 976b0f9..a85ed9f 100644 --- a/examples/3D_Light2/source/main.c +++ b/examples/3D_Light2/source/main.c @@ -11,8 +11,6 @@ #include "gfx/Rockwell_Condensed_12_Bold.h" -extern Mtx _GRR_view; - int main() { float a = 0; diff --git a/examples/3D_Light3/source/main.c b/examples/3D_Light3/source/main.c index e8d3eab..9d59e50 100644 --- a/examples/3D_Light3/source/main.c +++ b/examples/3D_Light3/source/main.c @@ -10,8 +10,6 @@ #include "gfx/font9x12.h" -extern Mtx _GRR_view; - int main() { f32 rot = 0.0f; diff --git a/examples/3D_Light4/source/main.c b/examples/3D_Light4/source/main.c index f741baa..b95f54c 100644 --- a/examples/3D_Light4/source/main.c +++ b/examples/3D_Light4/source/main.c @@ -5,12 +5,11 @@ #include #include +#include #include #include "Snap_ITC_12.h" -extern Mtx _GRR_view; - int main(int argc, char **argv) { f32 lightx=0.0f; diff --git a/examples/particle/source/main.cpp b/examples/particle/source/main.cpp index 29a34f5..244ea64 100644 --- a/examples/particle/source/main.cpp +++ b/examples/particle/source/main.cpp @@ -54,6 +54,7 @@ static void createEffect( u8 id, int _x, int _y ); static void createParticle( u8 _id, int _x, int _y, float _scale, float _alpha, u8 _red, u8 _green, u8 _blue ); static bool updateParticle( Particle *part ); static u8 CalculateFrameRate(); +static u8 ClampVar8 (f32 Value); // Initialize general variables extern GXRModeObj *rmode; @@ -131,7 +132,7 @@ int main() { // Update and draw all particles for (vector::iterator PartIter = ParticleList.begin(); PartIter != ParticleList.end();) { if (updateParticle((*PartIter)) == true) { - GRRLIB_DrawImg( (*PartIter)->x, (*PartIter)->y, (*PartIter)->tex, (*PartIter)->rot, (*PartIter)->scale, (*PartIter)->scale, RGBA( (*PartIter)->red, (*PartIter)->green, (*PartIter)->blue, GRRLIB_ClampVar8((*PartIter)->alpha*255) ) ); + GRRLIB_DrawImg( (*PartIter)->x, (*PartIter)->y, (*PartIter)->tex, (*PartIter)->rot, (*PartIter)->scale, (*PartIter)->scale, RGBA( (*PartIter)->red, (*PartIter)->green, (*PartIter)->blue, ClampVar8((*PartIter)->alpha*255) ) ); } else { free( (*PartIter) ); ParticleList.erase(PartIter); @@ -285,3 +286,17 @@ static u8 CalculateFrameRate() { } return FPS; } + +/** + * 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. Using float to increase the precision. This makes a full spectrum (0 - 255) possible. + * @return Returns a clean, clamped unsigned char. + */ +static u8 ClampVar8 (f32 Value) { + Value = roundf(Value); + if (Value < 0) Value = 0; + else if (Value > 255) Value = 255; + + return (u8)Value; +} diff --git a/grrlib.doxygen b/grrlib.doxygen index 94acf17..6b787d8 100644 --- a/grrlib.doxygen +++ b/grrlib.doxygen @@ -31,7 +31,7 @@ PROJECT_NAME = GRRLIB # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 4.3.1 +PROJECT_NUMBER = "4.3.2 alpha" # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put.