//
// Irrlicht Wrapper for PureBasic
// Michael Taupitz (2006/2007)
// Marius Eckardt (2007)
//

/* ////////////////////////////////////////////////////////////////////////////
includes
*/
#include "irrlichtwrapper.h"
#include "TAnimSpriteSceneNOde.h"
#include "CWrapperMemoryReadFile.h"

/* ////////////////////////////////////////////////////////////////////////////
external variables
*/
extern IrrlichtDevice *device;
extern IVideoDriver* driver;
extern ISceneManager* smgr;
extern IGUIEnvironment* guienv;


/* ////////////////////////////////////////////////////////////////////////////
Global Function Declarations

all of the below functions are declared as C functions and are exposed without
any mangled names so that they can be easily imported into imperative
languages like FreeBasic
*/
extern "C"
{

/* ////////////////////////////////////////////////////////////////////////////
Anim-Sprite-Functions
*/
/* ----------------------------------------------------------------------------
Create Anim-Sprite
*/

/****h* AnimSprite
* NAME
*   AnimSprite-Functions
* DESCRIPTION
*   For some 2D-Functions you can use this AnimSprite. It is basically a small Sprite-Wrapper
*   for Irrlicht. So you can move, rotate and stretch the Sprite.
*   You also able to use the different Material-Flags.
*
*   A Sprite can also defined as a Animation-Strip. And then its easy to use this AnimSprite
*   to animate them.
*
*   There are some drawbacks at the moment - so you have to 'Draw' the sprite explicitly with IrrAnimSpripteDraw().
*
*   Credits for this Functions and the SceneNode in the Back goes to Emil Hamil.
*
* EXAMPLE
*   ;; ////////////////////////////////////////////////////////////////////////////
*   ;; Include the Irr3D-Requester
*   XIncludeFile "Irr3DRequester.pb"
*
*   ;Use the  3D-Requester
*   If Irr3DRequester()
*
*       ;Create the Anim-Sprite
*       *animspritenode.l = IrrAddAnimSprite()
*
*       ;Load the Sprite (size of texture = 512x128, size of frame = 128x128)
*       IrrAnimSpriteLoad(*animspritenode, ".\media\animation.png" , 0,0,512,128,128,128)
*
*       ;Set the Speed of the animation
*       IrrAnimSpriteSetSpeed(*animspritenode,100)
*
*       ; -----------------------------------------------------------------------------
*       ; while the irrlicht environment is still running
*       While IrrRunning()
*
*           ; begin the scene, erasing the canvas with sky-blue before rendering
*           IrrBeginScene( 0,0,0 )
*
*           ; Draw the Scene (at the moment nothing there....)
*           IrrDrawScene()
*
*           : Draw this Sprite stretched from 10,10 to 200,200 (Screen-Cordinates !)
*           IrrAnimSpriteDraw(*animspritenode,10,10,200,200)
*
*           ; End the Scene
*           IrrEndScene()
*
*       Wend
*
*   Endif
*
*   ;End Irrlicht
*   IrrStop()
*
*   End
*
****
*/




/****f* AnimSprite/IrrAddAnimSprite
* NAME
*    IrrAddAnimSprite - Adds a AnimSprite
* SYNOPSIS
*    IrrAddAnimSprite( [*parent.l, id.l] )
* FUNCTION
*    Add a AnimSpriteSceneNode to the Scene. You have to load or Catch a
*   Texture/Image. This can als be a AnimStrip. See IrrAnimSpriteLoad() or IrrAnimSpriteCatch().
* INPUTS
*    *parent.l  - (optional) pointer t a parent-scenennode
*   id.l        - (optional) id of the Scene Node
* RESULT
*    A Pointer to the AnimSpriteSceneNode if success otherwise #Null
* EXAMPLE
*   *animspritenode.l = IrrAddAnimSprite()
* HISTORY
*   Added as Function in IrrlichtWrapper 1.05 by M.Taupitz
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrAddAnimSprite(*parent.l=#Null,id.l=-1)
*/
STATIC_EXPORT void* DLL_EXPORT IrrAddAnimSprite( ISceneNode* parent, s32 id )
{
    TAnimSpriteSceneNode* node = new TAnimSpriteSceneNode(parent, smgr, id, device->getTimer() );
//    node->drop();
    return (void*) node;
}

/****f* AnimSprite/IrrAnimSpriteLoad
* NAME
*    IrrAnimSpriteLoad - Load Image/Texture for AnimSprite
* SYNOPSIS
*    IrrAnimSpriteLoad(*animNode.l, filename.s, Ax.l, Ay.l, Aw.l, Ah.l, frmWidth.l, frmHeight.l, [useClrKey.l] )
* FUNCTION
*    Load a Image or Texture that should be used with this AnimSprite.
*   You can use als a anim-strip and define the frame-Width and Height.
* INPUTS
*   *animNode.l         - a valid pointer to a AnimSpriteSceneNode (created before with IrrAddAnimSprite())
*   filename.s          - Name of the File
*   Ax.l,Ay.l,Aw.l,Ah.l - define the Rect of the Image, that should be used with this AnimSprite.
*   frmWidth.l, frmHeight.l - define the Size of a Frame in the Image (Rect).
*   useClrKey.l            -(optional) Use ColorKey (#True / #False)
*
* RESULT
*    #True if success, otherwise #False
* EXAMPLE
*   IrrAnimSpriteLoad(*animspritenode, ".\media\animation.png" , 0,0,512,128,128,128)
* HISTORY
*   Added as Function in IrrlichtWrapper 1.05 by M.Taupitz
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrAnimSpriteLoad(*animNode.l, filename.p-ascii, Ax.l, Ay.l, Aw.l, Ah.l, frmWidth.l, frmHeight.l, useClrKey.l=#False )
*/
STATIC_EXPORT bool DLL_EXPORT IrrAnimSpriteLoad(TAnimSpriteSceneNode* node,  char* filename,s32 Ax,s32 Ay,s32 Aw,s32 Ah,s32 frmWidth,s32 frmHeight,bool useClrKey=false)
{
    return node->Load(filename,Ax,Ay,Aw,Ah,frmWidth,frmHeight,useClrKey);
}

/****f* AnimSprite/IrrAnimSpriteCatch
* NAME
*    IrrAnimSpriteCatch - Catch a Image/Texture for AnimSprite
* SYNOPSIS
*    IrrAnimSpriteCatch(*animNode.l, *memory.l, length.l, filename.s, Ax.l, Ay.l, Aw.l, Ah.l, frmWidth.l, frmHeight.l, [useClrKey.l] )
* FUNCTION
*   Catchs a Image or Texture from Memory that should be used with this AnimSprite.
*   You can use als a anim-strip and define the frame-Width and Height.
* INPUTS
*   *animNode.l         - a valid pointer to a AnimSpriteSceneNode (created before with IrrAddAnimSprite())
*   *memory.l           - Pointer to the Memory whre the Image is
*   length.l            - Sze of the Image in Memory (Size of the File !)
*   filename.s          - Name of the File
*   Ax.l,Ay.l,Aw.l,Ah.l - define the Rect of the Image, that should be used with this AnimSprite.
*   frmWidth.l, frmHeight.l - define the Size of a Frame in the Image (Rect).
*   useClrKey.l            -(optional) Use ColorKey (#True / #False)
*
* RESULT
*    #True if success, otherwise #False
* EXAMPLE
*   IrrAnimSpriteCatch(*animspritenode, ?myanim, (?myanim_end-?myanim)".\media\animation.png" , 0,0,512,128,128,128)
*   ....
*   DataSection
*   myanim:  IncludeBinary "./media/myanim.png"
*   myanimend:
*   EndDataSection
* HISTORY
*   Added as Function in IrrlichtWrapper 1.05 by M.Taupitz
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrAnimSpriteCatch(*animNode.l, *memory.l, length.l, filename.p-ascii, Ax.l, Ay.l, Aw.l, Ah.l, frmWidth.l, frmHeight.l, useClrKey.l=#False )
*/
STATIC_EXPORT bool DLL_EXPORT IrrAnimSpriteCatch(TAnimSpriteSceneNode* node,void* memory, u32 length, char* filename,s32 Ax,s32 Ay,s32 Aw,s32 Ah,s32 frmWidth,s32 frmHeight,bool useClrKey=false)
{


    bool bRet = false;
    IReadFile* file = device->getFileSystem()->createMemoryReadFile(memory, length, filename);
    if (!file)
        return false;
    bRet = node->Catch(
                        file,
                        Ax,Ay,Aw,Ah,frmWidth,frmHeight,useClrKey);
    file->drop();
    return bRet;
}

/****f* AnimSprite/IrrAnimSpritePlayForward
* NAME
*    IrrAnimSpritePlayForward - Set playing-Direction to Forward
* SYNOPSIS
*    IrrAnimSpritePlayForward(*animNode.l)
* FUNCTION
*    Set playing-Direction to Forward
* INPUTS
*   *animNode.l         - a valid pointer to a AnimSpriteSceneNode (created before with IrrAddAnimSprite())
* RESULT
*    nothing
* EXAMPLE
*   IrrAnimSpritePlayForward(*animspritenode)
* HISTORY
*   Added as Function in IrrlichtWrapper 1.05 by M.Taupitz
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrAnimSpritePlayForward(*animNode.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrAnimSpritePlayForward(TAnimSpriteSceneNode* node)
{
    node->PlayForward();
}

/****f* AnimSprite/IrrAnimSpritePlayBackward
* NAME
*    IrrAnimSpritePlayBackward - Set playing-Direction to Backward
* SYNOPSIS
*    IrrAnimSpritePlayBackward(*animNode.l)
* FUNCTION
*    Set playing-Direction to Backward
* INPUTS
*   *animNode.l         - a valid pointer to a AnimSpriteSceneNode (created before with IrrAddAnimSprite())
* RESULT
*    nothing
* EXAMPLE
*   IrrAnimSpritePlayBackward(*animspritenode)
* HISTORY
*   Added as Function in IrrlichtWrapper 1.05 by M.Taupitz
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrAnimSpritePlayBackward(*animNode.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrAnimSpritePlayBackward(TAnimSpriteSceneNode* node)
{
    node->PlayBackward();
}

/****f* AnimSprite/IrrAnimSpriteSetSpeed
* NAME
*    IrrAnimSpriteSetSpeed - Set animation speed
* SYNOPSIS
*    IrrAnimSpriteSetSpeed(*animNode.l, speed.l)
* FUNCTION
*    Set speed of the animation
* INPUTS
*   *animNode.l - a valid pointer to a AnimSpriteSceneNode (created before with IrrAddAnimSprite())
*   speed.l     - speed of the animation
* RESULT
*    nothing
* EXAMPLE
*   IrrAnimSpriteSetSpeed(*animspritenode, 100)
* HISTORY
*   Added as Function in IrrlichtWrapper 1.05 by M.Taupitz
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrAnimSpriteSetSpeed(*animNode.l, speed.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrAnimSpriteSetSpeed(TAnimSpriteSceneNode* node, int speed)
{
    node->setSpeed(speed);
}

/****f* AnimSprite/IrrAnimSpriteGetSpeed
* NAME
*    IrrAnimSpriteGetSpeed - Get animation speed
* SYNOPSIS
*    speed.l = IrrAnimSpriteGetSpeed(*animNode.l)
* FUNCTION
*    Get speed of the animation
* INPUTS
*   *animNode.l - a valid pointer to a AnimSpriteSceneNode (created before with IrrAddAnimSprite())
* RESULT
*    speed of the Animation
* EXAMPLE
*   speed.l = IrrAnimSpriteGetSpeed(*animspritenode)
* HISTORY
*   Added as Function in IrrlichtWrapper 1.05 by M.Taupitz
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrAnimSpriteGetSpeed(*animNode.l)
*/
STATIC_EXPORT int DLL_EXPORT IrrAnimSpriteGetSpeed(TAnimSpriteSceneNode* node)
{
    return node->getSpeed();
}

/****f* AnimSprite/IrrAnimSpriteSetLoop
* NAME
*    IrrAnimSpriteSetLoop - Set animation to loop / no loop
* SYNOPSIS
*    IrrAnimSpriteSetLoop(*animNode.l, looped.l)
* FUNCTION
*    Set Animation to Loop / no Loop
* INPUTS
*   *animNode.l - a valid pointer to a AnimSpriteSceneNode (created before with IrrAddAnimSprite())
*   looped.l     - #True if the Animation play looped
* RESULT
*    nothing
* EXAMPLE
*   IrrAnimSpriteSetLoop(*animspritenode, #True)
* HISTORY
*   Added as Function in IrrlichtWrapper 1.05 by M.Taupitz
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrAnimSpriteSetLoop(*animNode.l, looped.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrAnimSpriteSetLoop(TAnimSpriteSceneNode* node, bool l)
{
    node->setLoop(l);
}

/****f* AnimSprite/IrrAnimSpriteGetLoop
* NAME
*    IrrAnimSpriteGetLoop - Get animation loop-info
* SYNOPSIS
*    looped.l = IrrAnimSpriteGetLoop(*animNode.l)
* FUNCTION
*    Get animation loop-info
* INPUTS
*   *animNode.l - a valid pointer to a AnimSpriteSceneNode (created before with IrrAddAnimSprite())
* RESULT
*    #True if Animation is looped
* EXAMPLE
*   looped.l = IrrAnimSpriteGetLoop(*animspritenode)
* HISTORY
*   Added as Function in IrrlichtWrapper 1.05 by M.Taupitz
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrAnimSpriteGetLoop(*animNode.l)
*/
STATIC_EXPORT bool DLL_EXPORT IrrAnimSpriteGetLoop(TAnimSpriteSceneNode* node)
{
    return node->getLoop();
}

/****f* AnimSprite/IrrAnimSpriteResetLoop
* NAME
*    IrrAnimSpriteResetLoop - reset animation
* SYNOPSIS
*    IrrAnimSpriteResetLoop(*animNode.l)
* FUNCTION
*    Resets the Animation to the first Frame if Forward playing,
*    or to the last frame if playing Backward.
* INPUTS
*   *animNode.l - a valid pointer to a AnimSpriteSceneNode (created before with IrrAddAnimSprite())
* RESULT
*   nothing
* EXAMPLE
*   IrrAnimSpriteResetLoop(*animspritenode)
* HISTORY
*   Added as Function in IrrlichtWrapper 1.05 by M.Taupitz
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrAnimSpriteResetLoop(*animNode.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrAnimSpriteResetLoop(TAnimSpriteSceneNode* node)
{
    node->resetLoop();
}

/****f* AnimSprite/IrrAnimSpriteSetFrame
* NAME
*    IrrAnimSpriteSetFrame - set animation to a frame
* SYNOPSIS
*    IrrAnimSpriteSetFrame(*animNode.l, frame.l)
* FUNCTION
*    Set animation to a frame
* INPUTS
*   *animNode.l - a valid pointer to a AnimSpriteSceneNode (created before with IrrAddAnimSprite())
*   frame.l     - FrameNumber
* RESULT
*   nothing
* EXAMPLE
*   IrrAnimSpriteSetFrame(*animspritenode,2)
* HISTORY
*   Added as Function in IrrlichtWrapper 1.05 by M.Taupitz
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrAnimSpriteSetFrame(*animNode.l, frame.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrAnimSpriteSetFrame(TAnimSpriteSceneNode* node, int n)
{
    node->setFrame(n);
}

/****f* AnimSprite/IrrAnimSpriteSetStartEndFrame
* NAME
*    IrrAnimSpriteSetStartEndFrame - Define the Range of the Animation
* SYNOPSIS
*    IrrAnimSpriteSetStartEndFrame(*animNode.l, StartFrame.l, EndFrame.l)
* FUNCTION
*    Define the Range of the Animation
* INPUTS
*   *animNode.l   - a valid pointer to a AnimSpriteSceneNode (created before with IrrAddAnimSprite())
*   StartFrame.l  - Frame to Start
*   EndFrame.l    - Frame to End
* RESULT
*   nothing
* EXAMPLE
*   IrrAnimSpriteSetStartEndFrame(*animspritenode,2)
* HISTORY
*   Added as Function in IrrlichtWrapper 1.05 by M.Taupitz
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrAnimSpriteSetStartEndFrame(*animNode.l, StartFrame.l, EndFrame.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrAnimSpriteSetStartEndFrame(TAnimSpriteSceneNode* node, s32 st, s32 ed)
{
    node->setStartEndFrame(st,ed);
}

/****f* AnimSprite/IrrAnimSpriteGetMaxFrames
* NAME
*    IrrAnimSpriteGetMaxFrames - Get Number of Frames
* SYNOPSIS
*    frames.l = IrrAnimSpriteGetMaxFrames(*animNode.l)
* FUNCTION
*    Get Number of Frames
* INPUTS
*   *animNode.l   - a valid pointer to a AnimSpriteSceneNode (created before with IrrAddAnimSprite())
* RESULT
*   number of frames found
* EXAMPLE
*   frames.l = IrrAnimSpriteGetMaxFrames(*animspritenode,2)
* HISTORY
*   Added as Function in IrrlichtWrapper 1.05 by M.Taupitz
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrAnimSpriteGetMaxFrames(*animNode.l)
*/
STATIC_EXPORT int DLL_EXPORT IrrAnimSpriteGetMaxFrames(TAnimSpriteSceneNode* node)
{
    return node->GetMaxFrames();
}

/****f* AnimSprite/IrrAnimSpriteSetPosition
* NAME
*    IrrAnimSpriteSetPosition - Set the Position of the Anim-Sprite
* SYNOPSIS
*    IrrAnimSpriteSetPosition(*animNode.l, x.l, y.l, x2.l, y2.l)
* FUNCTION
*    Set the Position of the Anim-Sprite
* INPUTS
*   *animNode.l   - a valid pointer to a AnimSpriteSceneNode (created before with IrrAddAnimSprite())
*   x.l,y.l,x2.l,y2.l  - rect of the position
* RESULT
*   nothing
* EXAMPLE
*   IrrAnimSpriteSetPosition(*animspritenode,10,10, 200,200)
* HISTORY
*   Added as Function in IrrlichtWrapper 1.05 by M.Taupitz
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrAnimSpriteSetPosition(*animNode.l, x.l, y.l, x2.l, y2.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrAnimSpriteSetPosition(TAnimSpriteSceneNode* node, s32 x, s32 y,s32 x2,s32 y2)
{
    node->setPosition(core::rect<s32>(x,y,x2,y2));
}

/****f* AnimSprite/IrrAnimSpriteSetScaleToRect
* NAME
*    IrrAnimSpriteSetScaleToRect - Set the Scaling/Rect of the Anim-Sprite
* SYNOPSIS
*    IrrAnimSpriteSetScaleToRect(*animNode.l, x.l, y.l, x2.l, y2.l)
* FUNCTION
*    Set the Scaling/Rect of the Anim-Sprite
* INPUTS
*   *animNode.l   - a valid pointer to a AnimSpriteSceneNode (created before with IrrAddAnimSprite())
*   x.l,y.l,x2.l,y2.l  - rect of the position
* RESULT
*   nothing
* EXAMPLE
*   IrrAnimSpriteSetScaleToRect(*animspritenode,10,10, 200,200)
* HISTORY
*   Added as Function in IrrlichtWrapper 1.05 by M.Taupitz
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrAnimSpriteSetScaleToRect(*animNode.l, x.l, y.l, x2.l, y2.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrAnimSpriteSetScaleToRect(TAnimSpriteSceneNode* node, s32 x, s32 y,s32 x2,s32 y2)
{
    node->setScaleToRect(core::rect<s32>(x,y,x2,y2));
}

/****f* AnimSprite/IrrAnimSpriteGetSize
* NAME
*    IrrAnimSpriteGetSize - Get the Size of the Sprite
* SYNOPSIS
*    IrrAnimSpriteGetSize(*animNode.l, *width.l, *height.l)
* FUNCTION
*    Set the Scaling/Rect of the Anim-Sprite
* INPUTS
*   *animNode.l   - a valid pointer to a AnimSpriteSceneNode (created before with IrrAddAnimSprite())
*   *width.l, *height.l - in this, the size will be returned
* RESULT
*   nothing
* EXAMPLE
*   IrrAnimSpriteGetSize(*animspritenode,@width.l, @height.l)
* HISTORY
*   Added as Function in IrrlichtWrapper 1.05 by M.Taupitz
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrAnimSpriteGetSize(*animNode.l, *width.l, *height.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrAnimSpriteGetSize(TAnimSpriteSceneNode* node, s32 &width, s32 &height)
{
    dimension2d<s32> size = node->getSize();
    width = size.Width;
    height = size.Height;
}

/****f* AnimSprite/IrrAnimSpriteDraw
* NAME
*    IrrAnimSpriteDraw - Draw the Sprite at the Position and Scale
* SYNOPSIS
*    IrrAnimSpriteDraw(*animNode.l, x.l, y.l, x2.l, y2.l)
* FUNCTION
*    Draw the Sprite at the Position and Scale
* INPUTS
*   *animNode.l   - a valid pointer to a AnimSpriteSceneNode (created before with IrrAddAnimSprite())
*   x.l,y.l,x2.l,y2.l  - rect of the position/stretcing on the Screen
* RESULT
*   nothing
* EXAMPLE
*   IrrAnimSpriteDraw(*animspritenode,10,10,200,200)
* HISTORY
*   Added as Function in IrrlichtWrapper 1.05 by M.Taupitz
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrAnimSpriteDraw(*animNode.l, x.l, y.l, x2.l, y2.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrAnimSpriteDraw(scene::TAnimSpriteSceneNode *Sprite,  s32 x, s32 y,s32 x2,s32 y2)
{
	if(Sprite)
	{
		Sprite->Update();
		Sprite->setScaleToRect(core::rect<s32>(x,y,x2,y2));
		Sprite->setPosition(core::rect<s32>(x,y,x2,y2));
		Sprite->render();
	}
}

/****f* AnimSprite/IrrAnimSpriteSetColor
* NAME
*    IrrAnimSpriteSetColor - Set the Color
* SYNOPSIS
*    IrrAnimSpriteSetColor(*animNode.l, alpha.l, r.l, g.l, b.l)
* FUNCTION
*   Set the Color of the SDprite. This could be very usefull for some
*   Effects. If the Material-Type is #IRR_EMT_TRANMSPARENT_ADD_COLOR, you can
*   use this values (also alsha) to get some coloring/alpha effects.
* INPUTS
*   *animNode.l   - a valid pointer to a AnimSpriteSceneNode (created before with IrrAddAnimSprite())
*   alpha.l,r.l,g.l,b.l - Color of the Sprite
* RESULT
*   nothing
* EXAMPLE
*   IrrAnimSpriteSetColor(*animspritenode,128,255,255,255)
* HISTORY
*   Added as Function in IrrlichtWrapper 1.05 by M.Taupitz
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrAnimSpriteSetColor(*animNode.l, alpha.l, r.l, g.l, b.l)
*/

STATIC_EXPORT void DLL_EXPORT IrrAnimSpriteSetColor(TAnimSpriteSceneNode* node, s32 alpha, s32 red,s32 green,s32 blue )
{
    node->setColor(SColor(alpha,red,green,blue));
}


/* ***f* AnimSprite/IrrAnimSpriteChangeAlpha
* NAME
*    IrrAnimSpriteChangeAlpha - Set the Color
* SYNOPSIS
*    IrrAnimSpriteChangeAlpha(*animNode.l, alpha.b)
* FUNCTION
*   This Changes the Alpha-Channel of the Texture !
*   You can use it if you need transprency for a Sprite (maybe fadein...)
* INPUTS
*   *animNode.l   - a valid pointer to a AnimSpriteSceneNode (created before with IrrAddAnimSprite())
*   alpha.b       - Alpha-Value (0-255)
* RESULT
*   nothing
* EXAMPLE
*   IrrAnimSpriteChangeAlpha(*animspritenode,128)
* NOTES
*   It is important to know, that this functions is working in memory, and
*   walks through the whole texture to change the alpha !
*   So need it wise, and not for huge textures !
* HISTORY
*   Added as Function in IrrlichtWrapper 1.05 by M.Taupitz
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrAnimSpriteChangeAlpha(*animNode.l, alpha.b)
*/
/*
STATIC_EXPORT void DLL_EXPORT IrrAnimSpriteChangeAlpha(TAnimSpriteSceneNode* node, u8 alpha)
{
//    node->changeAlpha(alpha);
}
*/



/* ////////////////////////////////////////////////////////////////////////////
all of the above functions are declared as C functions and are exposed without
any mangled names
*/
}
