Thsfx
From ProjectWiki
(Difference between revisions)
(→Functions) |
|||
(15 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. | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | I | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | ' | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
==Examples== | ==Examples== | ||
− | '''Fadeout''' | + | '''Fadeout'''<br> |
Fade screen 0 to black. | 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, | + | thSfxEnable(0, SFX_BRIGHTDEC, SFX_BG0|SFX_BG1|SFX_BG2|SFX_BG3|SFX_OBJ|SFX_BD, SFX_NONE); |
int fade=0; | int fade=0; | ||
do { | do { | ||
thSfxSetBrightness(0, fade); | thSfxSetBrightness(0, fade); | ||
swiWaitForVBlank(); | swiWaitForVBlank(); | ||
− | } while(++fade< | + | } while(++fade<=SFX_MAX); |
</source> | </source> | ||
− | '''Fade to White''' | + | '''Fade to White'''<br> |
Fade screen 1 to White slowly. | 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, | + | thSfxEnable(1, SFX_BRIGHTINC, SFX_BG0|SFX_BG1|SFX_BG2|SFX_BG3|SFX_OBJ|SFX_BD, SFX_NONE); |
int fade=0; | int fade=0; | ||
do { | do { | ||
thSfxSetBrightness(1, fade>>2); | thSfxSetBrightness(1, fade>>2); | ||
swiWaitForVBlank(); | swiWaitForVBlank(); | ||
− | } while(++fade<( | + | } while(++fade<=(SFX_MAX<<2)); |
</source> | </source> | ||
− | '''Blend backgrounds with sprites''' | + | '''Blend backgrounds with sprites'''<br> |
Blend sprites evenly with backgrounds | Blend sprites evenly with backgrounds | ||
<source lang="c"> | <source lang="c"> | ||
Line 107: | Line 39: | ||
thSfxSetAlphaBlend(0, 15, 15); | 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);