Thsfx
From ProjectWiki
(Difference between revisions)
(gTukSZpAqdmmdxUh) |
|||
Line 1: | Line 1: | ||
− | + | <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 background hardware. These functions are available for both screens. | ||
+ | |||
+ | ==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"> | ||
+ | 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> | ||
+ | |||
+ | '''Fade to White'''<br> | ||
+ | Fade screen 1 to White slowly. | ||
+ | <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> | ||
+ | |||
+ | '''Blend backgrounds with sprites'''<br> | ||
+ | Blend sprites evenly with backgrounds | ||
+ | <source lang="c"> | ||
+ | thSfxEnable(0, SFX_BRIGHTINC, SFX_OBJ, SFX_BG0|SFX_BG1|SFX_BG2|SFX_BG3|SFX_BD); | ||
+ | thSfxSetAlphaBlend(0, 15, 15); | ||
+ | </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);