how can i create a "enum Plane" type object having PlaneYZ value?
by Ahsan Muzaheed · in Torque 3D Professional · 09/15/2012 (3:57 am) · 5 replies
in
Torque 3D 1.2EnginesourcegfxgfxDrawUtil.h
under GFXDrawUtil namespace there is:
i was trying to instantiate it like this:
GFXDrawUtil::Plane p2=GFXDrawUtil::Plane.PlaneYZ;
but it always shows:
left of '.PlaneYZ' must have class/struct/union
sorry.
from my small c++ knowledge i am not finding any error.
how can i create a "enum Plane" type object having PlaneYZ value?
Torque 3D 1.2EnginesourcegfxgfxDrawUtil.h
under GFXDrawUtil namespace there is:
enum Plane
{
PlaneXY,
PlaneXZ,
PlaneYZ
};i was trying to instantiate it like this:
GFXDrawUtil::Plane p2=GFXDrawUtil::Plane.PlaneYZ;
but it always shows:
left of '.PlaneYZ' must have class/struct/union
sorry.
from my small c++ knowledge i am not finding any error.
how can i create a "enum Plane" type object having PlaneYZ value?
About the author
Torque 3D enthusiastic since 2010.Have been working in several T3D projects besides of Unreal Engine 4 and Unity 3D. NEED a hand with your project? SHoot me a mail. http://www.garagegames.com/community/forums /viewthread/138437/
#2
i am aware about enum and it's usage.
i just cannot figure it out
"how to make an "enum Plane" type object in torque 3d's c++ source".
i have used other type enum in c++.
but this one always show
"left of '.PlaneYZ' must have class/struct/union".
why?
i also have tried to use PlaneYZ directly:
"GFXDrawUtil::Plane.PlaneYZ"
but same error.
from my knowledge,we can use enum members directly.
so why i cannot use this enum Plane's member.
anybody?
09/15/2012 (9:59 am)
bloodKnight,i am aware about enum and it's usage.
i just cannot figure it out
"how to make an "enum Plane" type object in torque 3d's c++ source".
i have used other type enum in c++.
but this one always show
"left of '.PlaneYZ' must have class/struct/union".
why?
i also have tried to use PlaneYZ directly:
"GFXDrawUtil::Plane.PlaneYZ"
but same error.
from my knowledge,we can use enum members directly.
so why i cannot use this enum Plane's member.
anybody?
#3
thanks to Tim-MGT on IRC.
GFXDrawUtil::PlaneXY did the work.
and bloodKnight,sorry.
i should have tried your PlaneYZ with appropriate namespace.
09/15/2012 (10:20 am)
solved.thanks to Tim-MGT on IRC.
GFXDrawUtil::PlaneXY did the work.
and bloodKnight,sorry.
i should have tried your PlaneYZ with appropriate namespace.
#4
09/15/2012 (11:46 am)
Do you still have to name the enum?
#5
no.i am directly using enum member now.
as enum member are actually integer value so i was thinking if we could use integer in place of enum member.but c++ does not allow it.why?
still both are integer.is not it?
09/15/2012 (12:21 pm)
"Do you still have to name the enum?"no.i am directly using enum member now.
as enum member are actually integer value so i was thinking if we could use integer in place of enum member.but c++ does not allow it.why?
still both are integer.is not it?
Torque 3D Owner Bloodknight
Bloodknight Studios
enum Plane
{
PlaneXY,
PlaneXZ,
PlaneYZ
}
is the same as
#define PlaneXY 0
#define PlaneXZ 1
#define PlaneYZ 2
Disclaimer, ive never used #defines inside a namespace, so i dont actually know what they would do, this is just a conceptual explanation :)
oopsie after disclaimer: seems #defines are global in scope regardless of where they are used, there ya go learning every day, so much for the old dogs idiom