Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


- - - - -

Enum to Integer?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 bollµ   Members   -  Reputation: 354

Like
0Likes
Like

Posted 22 February 2013 - 08:01 AM

Hi all!

 

Is there any way to typecast an Enum to a raw integer in angelScript? I've tried using C's typecast syntax and the cast operator. neither worked :/.  Some more suggestions?  

 

thanks

~Bollu 

 

 


a WIP 2d game engine: https://code.google.com/p/modulusengine/

English is not my first language, so do feel free to correct me :)


Sponsor:

#2 Andreas Jonsson   Moderators   -  Reputation: 3452

Like
0Likes
Like

Posted 22 February 2013 - 02:07 PM

The enums are implicitly converted to integers by the compiler, but if you want to explicitly do the conversion you may use the C++ style cast (not C style).

 

enum E { VALUE = 1 }
int a = int(VALUE);

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




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS