external "nameless" enums

About Monkey 2 Forums Monkey 2 Programming Help external "nameless" enums

This topic contains 4 replies, has 2 voices, and was last updated by  Danilo 2 years, 7 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #3919

    abakobo
    Participant

    I’ve encountered that type of “nameless” enum in an external class

    [/crayon]

    I can change flags by doing the bit additions myself and setting flag to 1,2,4,8,16 if i want only one flag to be “on” or adding any of these to get several ones.
    But I’ll have a “expecting identifier” if I try to declare nameless enum:

    [/crayon]

    But I’d like to implement it using the e_shapebit, e_xxxxxx enums. For it to be looking like the original.
    Will I have to implement a new enum with some name or can I use as it is?(and how).

    thx

    #3922

    Danilo
    Participant

    Try something like:

    or:

    If the C++ class ‘b2Draw’ is within a namespace, you probably need
    to use the full name-qualifier, like:

    #3952

    Danilo
    Participant

    Did it help you, and is it working now?

    #3953

    abakobo
    Participant

    Just tried it..

    first suggestion works if I use:
    b2Draw_ext.SetFlags(b2Draw.e_shapeBit | b2Draw.e_jointBit) for example
    or
    b2Draw_ext.SetFlags(b2Draw_ext.e_shapeBit | b2Draw_ext.e_jointBit)

    just e_shapeBit alone won’t work but it’s sufficient for me. May be work on that a bit more but if all goes well like that I’ll keep it so.

    thanks!

    #3957

    Danilo
    Participant

    If you want to just use the e_*** constants without the class name,
    you could add them additionally to Extern section – outside of a class.

    Now you should be able to use e_shapeBit|e_jointBit etc.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.