Advertisement

How to use enums from c++

Started by April 03, 2005 09:48 AM
0 comments, last by WitchLord 19 years, 7 months ago
Hi I'm very new to AngelScript, and was wondering how I go about using enums from C++ in my scripts? Say I have:

// renderstates
enum RENDERSTATES
{
	RENDERSTATE_ZENABLE = 0,	// z-buffer toggle (use STATE)
	RENDERSTATE_ZWRITE,		// z-writing toggle (use STATE)
	RENDERSTATE_ZFUNC,		// z-function (see ZCMPFUNC)
	RENDERSTATE_CULLMODE,		// culling mode (see CULLMODES)
	RENDERSTATE_FILLMODE,		// polygon filling mode (see FILLMODES)
	RENDERSTATE_BACKGOUNDCOL,	//background filling colour (default is 0x00000000)

	RENDERSTATE_NOOF
};



How would I register those to angelscript? Thanks
It is not yet possible to register enums with the script library. It will be available in the future though, I just can't say when.

Until then you'll have to declare constants in the scripts. I suggest you do it by adding an extra script section that holds the constants to each script module you compile. That script section should then be defined by the application and not by the script writer.

See also: enums & constants.

Regards,
Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement