2015-03-28 21:29:57 +00:00
GRRLIB
======
2009-09-13 14:27:01 +00:00
Table of Contents
-----------------
2015-03-28 21:29:57 +00:00
#####Introduction
######...What is it?
2009-09-13 14:27:01 +00:00
2015-03-28 21:29:57 +00:00
#####Developing for the Wii
######...How do I even start?
2009-09-13 14:27:01 +00:00
2015-03-28 21:29:57 +00:00
#####Downloading GRRLIB
######...Where do I get it from?
2009-09-13 14:27:01 +00:00
2015-03-28 21:29:57 +00:00
#####Installing GRRLIB
######...How do I get it to a useable state?
2009-09-13 14:27:01 +00:00
2015-03-28 21:29:57 +00:00
#####Using GRRLIB
######...What essentials do I need to know to get going?
2009-09-13 14:27:01 +00:00
2015-03-28 21:29:57 +00:00
#####Upgrading to v4.1.0 From Previous Versions of GRRLIB
######...I upgraded and now my programs won't compile properly!?
2009-09-13 14:27:01 +00:00
2015-03-30 02:05:56 +00:00
#####Using GitHub
2015-03-28 21:29:57 +00:00
######...What is this SVN thing that the L337 devs keep talking about?
2009-09-13 14:27:01 +00:00
2015-03-28 21:29:57 +00:00
#####Credits
######...Who do I thank for all this free stuff?
2009-09-13 14:27:01 +00:00
2015-03-28 21:29:57 +00:00
#####Licence
######...When you say "free" do you actually mean something else?
2009-09-13 14:27:01 +00:00
Introduction
------------
2009-12-14 23:14:17 +00:00
GRRLIB is a C/C++ 2D/3D graphics library for Wii application developers. It is
2009-09-13 14:27:01 +00:00
essentially a wrapper which presents a friendly interface to the Nintendo GX
core.
This document is written to be viewed with equal clarity in either a web browser
or a text editor.
As of v4.1.0, GRRLIB is supplied as a standard C/C++ library (aka. archive)
called 'libgrrlib'. Because GRRLIB processes JPEG and PNG images, it requires
the installation of the 'libjpeg' and 'libpngu' libraries. 'libpngu', in turn,
2010-01-04 16:56:52 +00:00
requires 'libpng' and 'libpng' requires 'libz'. GRRLIB has FileIO functions
to allow real-time loading and saving of graphical data, and thus requires
'libfat'. GRRLIB also has the possibility to use TrueType fonts, so
'libfreetype' is also required.
2009-09-13 14:27:01 +00:00
2015-03-28 21:29:57 +00:00
libgrrlib < - 2D / 3D graphics library
+-- libfat < - File I / O
+-- libjpeg < - JPEG image processor
+-- libpngu < - Wii wrapper for libpng
+-- libpng < - PNG image processor
+-- libz < - Zip ( lossless ) compression ( for PNG compression )
+-- libfreetype < - TrueType font processor
2009-09-13 14:27:01 +00:00
Developing for the Wii
----------------------
Do not progress until you have installed and configured devkitPro. Guides are
and assistance are available at http://forums.devkitpro.org
If you have just performed a clean (re)install on your Windows PC, be sure to
reboot before you continue.
Downloading GRRLIB
------------------
2015-03-30 02:05:56 +00:00
You are invited to use "the latest Git master version" of GRRLIB at all times.
2009-09-13 14:27:01 +00:00
2015-03-30 02:05:56 +00:00
The Git repository is located at: https://github.com/GRRLIB/GRRLIB
2009-09-13 14:27:01 +00:00
2015-03-30 02:05:56 +00:00
There is a simple guide to "Using GitHub" later in this document.
2009-09-13 14:27:01 +00:00
2015-03-30 02:05:56 +00:00
This document will presume that you have downloaded "the latest Git master
version" to a directory called C:\grr
2009-09-13 14:27:01 +00:00
Installing GRRLIB
-----------------
This guide is for Windows. If you are using Linux, I am going to presume you
are smart enough to convert these instructions.
2010-04-07 04:45:13 +00:00
GRRLIB is supplied as source code
2010-04-05 02:00:45 +00:00
libjpeg is supplied as source code
libpngu is supplied as source code
libpng is supplied as source code
libz is supplied as source code
libfreetype is supplied as source code
libfat is supplied with devkitpro (Ie. preinstalled)
2009-09-13 14:27:01 +00:00
2010-04-08 23:13:49 +00:00
The easy way is to install GRRLIB and all the required libraries in a single
command:
2015-03-30 02:05:56 +00:00
```
2010-04-08 23:13:49 +00:00
c:
2015-03-30 02:05:56 +00:00
cd \grr\GRRLIB
2010-04-08 23:13:49 +00:00
make clean all install
2015-03-30 02:05:56 +00:00
```
2010-04-08 23:13:49 +00:00
This process may take some time depending on the speed of your PC.
2009-09-13 14:27:01 +00:00
2010-04-08 23:13:49 +00:00
If you used the method above the following steps are not required, GRRLIB is
installed and you are ready to start developing Wii homebrew games.
If you want, you could install the libz, libpng, libpngu, libjpeg and
libfreetype libraries in a single command:
2015-03-28 21:29:57 +00:00
```
2010-04-08 23:13:49 +00:00
c:
2015-03-30 02:05:56 +00:00
cd \grr\GRRLIB\lib
2010-04-08 23:13:49 +00:00
make clean all install
2015-03-28 21:29:57 +00:00
```
2010-04-08 23:13:49 +00:00
Each library could also be installed individually:
To install libz
2015-03-28 21:29:57 +00:00
```
2010-03-24 22:13:18 +00:00
c:
2015-03-30 02:05:56 +00:00
cd \grr\GRRLIB\lib\zlib
2010-03-24 22:13:18 +00:00
make clean all install
2015-03-28 21:29:57 +00:00
```
2009-09-13 14:27:01 +00:00
2010-04-08 23:13:49 +00:00
To install libpng
2015-03-28 21:29:57 +00:00
```
2009-09-13 14:27:01 +00:00
c:
2015-03-30 02:05:56 +00:00
cd \grr\GRRLIB\lib\png
2010-01-07 00:03:56 +00:00
make clean all install
2015-03-28 21:29:57 +00:00
```
2009-09-13 14:27:01 +00:00
2010-04-08 23:13:49 +00:00
To install libpngu
2015-03-28 21:29:57 +00:00
```
2009-09-13 14:27:01 +00:00
c:
2015-03-30 02:05:56 +00:00
cd \grr\GRRLIB\lib\pngu
2009-09-13 14:27:01 +00:00
make clean all install
2015-03-28 21:29:57 +00:00
```
2009-09-13 14:27:01 +00:00
2010-04-08 23:13:49 +00:00
To install libjpeg
2015-03-28 21:29:57 +00:00
```
2010-01-04 16:56:52 +00:00
c:
2015-03-30 02:05:56 +00:00
cd \grr\GRRLIB\lib\jpeg
2010-01-28 23:20:30 +00:00
make clean all install
2015-03-28 21:29:57 +00:00
```
2010-01-04 16:56:52 +00:00
2010-04-08 23:13:49 +00:00
To install libfreetype
2015-03-28 21:29:57 +00:00
```
2009-09-13 14:27:01 +00:00
c:
2015-03-30 02:05:56 +00:00
cd \grr\GRRLIB\lib\freetype
2010-04-05 02:00:45 +00:00
make clean all install
2015-03-28 21:29:57 +00:00
```
2009-09-13 14:27:01 +00:00
2010-04-08 23:13:49 +00:00
To install libgrrlib:
2015-03-28 21:29:57 +00:00
```
2009-09-13 14:27:01 +00:00
c:
2015-03-30 02:05:56 +00:00
cd \grr\GRRLIB\GRRLIB
2009-09-13 14:27:01 +00:00
make clean all install
2015-03-28 21:29:57 +00:00
```
2009-09-13 14:27:01 +00:00
Using GRRLIB
------------
After everything is installed, simply put
2015-03-28 21:29:57 +00:00
```c
#include < grrlib.h >
```
2009-12-14 23:14:17 +00:00
at the top of your .c/.cpp file and use the functions as required
2009-09-13 14:27:01 +00:00
You will also need to add
2015-03-28 21:29:57 +00:00
```make
2010-01-04 16:56:52 +00:00
-lgrrlib -lfreetype -lfat -ljpeg -lpngu -lpng -lz
2015-03-28 21:29:57 +00:00
```
2009-09-13 14:27:01 +00:00
to the libs line in your makefile
...Remember the order of the libraries is critical. You may (need to) insert
other libraries in the middle of the list, you may need to add others to the
start, or even the end - but do _not_ change the order of the libraries shown
here.
You do NOT need to place /anything/ in your application directory.
If you would like to see a working example of this, you can look at the example
2015-03-30 02:05:56 +00:00
found in: C:\grr\examples\template\source
2009-09-13 14:27:01 +00:00
Upgrading to v4.1.0 From Previous Versions of GRRLIB
----------------------------------------------------
Older versions of GRRLIB, required a line such as:
2015-03-28 21:29:57 +00:00
```c
2009-09-13 14:27:01 +00:00
#include "../../../GRRLIB/GRRLIB/GRRLIB.h"
2015-03-28 21:29:57 +00:00
```
2009-09-13 14:27:01 +00:00
...to be placed at the top of each C file which uses GRRLB.
Because GRRLIB is now installed as a system library, this must be replaced with:
2015-03-28 21:29:57 +00:00
```c
#include < grrlib.h >
```
2009-09-13 14:27:01 +00:00
Older versions of GRRLIB required the 'GRRLIB.h' and 'GRRLIB.c" files to be
present in every project which uses GRRLIB.
Because GRRLIB is now installed as a system library, these files are no longer
required and must be erased.
*WARNING* Be careful if you have edited (either of) these files.
Older versions of GRRLIB "passed 'structs'" and therefore Textured Images were
defined with:
2015-03-28 21:29:57 +00:00
```c
2009-09-13 14:27:01 +00:00
GRRLIB_texImg tex1, tex2;
2015-03-28 21:29:57 +00:00
```
2009-09-13 14:27:01 +00:00
Because GRRLIB now "passes 'pointers'" these definitions should be changed to:
2015-03-28 21:29:57 +00:00
```c
2009-09-13 14:27:01 +00:00
GRRLIB_texImg *tex1, *tex2;
2015-03-28 21:29:57 +00:00
```
2009-09-13 14:27:01 +00:00
With older versions of GRRLIB if the programmer (you) required access to the
mode and frame information, you were required to add one or more of the
following three lines:
2015-03-28 21:29:57 +00:00
```c
2009-09-13 14:27:01 +00:00
extern GXRModeObj *rmode;
extern void *xfb[2];
extern u32 fb;
2015-03-28 21:29:57 +00:00
```
2009-09-13 14:27:01 +00:00
Because GRRLIB now does this for you automatically, these lines must be removed
from your code.
2015-03-30 02:05:56 +00:00
Using GitHub
------------
2009-09-13 14:27:01 +00:00
2015-03-30 02:05:56 +00:00
GitHub allows the developers to submit changes to the code in such a way that
2009-09-13 14:27:01 +00:00
these changes can be easily monitored, quickly merged together with other
changes. and (if necessary) reverted.
It also allows the power-users to gain access to the latest (often "in-test")
features.
2015-03-30 02:05:56 +00:00
To obtain the "cutting edge" codebase go to https://github.com/GRRLIB/GRRLIB/tree/master
2009-09-13 14:27:01 +00:00
2015-03-28 21:29:57 +00:00
1. Create a directory to hold the code (Eg. C:\grr)
2015-03-30 02:05:56 +00:00
2. Click the *Download ZIP* button if you don't have the proper tools installed on your PC or Clone the following URL https://github.com/GRRLIB/GRRLIB.git
2009-09-13 14:27:01 +00:00
2015-03-30 02:05:56 +00:00
All official releases can be found here https://github.com/GRRLIB/GRRLIB/releases
2009-09-13 14:27:01 +00:00
Credits
-------
2015-03-28 21:29:57 +00:00
#### Project Leader
* NoNameNo
#### Documentation
* Crayon
* BlueChip
#### Lead Coder
* NoNameNo
#### Support Coders
* Crayon
* Xane
* DragonMinded
* BlueChip
* elisherer
#### Advisors
* RedShade
* Jespa
2009-09-13 14:27:01 +00:00
Licence
-------
GRRLIB is released under the MIT Licence. If we had chosen the GPL licence you
would be +forced+ (legally required) to release your source code. But in the
spirit of "free as in FREE" we have left you with the +option+ to release your
source code.
We do +request+ that you tell others about us by naming our library (GRRLIB) in
the credits of your game/application. And, if you +choose+ to do that, we
encourage you to use our logo to achieve it; You can find our logo here:
2015-03-30 02:05:56 +00:00
C:\grr\grrlib_logo.png
2009-09-13 14:27:01 +00:00
and here:
http://grrlib.santo.fr/wiki/images/logo.png
This is the official license text
2015-03-28 21:29:57 +00:00
```
Copyright (c) 2015 The GRRLIB Team
2009-09-13 14:27:01 +00:00
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.
2015-03-28 21:29:57 +00:00
```