1,029 bytes added
, 22:24, 27 April 2017
'''gLib2D''' is a C library by Geecko that aims to be a simple, fast, lightweight 2D graphics library. It has been specifically designed to replace the old graphics.c (graphics.h) file found in many PSP homebrew tutorials.
==Installation==
As a single include file, the glib2d.c and its header file can be dropped directly into your main project. At the top of your main file, add:
<pre>
#include "glib2d.h"
</pre>
==Examples==
===Load a PNG File===
Note that while most examples show loading the bare filename, in practice I found this to be problematic. An easy way to load an absolute path is by adding some macros to the top:
<pre>
#define TITLE "APPTITLE"
#define ROOT "ms0:/PSP/GAME/" TITLE "/"
</pre>
We can now stuff the <code>ROOT</code> macro into the path. In order to successfully locate the PNG file, it must be located in the <code>ROOT</code> path. The "swizzle" parameter tells the PSP to load the image via a faster-use method:
<pre>
g2dTexture* tex = _g2dTexLoadPNG(ROOT "filename.png", G2D_SWIZZLE);
</pre>