Main Menu


Sponsored Links

  


  
  

wcm.h

// Main Web Cartoon Maker include file
// You do not need to include this file in your project
// This file is included automatically

// NULL constant
#define NULL 0

// wav file mixing constants
#define MIXMODE_MIX             100
#define MIXMODE_REPLACE         200
#define MIXMODE_REPLACEFADE     300
#define MIXMODE_DAMP            400
#define MIXMODE_DAMPFADE        500

// class for working with string, almost full replacement for native arrays of characters
class string
{
	friend string IntToString ( int iFrom );
	friend string DoubleToString ( double dFrom );
	friend string CharToString ( char cFrom );
	
	protected:
		
		char *pBuf;
		
		void Init ( const char *pFrom );
		
		bool IndexCheck ( int i );
		
	public:
		
		string ();
		string ( const char *pFrom );
		string ( const string &From );
		string ( char cFrom );
		string ( int iFrom );
		string ( bool bFrom );
		string ( double dFrom );
		~string ();
		
		string& operator= ( const char *pFrom );
		string& operator= ( const string &From );
		string operator+ ( const string &From );
		string operator+ ( const char *pFrom );
		bool operator== ( const string &sWith );

		bool operator== ( const char *pWith );
		char& operator[] ( int i );
		const char& operator[] ( int i );
		operator const char* ();

};

// additional string operators
//string operator+ ( const char* pFirst, const string &Second );
string operator+ ( const char* pFirst, const char* pSecond );

string operator+ ( const char* pFirst, int iSecond );

string operator+ ( const char* pFirst, double dSecond );

string operator+ ( const char* pFirst, char cSecond );

string operator+ ( const char* pFirst, bool bSecond );

string operator+ ( int iFirst, const char* pSecond );

string operator+ ( double dFirst, const char* pSecond );

string operator+ ( char cFirst, const char* pSecond );

string operator+ ( bool bFirst, const char* pSecond );

bool operator== ( const char* pFirst, const char* pSecond );

// string conversion and manipulation routines
string IntToString ( int iFrom );
string DoubleToString ( double dFrom );
string CharToString ( char cFrom );
int StringToInt ( const string &sFrom );
int StringToDouble ( const string &sFrom );
int StrLen ( const string &sWhat );
string UpperCase ( const string &sWhat );
string LowerCase ( const string &sWhat );

// math functions
double DegreesToRadians ( double dDegrees );
double RadiansToDegrees ( double dRadians );
double Sin ( double dAngle );
double Cos ( double dAngle );
double Tan ( double dAngle );
double ASin ( double dSin );
double ACos ( double dCos );
double ATan ( double dTan );
double Pow ( double dX, double dN );
double Exp ( double dX );
double Log ( double dX );
double Sqrt ( double dX );
double Rand ();
int GetUTCTime ();
int GetUTCHour ( int iTime = 0 );
int GetUTCMinute ( int iTime = 0 );
int GetUTCSecond ( int iTime = 0 );

// global functions
void Sleep ( double dTime );
void SetTime ( double dTime );
double GetTime ();

void SetMovieSize ( int iWidth, int iHeight );

void SetCameraX ( double dX );
void SetCameraY ( double dY );
void SetCameraPos ( double dX, double dY );
void SetCameraAngle ( double dAngle );
void SetCameraZoom ( double dZoom );

double GetCameraX ();
double GetCameraY ();
double GetCameraAngle ();
double GetCameraZoom ();

void ChangeCameraX ( double dX, double dDuration );
void ChangeCameraY ( double dY, double dDuration );
void ChangeCameraPos ( double dX, double dY, double dDuration );
void ChangeCameraAngle ( double dAngle, double dDuration );
void ChangeCameraZoom ( double dZoom, double dDuration );

// synchronization macros
double _wcm_dLastLime = 0;
#define THIS_TIME _wcm_dLastLime = GetTime ();
#define SAME_TIME SetTime ( _wcm_dLastLime );

// public interface for all objects in scene
class IObject
{
	protected:

		// this is an internal object name which is assigned automatically
		string sName;

	public:

		// default constructor
		IObject ();

		void BringForward ();

		void SendBackward ();

		// change object's position and transformation in current scene at current time
        	void SetVisible ( bool bVisible = true );
		void SetX ( double dX );
		void ChangeX ( double dX, double dDuration );
		void SetY ( double dY );
		void ChangeY ( double dY, double dDuration );
		void SetPos ( double dX, double dY );
		void ChangePos ( double dX, double dY, double dDuration );
		void SetAngle ( double dAngle );
		void ChangeAngle ( double dAngle, double dDuration );
		void SetXScale ( double dXScale );
		void ChangeXScale ( double dXScale, double dDuration );
		void SetYScale ( double dYScale );
		void ChangeYScale ( double dYScale, double dDuration );
		void SetScale ( double dScale );
		void ChangeScale ( double dScale, double dDuration );
		void SetTransparency ( double dTransp );
		void ChangeTransparency ( double dTransp, double dDuration );
		void SetMirror ( bool bMirror );

		// obtain object's position and transformation in current scene at current time
		bool GetVisible ();
		double GetX ();
		double GetY ();
		double GetAngle ();
		double GetXScale ();
		double GetYScale ();
		double GetTransparency ();
		bool GetMirror ();
};

// image object in scene
class Image : public IObject
{
	public:

		// create an image object in current scene
		Image ( const string &sFile );

		Image ();

		string GetImage ();

		void SetImage ( const string &sImage );

};

// text object in scene
class Text : public IObject
{
	public:

		// create a text object in current scene
		Text ( const string &sText );
		Text ( int iVal );
		Text ( double dVal );
		Text ( char cVal );
		Text ();

		// set text object parameters in current scene at current time
		void SetText ( const string &sText );
		void SetFont ( const string &sFont );
		void SetStyle ( const string &sStyle );
		void SetColor ( const string &sColor );
		void SetSize ( int iSize );
		void ChangeSize ( int iSize, double dDuration );

		// obtain text object parameters in current scene at current time
		string GetText ();
		string GetFont ();
		string GetStyle ();
		string GetColor ();
		int GetSize ();
};

// part of character object in scene
class Part
{
	protected:

		// these are internal names which are assigned automatically
		string sCharName;
		string sPartName;
		string sParentName;

		// this is an internal method which uses internal names assigned automatically
		void RegisterParent ( const string &sParent );

	public:

		// create a part which must be registered later using character's method Register		
		Part ();

		// register an additional decal
		void RegisterDecal ( const string &sDecalName, const string &sDecalImage );

		// set or change a parent part
		void RegisterParent ( const Part &Parent );

		// change part's position and transformation in current scene at current time
		void SetVisible ( bool bVisible );
		void SetXShift ( double dX );
		void ChangeXShift ( double dX, double dDuration );
		void SetYShift ( double dY );
		void ChangeYShift ( double dY, double dDuration );
		void SetShift ( double dX, double dY );
		void ChangeShift ( double dX, double dY, double dDuration );
		void SetAngle ( double dAngle );
		void ChangeAngle ( double dAngle, double dDuration );
		void SetXScale ( double dXScale );
		void ChangeXScale ( double dXScale, double dDuration );
		void SetYScale ( double dYScale );
		void ChangeYScale ( double dYScale, double dDuration );
		void SetScale ( double dScale );
		void ChangeScale ( double dScale, double dDuration );
		void SetDecal ( const string &sDecal );

		// obtain part's position and transformation in current scene at current time
		bool GetVisible ();
		double GetXShift ();
		double GetYShift ();
		double GetAngle ();
		double GetXScale ();
		double GetYScale ();
		string GetDecal ();
};

// public interface for general character object in scene
class ICharacter : public IObject
{
	public:

		// default constructor
		ICharacter ();

		// character and all the parts must be registered in derived character's constructor
		void Register ( int iWidth, int iHeight, double dX0, double dY0 );
		void RegisterPart ( Part &PartToReg, const string &sDefaultDecalImage, double dX, double dY, double dX0, double dY0, const Part *pParent = NULL );
		void RegisterPart ( Part &PartToReg, double dX, double dY, double dX0 = 0, double dY0 = 0, const Part *pParent = NULL );

		virtual void GoesTo ( double dX, double dY, double dDuration, double dStepDuration = 1 );
};

class ISpeakableCharacter : public ICharacter
{
	public:
		
		// it should have mouth
		Part Mouth;

		// should only be used in constructor or immediately after declaration
		void RegisterSpeech ( const string &sSAPIEngine, const string &sSAPIVoice, double dSAPISpeed = 0.5, double dSAPIPitch = 0.5, double dSAPIVolume = 1.0 );

		// main speech action
		virtual void Says ( const string &sText, double dVolume = 1, double dLipSpeed = 6 );

		ISpeakableCharacter ();

};

// public interface for general human character object in scene
class IHumanCharacter : public ISpeakableCharacter
{
	public:

		// typical human parts
		Part RightArm;
		Part RightLeg;
		Part LeftLeg;
		Part Body;
		Part Head;
		Part RightEye;
		Part LeftEye;
		Part LeftArm;

		// default constructor set parents for each part
		IHumanCharacter ();

		// some human specific actions
		virtual void WinksLeft ( double dDuration = 0.5 );
		virtual void WinksRight ( double dDuration = 0.5 );
		virtual void Winks ( double dDuration = 0.5 );
		virtual void GoesTo ( double dX, double dY, double dDuration, double dStepDuration = 1 );
};

// public interface for general human character object in scene, view from left side
class IHumanCharacterSideView : public IHumanCharacter
{
	public:
		
		// default constructor
		IHumanCharacterSideView ();

		// some side view specific actions
		virtual void GoesTo ( double dX, double dY, double dDuration, double dStepDuration = 1 );
};

// public interface for four legged animals
class IFourLeggedCharacter : public ISpeakableCharacter
{
	public:

		// typical animal parts
		Part RightRearLeg;
		Part RightFrontLeg;
		Part LeftRearLeg;
		Part LeftFrontLeg;
		Part Body;
		Part Head;
		Part RightEye;
		Part LeftEye;

		// default constructor set parents for each part
		IFourLeggedCharacter ();

		// some animal specific actions
		virtual void WinksLeft ( double dDuration = 0.5 );
		virtual void WinksRight ( double dDuration = 0.5 );
		virtual void Winks ( double dDuration = 0.5 );
		virtual void GoesTo ( double dX, double dY, double dDuration, double dStepDuration = 1 );
};

// some debugging functions
void ShowText ( const string &sText, double dDuration = 1, double dX = 0, double dY = 0, int iSize = 50, const string &sColor = "FFFF00", const string &sStyle = "" );

alien.h

// Web Cartoon Maker character include file
// You should include this file if you want to use the character
// The character was created by Web Cartoon Maker

class Alien : public IHumanCharacterSideView
{
	public:

		// additional parts
		Part Nose;

		// default constructor to register character, parts and decals
		Alien ();
};

astronaut.h

// Web Cartoon Maker character include file
// You should include this file if you want to use the character
// The character was created by Web Cartoon Maker

class Astronaut : public IHumanCharacterSideView
{
	public:

		// additional parts
		Part Hose;
		Part BackPack;
		Part Nose;

		// default constructor to register character, parts and decals
		Astronaut ();
};

bear.h

// Web Cartoon Maker character include file
// The character was created by Web Cartoon Maker

class Bear : public IHumanCharacterSideView
{
	public:

		// additional parts
		Part RightEar;
		Part LeftEar;

		// default constructor to register character, parts and decals
		Bear ();
};

boy.h

// Web Cartoon Maker character include file
// You should include this file if you want to use the character
// The character is based on public domain image from openclipart.org
// Original file name is: nicubunu_Comic_characters_Boy.svg

class Boy : public IHumanCharacterSideView
{
	public:
		
		// default constructor to register character, parts and decals
		Boy ();
};

cat.h

// Web Cartoon Maker character include file
// You should include this file if you want to use the character
// The character is based on public domain images from openclipart.org

class Cat : public IFourLeggedCharacter
{
	public:

		// additional parts
		Part Tail;
		Part RightEar;
		Part LeftEar;
		Part RightWhiskers;
		Part LeftWhiskers;

		// default constructor to register character, parts and decals
		Cat ();
};

cheerleader.h

// Web Cartoon Maker character include file
// The character was created by Web Cartoon Maker

class Cheerleader : public IHumanCharacterSideView
{
	public:

		// default constructor to register character, parts and decals
		Cheerleader ();
};

crow.h

// Web Cartoon Maker character include file
// The character was created by Web Cartoon Maker

class Crow : public IHumanCharacterSideView
{
	public:

		// additional parts
		Part Tail;

		// default constructor to register character, parts and decals
		Crow ();
};

dog.h

// Web Cartoon Maker character include file
// You should include this file if you want to use the character
// The character is based on public domain images from openclipart.org

class Dog : public IFourLeggedCharacter
{
	public:

		// additional parts
		Part Tail;
		Part RightEar;
		Part LeftEar;

		// default constructor to register character, parts and decals
		Dog ();
};

emo.h

// Web Cartoon Maker character include file
// You should include this file if you want to use the character
// The character is based on public domain image from openclipart.org
// Original file name is: nicubunu_Comic_characters_Emo.svg

class Emo : public IHumanCharacterSideView
{
	public:

		// default constructor to register character, parts and decals
		Emo ();
};

fox.h

// Web Cartoon Maker character include file
// The character was created by Web Cartoon Maker

class Fox : public IHumanCharacterSideView
{
	public:

		// additional parts
		Part Tail;

		// default constructor to register character, parts and decals
		Fox ();
};

girl.h

// Web Cartoon Maker character include file
// You should include this file if you want to use the character
// The character is based on public domain image from openclipart.org
// Original file name is: nicubunu_Comic_characters_Girl.svg

class Girl : public IHumanCharacterSideView
{
	public:

		// default constructor to register character, parts and decals
		Girl ();
};

grandma.h

// Web Cartoon Maker character include file
// You should include this file if you want to use the character
// The character was created by Web Cartoon Maker
// Parts of different images from openclipart.org were used

class Grandma : public IHumanCharacterSideView
{
	public:

		// default constructor to register character, parts and decals
		Grandma ();
};

grandpa.h

// Web Cartoon Maker character include file
// You should include this file if you want to use the character
// The character is based on public domain image from openclipart.org
// Original file name is: nicubunu_Comic_characters_Older.svg

class Grandpa : public IHumanCharacterSideView
{
	public:

		// default constructor to register character, parts and decals
		Grandpa ();
};

king.h

// Web Cartoon Maker character include file
// The character was created by Web Cartoon Maker

class King : public IHumanCharacterSideView
{
	public:

		// additional parts
		Part Crown;
		Part Mustage;
		Part Nose;

		// default constructor to register character, parts and decals
		King ();
};

kolobok.h

// Web Cartoon Maker character include file
// The character was created by Web Cartoon Maker

class Kolobok : public IHumanCharacterSideView
{
	public:

		// default constructor to register character, parts and decals
		Kolobok ();
};

konrad.h

// Web Cartoon Maker character include file
// You should include this file if you want to use the character
// The character is based on public domain image from openclipart.org
// Original file name is: Peileppe_Konrad_Chibi.svg

class Konrad : public IHumanCharacterSideView
{
	public:

		// additional parts
		Part Cape;

		// default constructor to register character, parts and decals
		Konrad ();
};

leprechaun.h

// Web Cartoon Maker character include file
// You should include this file if you want to use the character
// The character was created by Web Cartoon Maker

class Leprechaun : public IHumanCharacterSideView
{
	public:

		// default constructor to register character, parts and decals
		Leprechaun ();
};

man.h

// Web Cartoon Maker character include file
// You should include this file if you want to use the character
// The character is based on public domain image from openclipart.org
// Original file name is: nicubunu_Comic_characters_Businessman.svg

class Man : public IHumanCharacterSideView
{
	public:

		// additional parts
		Part Hat;

		// default constructor to register character, parts and decals
		Man ();
};

militioner.h

// Web Cartoon Maker character include file
// You should include this file if you want to use the character
// The character was created by Web Cartoon Maker

class Militioner : public IHumanCharacterSideView
{
	public:

		// additional parts
		Part Nose;

		// default constructor to register character, parts and decals
		Militioner ();
};

nurse.h

// Web Cartoon Maker character include file
// You should include this file if you want to use the character
// The character is based on public domain image from openclipart.org
// Original file name is: buggi_nurse.svg

class Nurse : public IHumanCharacterSideView
{
	public:

		// additional parts
		Part Glasses;

		// default constructor to register character, parts and decals
		Nurse ();
};

pirate.h

// Web Cartoon Maker character include file
// You should include this file if you want to use the character
// The character is based on public domain image from openclipart.org
// Original file name is: nicubunu_Comic_characters_Pirate.svg

class Pirate : public IHumanCharacterSideView
{
	public:

		// additional parts
		Part RightEyePatch;
		Part Hat;

		// default constructor to register character, parts and decals
		Pirate ();
};

policeman.h

// Web Cartoon Maker character include file
// You should include this file if you want to use the character
// The character was created by Web Cartoon Maker

class Policeman : public IHumanCharacterSideView
{
	public:

		// additional parts
		Part Nose;
		Part Hat;

		// default constructor to register character, parts and decals
		Policeman ();
};

princess.h

// Web Cartoon Maker character include file
// The character was created by Web Cartoon Maker

class Princess : public IHumanCharacterSideView
{
	public:

		// additional parts
		Part Collar;

		// default constructor to register character, parts and decals
		Princess ();
};

queen.h

// Web Cartoon Maker character include file
// The character was created by Web Cartoon Maker

class Queen : public IHumanCharacterSideView
{
	public:

		// additional parts
		Part Nose;
		Part Crown;

		// default constructor to register character, parts and decals
		Queen ();
};

rabbit.h

// Web Cartoon Maker character include file
// The character was created by Web Cartoon Maker

class Rabbit : public IHumanCharacterSideView
{
	public:

		// additional parts
		Part RightEar;
		Part LeftEar;

		// default constructor to register character, parts and decals
		Rabbit ();
};

santa.h

// Web Cartoon Maker character include file
// You should include this file if you want to use the character
// The character is based on public domain image from openclipart.org
// Original file name is: nicubunu_Comic_characters_Santa.svg

class Santa : public IHumanCharacterSideView
{
	public:

		// additional parts
		Part Hat;

		// default constructor to register character, parts and decals
		Santa ();
};

singer.h

class Singer : public IHumanCharacter
{
	public:

		// additional parts
		Part GuitarBack;
		Part HairBack;
		Part LeftShoeBack;
		Part LeftShin;
		Part LeftFoot;
		Part LeftShoe;
		Part RightShoeBack;
		Part RightShin;
		Part RightFoot;
		Part RightShoe;
		Part Neck;
		Part Dress;
		Part LeftEar;
		Part RightEar;
		Part LeftEyeBack;
		Part LeftEyeball;
		Part LeftEyebrow;
		Part RightEyeBack;
		Part RightEyeball;
		Part RightEyebrow;
		Part Nose;
		Part Hair;
		Part LeftForearm;
		Part LeftHand;
		Part Guitar;
		Part RightForearm;
		Part RightHand;

		// default constructor to register character, parts and decals
		Singer ();
		
		void RightArmUp ();

		void RightArmDown ();
		
		void LeftArmChord1 ();
		
		void LeftArmChord2 ();
		
		void PlayChord ( double dDuration );
};

sorcerer.h

// Web Cartoon Maker character include file
// You should include this file if you want to use the character
// The character is based on public domain image from openclipart.org
// Original file name is: Peileppe_Sorcerer_Chibi.svg

class Sorcerer : public IHumanCharacterSideView
{
	public:

		// additional parts
		Part Back;
		Part Hair;

		// default constructor to register character, parts and decals
		Sorcerer ();
};

viking.h

// Web Cartoon Maker character include file
// You should include this file if you want to use the character
// The character is based on public domain image from openclipart.org
// Original file name is: 1300874944.svg

class Viking : public IHumanCharacterSideView
{
	public:

		// additional parts
		Part Nose;
		Part Helmet;
		Part Axe;

		// default constructor to register character, parts and decals
		Viking ();
};

witch.h

// Web Cartoon Maker character include file
// You should include this file if you want to use the character
// The character was created by Web Cartoon Maker
// Parts of different images from openclipart.org were used

class Witch : public IHumanCharacterSideView
{
	public:

		// additional parts
		Part Nose;

		// default constructor to register character, parts and decals
		Witch ();
};

wolf.h

// Web Cartoon Maker character include file
// The character was created by Web Cartoon Maker

class Wolf : public IHumanCharacterSideView
{
	public:

		// additional parts
		Part Tail;
		Part RightEar;
		Part LeftEar;
		Part Hair;

		// default constructor to register character, parts and decals
		Wolf ();
};

woman.h

// Web Cartoon Maker character include file
// You should include this file if you want to use the character
// The character is based on public domain image from openclipart.org
// Original file name is: nicubunu_Comic_characters_Blonde.svg

class Woman : public IHumanCharacterSideView
{
	public:
	
		// additional part is required because the hair suppose to be on top of left eye
		Part Hair;
		
		// default constructor to register character, parts and decals
		Woman ();
};
  
News

New Tales Animator Video by Alan Sturgess

Alan Sturgess shared an excellent video he made using Tales Animator! You can still download Tales Animator here. Unfortunately it is only available for Wi

...

Simple Online Character Designer

There is a prototype of simple online character designer available HERE. It is only a prototype, it does not contain many pieces yet but it can already generat

...

Book is updated

Now our book "Web Cartoon Maker: A Fun Way to Learn C++" is fully in synch with WCM 1.5! It is available for download and online reading HERE.

...

Web Cartoon Maker 1.5 is here!

Web Cartoon Maker 1.5 is finally here! You can download it HERE! Here is what was updated in version 1.5: Web Cartoon Maker Desktop Edition is now fully standal

...

read more news...


Poll