ShadowFX
From SWWorkshop
In 2D Games shadow creation is simple than 3D. The only thing you must do is render the same objects with gray color and different orientation.
- Sprite - (0,0,0,0.5) multiply color so the shadow color is halt transparent black color.
- Sprite - (x+20,y+20,w*2,h*2) Light direction effects shadow coordinate and size.
Api Docs
swGraphics,swRect
Source Code
//------------------------------------------------------------------------------------------- void xenDisplay(void *obj){ swRect shadow; Xen *xen=(Xen*)obj; //BlendingMode swGraphicsSetBlendingMode(SW_BLENDING_MODE_SOLID); //Draw Shadow swRectSet(&shadow,xen->target.x+20,xen->target.y+20,xen->target.w*2,xen->target.h*2); swGraphicsSetColor0(0,0,0,0.5); swGraphicsRenderSprite0(spriteID,swAnimatorGetIndex(xen->animatorID),&shadow); //Draw Image swGraphicsSetColor0(1,1,1,1); swGraphicsRenderSprite0(spriteID,swAnimatorGetIndex(xen->animatorID),&xen->target); }
