diff options
| author | XaviDCR92 <xavi.dcr@gmail.com> | 2018-02-25 05:25:33 +0100 |
|---|---|---|
| committer | XaviDCR92 <xavi.dcr@gmail.com> | 2018-02-25 05:25:33 +0100 |
| commit | baa647ad7caf95ea2619d8456bcfd0f04a08a719 (patch) | |
| tree | 7a7f5408a8ae0cc18a70d7795a2a47af30cf59f5 /Source/Gfx.c | |
| parent | 81d9242514b4e8e3fe97cf7063a15680f610bf2f (diff) | |
| download | airport-baa647ad7caf95ea2619d8456bcfd0f04a08a719.tar.gz | |
+ Added Message module, used for tutorials.
+ Added first tutorial level.
* Font now inserts line feed automatically if the next word is too long to fit.
* Gfx.c: added primitive list double buffering in order to gain some performance.
* MapEditor: now airport can be defined inside the tool.
Diffstat (limited to 'Source/Gfx.c')
| -rw-r--r-- | Source/Gfx.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/Source/Gfx.c b/Source/Gfx.c index d4de561..bc47ae9 100644 --- a/Source/Gfx.c +++ b/Source/Gfx.c @@ -26,8 +26,6 @@ enum { - BUTTON_SIZE = 16, - BUTTON_CROSS_U = 48, BUTTON_CROSS_V = 0, @@ -82,7 +80,7 @@ GsSprite PSXButtons; /* ************************************* * Local Prototypes * *************************************/ - +void GfxSetPrimitiveList(unsigned int* ptrList); /* ************************************* @@ -95,6 +93,9 @@ static GsDrawEnv DrawEnv; static GsDispEnv DispEnv; // Primitive list (it contains all the graphical data for the GPU) static unsigned int prim_list[PRIMITIVE_LIST_SIZE]; + +//Primitive list double buffering +static unsigned int prim_list2[PRIMITIVE_LIST_SIZE]; // Tells other modules whether data is being loaded to GPU static volatile bool gfx_busy; // Dictates (R,G,B) brigthness to all sprites silently @@ -213,9 +214,14 @@ void GfxInitDispEnv(void) * used internally by PSXSDK). * * **********************************************************************/ -void GfxSetPrimitiveList(void) +void GfxSetPrimitiveList(unsigned int* ptrList) { - GsSetList(prim_list); + GsSetList(ptrList); +} + +void GfxSetDefaultPrimitiveList(void) +{ + GfxSetPrimitiveList(prim_list); } /* ********************************************************************** @@ -278,12 +284,18 @@ bool GfxReadyForDMATransfer(void) * **********************************************************************/ void GfxDrawScene(void) { - while ( (SystemRefreshNeeded() == false) - || + static unsigned int* ptrPrimList = prim_list; + + ptrPrimList = ((void*)ptrPrimList == (void*)&prim_list)? prim_list2 : prim_list; + + while ( (SystemRefreshNeeded() == false) + || (GfxIsGPUBusy() != false) ); GfxDrawScene_Fast(); + GfxSetPrimitiveList(ptrPrimList); + SystemCyclicHandler(); } |
