2019-05-08 02:57:44 +00:00
# GRRLIB
2015-03-28 21:29:57 +00:00
2024-02-23 06:36:44 +00:00
[![GitHub Actions Workflow Status ](https://img.shields.io/github/actions/workflow/status/GRRLIB/GRRLIB/ci.yml?logo=github )](https://github.com/GRRLIB/GRRLIB/actions)
2023-08-20 07:28:06 +00:00
[![Codacy Badge ](https://app.codacy.com/project/badge/Grade/02847b348a1e4e6b850f956541ef2361 )](https://app.codacy.com/gh/GRRLIB/GRRLIB/dashboard?utm_source=gh& utm_medium=referral& utm_content=& utm_campaign=Badge_grade)
2024-02-23 06:36:44 +00:00
[![GitHub Discussions ](https://img.shields.io/github/discussions/GRRLIB/GRRLIB?logo=github )](https://github.com/GRRLIB/GRRLIB/discussions)
[![Static Badge ](https://img.shields.io/badge/code-documented-brightgreen )](https://grrlib.github.io/GRRLIB)
2009-09-13 14:27:01 +00:00
2019-05-08 02:57:44 +00:00
## Table of Contents
2009-09-13 14:27:01 +00:00
2020-01-12 03:56:12 +00:00
* [Introduction ](#introduction )
* ...What is it?
* [Developing for the Wii ](#developing-for-the-wii )
* ...How do I even start?
* [Downloading GRRLIB ](#downloading-grrlib )
* ...Where do I get it from?
* [Installing GRRLIB ](#installing-grrlib )
* ...How do I get it to a useable state?
* [Using GRRLIB ](#using-grrlib )
* ...What essentials do I need to know to get going?
* [Upgrading to v4.4.0 From Previous Versions of GRRLIB ](#upgrading-to-v440-from-previous-versions-of-grrlib )
* ...I upgraded and now my programs won't compile properly!?
* [Using GitHub ](#using-github )
* ...What is this Git thing that the L337 devs keep talking about?
* [Credits ](#credits )
* ...Who do I thank for all this free stuff?
* [Licence ](#licence )
* ...When you say "free" do you actually mean something else?
2009-09-13 14:27:01 +00:00
2019-05-08 02:57:44 +00:00
## Introduction
2009-09-13 14:27:01 +00:00
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.
2017-03-04 03:14:09 +00:00
GRRLIB is supplied as a standard C/C++ library (aka. archive)
2009-09-13 14:27:01 +00:00
called 'libgrrlib'. Because GRRLIB processes JPEG and PNG images, it requires
the installation of the 'libjpeg' and 'libpngu' libraries. 'libpngu', in turn,
2019-04-06 22:27:19 +00:00
requires 'libpng'. GRRLIB has FileIO functions
2010-01-04 16:56:52 +00:00
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
2019-05-01 12:40:24 +00:00
```text
2015-04-04 21:34:39 +00:00
libgrrlib < - 2D / 3D graphics library
2015-11-22 07:37:19 +00:00
├── libfat < - File I / O
├── libjpeg < - JPEG image processor
2022-05-27 04:53:50 +00:00
├── libpngu < - Wrapper for libpng
2015-11-22 07:37:19 +00:00
│ └── libpng < - PNG image processor
└── libfreetype < - TrueType font processor
2015-04-04 21:34:39 +00:00
```
2009-09-13 14:27:01 +00:00
2019-05-08 02:57:44 +00:00
## Developing for the Wii
2009-09-13 14:27:01 +00:00
Do not progress until you have installed and configured devkitPro. Guides are
2019-05-01 13:07:48 +00:00
and assistance are available at < https: / / devkitpro . org / index . php >
2009-09-13 14:27:01 +00:00
If you have just performed a clean (re)install on your Windows PC, be sure to
reboot before you continue.
2019-05-08 02:57:44 +00:00
## Downloading GRRLIB
2009-09-13 14:27:01 +00:00
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
2019-05-01 13:07:48 +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
2019-05-08 02:57:44 +00:00
## Installing GRRLIB
2009-09-13 14:27:01 +00:00
This guide is for Windows. If you are using Linux, I am going to presume you
are smart enough to convert these instructions.
2023-02-02 05:42:06 +00:00
2019-05-01 12:40:24 +00:00
```text
2010-04-07 04:45:13 +00:00
GRRLIB is supplied as source code
2010-04-05 02:00:45 +00:00
libpngu is supplied as source code
2019-04-06 22:27:19 +00:00
libpng is supplied via devkitPro pacman (ppc-libpng)
libfreetype is supplied via devkitPro pacman (ppc-freetype)
libjpeg is supplied via devkitPro pacman (ppc-libjpeg-turbo)
2019-04-30 22:51:30 +00:00
libfat is supplied via devkitPro pacman (libfat-ogc)
2015-11-02 02:17:42 +00:00
```
2009-09-13 14:27:01 +00:00
2024-10-12 21:15:18 +00:00
First, you need to make sure that all required library dependencies are installed.
Install them with a single command:
```bash
pacman --sync --needed --noconfirm libfat-ogc ppc-libpng ppc-freetype ppc-libjpeg-turbo
```
To install GRRLIB with Make in a few commands:
2023-02-02 05:42:06 +00:00
2015-11-02 02:17:42 +00:00
```bash
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
2024-10-12 21:15:18 +00:00
If you prefer to use CMake, it can also be installed with a few commands:
```bash
c:
cd \grr
/opt/devkitpro/portlibs/wii/bin/powerpc-eabi-cmake -B build
cmake --build build --target install
```
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.
Each library could also be installed individually:
2021-07-05 04:33:45 +00:00
To install libpngu:
2023-02-02 05:42:06 +00:00
2015-11-02 02:17:42 +00:00
```bash
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
2021-07-05 04:33:45 +00:00
To install libgrrlib for Wii:
2023-02-02 05:42:06 +00:00
2015-11-02 02:17:42 +00:00
```bash
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
2021-07-05 04:33:45 +00:00
To install libgrrlib for GameCube:
2023-02-02 05:42:06 +00:00
2021-07-05 04:33:45 +00:00
```bash
c:
cd \grr\GRRLIB\GRRLIB
make PLATFORM=cube clean all install
```
2019-05-08 02:57:44 +00:00
## Using GRRLIB
2009-09-13 14:27:01 +00:00
After everything is installed, simply put
2023-02-02 05:42:06 +00:00
2015-03-28 21:29:57 +00:00
```c
2017-02-25 18:16:08 +00:00
#include <grrlib.h>
2015-03-28 21:29:57 +00:00
```
2023-02-02 05:42:06 +00:00
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
2019-04-06 22:27:19 +00:00
You will need to add
2023-02-02 05:42:06 +00:00
2015-03-28 21:29:57 +00:00
```make
2024-02-07 06:17:54 +00:00
-lgrrlib -lpngu `$(PREFIX)pkg-config freetype2 libpng libjpeg --libs` -lfat
2015-03-28 21:29:57 +00:00
```
2023-02-02 05:42:06 +00:00
2009-09-13 14:27:01 +00:00
to the libs line in your makefile
2015-04-04 21:34:39 +00:00
2009-09-13 14:27:01 +00:00
...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.
2019-04-06 22:27:19 +00:00
Also add $(PORTLIBS) to the LIBDIRS line in your makefile
2009-09-13 14:27:01 +00:00
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
2020-01-12 03:56:12 +00:00
## Upgrading to v4.4.0 From Previous Versions of GRRLIB
2009-09-13 14:27:01 +00:00
2020-01-12 03:56:12 +00:00
This version now uses the ported libraries for the Wii.
2009-09-13 14:27:01 +00:00
2020-01-12 03:56:12 +00:00
To install them, use this command line:
```bash
pacman --sync --needed --noconfirm libfat-ogc ppc-libpng ppc-freetype ppc-libjpeg-turbo
2015-03-28 21:29:57 +00:00
```
2009-09-13 14:27:01 +00:00
2020-01-12 03:56:12 +00:00
You will need to add $(PORTLIBS) to the LIBDIRS line in your makefile.
2009-09-13 14:27:01 +00:00
2020-01-12 03:56:12 +00:00
Previously it could have looked like this:
```make
LIBDIRS :=
2015-03-28 21:29:57 +00:00
```
2009-09-13 14:27:01 +00:00
2020-01-12 03:56:12 +00:00
Now it needs to be like this:
```make
LIBDIRS := $(PORTLIBS)
2015-03-28 21:29:57 +00:00
```
2009-09-13 14:27:01 +00:00
2024-02-07 06:42:08 +00:00
The FreeType library is now compiled with dependencies,
so freetype2 must be added to pkg-config in your makefile.
2020-01-12 03:56:12 +00:00
For example:
```make
2024-02-07 06:17:54 +00:00
LIBS := -lgrrlib -lpngu `$(PREFIX)pkg-config freetype2 libpng libjpeg --libs` -lfat
2020-01-12 03:56:12 +00:00
```
2009-09-13 14:27:01 +00:00
2020-01-12 22:25:43 +00:00
Since GRRLIB and libpngu are now installed into the porlibs folder, make sure you don't have any leftovers from previous installations.
You will need to manually delete unneeded libraries in _devkitPro\libogc\lib\wii_ as well as include files in _devkitPro\libogc\include_
2019-05-08 02:57:44 +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.
2019-05-01 13:07:48 +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
2019-05-01 13:39:23 +00:00
1. Create a directory to hold the code (e.g. C:\grr)
2020-01-12 03:56:12 +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
2019-05-01 13:07:48 +00:00
All official releases can be found here < https: / / github . com / GRRLIB / GRRLIB / releases >
2009-09-13 14:27:01 +00:00
2019-05-08 02:57:44 +00:00
## Credits
2009-09-13 14:27:01 +00:00
2019-05-08 02:57:44 +00:00
### Project Leader
2022-09-24 15:30:01 +00:00
2015-03-28 21:29:57 +00:00
* NoNameNo
2019-05-08 02:57:44 +00:00
### Documentation
2022-09-24 15:30:01 +00:00
2015-03-28 21:29:57 +00:00
* Crayon
* BlueChip
2019-05-08 02:57:44 +00:00
### Lead Coder
2022-09-24 15:30:01 +00:00
2015-03-28 21:29:57 +00:00
* NoNameNo
2019-05-08 02:57:44 +00:00
### Support Coders
2022-09-24 15:30:01 +00:00
2015-03-28 21:29:57 +00:00
* Crayon
* Xane
* DragonMinded
* BlueChip
* elisherer
2019-05-08 02:57:44 +00:00
### Advisors
2022-09-24 15:30:01 +00:00
2015-03-28 21:29:57 +00:00
* RedShade
* Jespa
2009-09-13 14:27:01 +00:00
2019-05-08 02:57:44 +00:00
## Licence
2009-09-13 14:27:01 +00:00
2017-02-25 18:16:08 +00:00
GRRLIB is released under the [MIT Licence ](LICENCE.md ).
2015-04-04 21:34:39 +00:00
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
2009-09-13 14:27:01 +00:00
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:
2020-12-14 06:09:10 +00:00
C:\grr\docs\grrlib_logo.png
2009-09-13 14:27:01 +00:00
and here:
2020-12-14 06:09:10 +00:00
< https: / / grrlib . github . io / GRRLIB / grrlib_logo . png >