Thsfx
From ProjectWiki
(Difference between revisions)
(New page: <big>NDS special effect library</big> __TOC__ ==What is this?== This is a simple library for controlling special effects functions in the form of macros for the Nintendo DS's sprite and ba...) |
|||
(17 intermediate revisions by 6 users not shown) | |||
Line 5: | Line 5: | ||
==Where do i get it?== | ==Where do i get it?== | ||
+ | Currently the sources for this are part of [http://blea.ch/wiki/index.php/Category:LIBTHDS LibThds]. The source can be downloaded via SVN (see libthds page) or directly from the svn httpd:<br> | ||
+ | * [http://svn.blea.ch/thdslib/trunk/thdslib/source/arm9/include/thsfx.h thsfx.h] | ||
− | + | Okay I'm convinced. Let's put it to atcion. | |
− | ' | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ==Examples== | |
− | + | '''Fadeout'''<br> | |
+ | Fade screen 0 to black. | ||
<source lang="c"> | <source lang="c"> | ||
− | + | thSfxEnable(0, SFX_BRIGHTDEC, SFX_BG0|SFX_BG1|SFX_BG2|SFX_BG3|SFX_OBJ|SFX_BD, SFX_NONE); | |
+ | int fade=0; | ||
+ | do { | ||
+ | thSfxSetBrightness(0, fade); | ||
+ | swiWaitForVBlank(); | ||
+ | } while(++fade<=SFX_MAX); | ||
</source> | </source> | ||
− | ''' | + | '''Fade to White'''<br> |
− | + | Fade screen 1 to White slowly. | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
<source lang="c"> | <source lang="c"> | ||
− | + | thSfxEnable(1, SFX_BRIGHTINC, SFX_BG0|SFX_BG1|SFX_BG2|SFX_BG3|SFX_OBJ|SFX_BD, SFX_NONE); | |
+ | int fade=0; | ||
+ | do { | ||
+ | thSfxSetBrightness(1, fade>>2); | ||
+ | swiWaitForVBlank(); | ||
+ | } while(++fade<=(SFX_MAX<<2)); | ||
</source> | </source> | ||
− | ''' | + | '''Blend backgrounds with sprites'''<br> |
− | + | Blend sprites evenly with backgrounds | |
<source lang="c"> | <source lang="c"> | ||
− | + | thSfxEnable(0, SFX_BRIGHTINC, SFX_OBJ, SFX_BG0|SFX_BG1|SFX_BG2|SFX_BG3|SFX_BD); | |
− | + | thSfxSetAlphaBlend(0, 15, 15); | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
</source> | </source> | ||
− | + | [[Category:NDS]] | |
− | + | [[Category:C]] | |
− | + | [[Category:LIBTHDS]] | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + |
Latest revision as of 14:16, 13 August 2011
NDS special effect library
Contents |
What is this?
This is a simple library for controlling special effects functions in the form of macros for the Nintendo DS's sprite and background hardware. These functions are available for both screens.
Where do i get it?
Currently the sources for this are part of LibThds. The source can be downloaded via SVN (see libthds page) or directly from the svn httpd:
Okay I'm convinced. Let's put it to atcion.
Examples
Fadeout
Fade screen 0 to black.
thSfxEnable(0, SFX_BRIGHTDEC, SFX_BG0|SFX_BG1|SFX_BG2|SFX_BG3|SFX_OBJ|SFX_BD, SFX_NONE); int fade=0; do { thSfxSetBrightness(0, fade); swiWaitForVBlank(); } while(++fade<=SFX_MAX);
Fade to White
Fade screen 1 to White slowly.
thSfxEnable(1, SFX_BRIGHTINC, SFX_BG0|SFX_BG1|SFX_BG2|SFX_BG3|SFX_OBJ|SFX_BD, SFX_NONE); int fade=0; do { thSfxSetBrightness(1, fade>>2); swiWaitForVBlank(); } while(++fade<=(SFX_MAX<<2));
Blend backgrounds with sprites
Blend sprites evenly with backgrounds
thSfxEnable(0, SFX_BRIGHTINC, SFX_OBJ, SFX_BG0|SFX_BG1|SFX_BG2|SFX_BG3|SFX_BD); thSfxSetAlphaBlend(0, 15, 15);