mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-18 06:55:48 +03:00
Changed the way to know if a GameObject is some type.
This commit is contained in:
@@ -229,6 +229,15 @@ namespace EE {
|
||||
typedef unsigned int eeUint;
|
||||
typedef signed int eeInt;
|
||||
|
||||
#if SOPHIST_has_64
|
||||
typedef SOPHIST_uint64 Uint64;
|
||||
typedef SOPHIST_int64 Int64;
|
||||
#else
|
||||
typedef SOPHIST_uint32 Uint64; // Fallback to a 32 bit int
|
||||
typedef SOPHIST_int32 Int64; // All the desktop platforms support 64bit ints, so this should not happend.
|
||||
#warning 64bit ints represented with 32bit ints because the compiler or platform doesnt support it.
|
||||
#endif
|
||||
|
||||
#define EE_PI 3.14159265358979323846
|
||||
#define EE_PI2 6.28318530717958647692
|
||||
const eeFloat EE_PI_180 = EE_PI / 180;
|
||||
|
||||
@@ -17,14 +17,6 @@ bool cGameObject::IsType( const Uint32& type ) {
|
||||
return type == Type();
|
||||
}
|
||||
|
||||
bool cGameObject::InheritsFrom( const Uint32& Type ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool cGameObject::IsTypeOrInheritsFrom( const Uint32& Type ) {
|
||||
return IsType( Type ) || InheritsFrom( Type );
|
||||
}
|
||||
|
||||
const Uint32& cGameObject::Flags() const {
|
||||
return mFlags;
|
||||
}
|
||||
|
||||
@@ -32,11 +32,7 @@ class EE_API cGameObject {
|
||||
|
||||
virtual Uint32 Type() const;
|
||||
|
||||
bool IsType( const Uint32& type );
|
||||
|
||||
virtual bool InheritsFrom( const Uint32& Type );
|
||||
|
||||
bool IsTypeOrInheritsFrom( const Uint32& Type );
|
||||
virtual bool IsType( const Uint32& type );
|
||||
|
||||
const Uint32& Flags() const;
|
||||
|
||||
|
||||
@@ -21,6 +21,10 @@ Uint32 cGameObjectShape::Type() const {
|
||||
return GAMEOBJECT_TYPE_SHAPE;
|
||||
}
|
||||
|
||||
bool cGameObjectShape::IsType( const Uint32& type ) {
|
||||
return ( Type() == type ) ? true : cGameObject::IsType( type );
|
||||
}
|
||||
|
||||
void cGameObjectShape::Draw() {
|
||||
if ( NULL != mShape ) {
|
||||
if ( mLayer->Map()->LightsEnabled() && mLayer->LightsEnabled() ) {
|
||||
|
||||
@@ -33,6 +33,8 @@ class EE_API cGameObjectShape : public cGameObject {
|
||||
|
||||
virtual Uint32 Type() const;
|
||||
|
||||
virtual bool IsType( const Uint32& type );
|
||||
|
||||
virtual Uint32 DataId();
|
||||
|
||||
virtual void DataId( Uint32 Id );
|
||||
|
||||
@@ -27,6 +27,10 @@ Uint32 cGameObjectShapeEx::Type() const {
|
||||
return GAMEOBJECT_TYPE_SHAPEEX;
|
||||
}
|
||||
|
||||
bool cGameObjectShapeEx::IsType( const Uint32& type ) {
|
||||
return ( Type() == type ) ? true : cGameObjectShape::IsType( type );
|
||||
}
|
||||
|
||||
void cGameObjectShapeEx::Draw() {
|
||||
if ( NULL != mShape ) {
|
||||
if ( mLayer->Map()->LightsEnabled() && mLayer->LightsEnabled() ) {
|
||||
|
||||
@@ -16,6 +16,8 @@ class EE_API cGameObjectShapeEx : public cGameObjectShape {
|
||||
|
||||
virtual Uint32 Type() const;
|
||||
|
||||
virtual bool IsType( const Uint32& type );
|
||||
|
||||
virtual void FlagSet( const Uint32& Flag );
|
||||
protected:
|
||||
EE_PRE_BLEND_FUNC mBlend;
|
||||
|
||||
@@ -23,6 +23,10 @@ Uint32 cGameObjectSprite::Type() const {
|
||||
return GAMEOBJECT_TYPE_SPRITE;
|
||||
}
|
||||
|
||||
bool cGameObjectSprite::IsType( const Uint32& type ) {
|
||||
return ( Type() == type ) ? true : cGameObject::IsType( type );
|
||||
}
|
||||
|
||||
void cGameObjectSprite::Draw() {
|
||||
if ( NULL != mSprite ) {
|
||||
mSprite->Angle( GetAngle() );
|
||||
|
||||
@@ -33,6 +33,8 @@ class EE_API cGameObjectSprite : public cGameObject {
|
||||
|
||||
virtual Uint32 Type() const;
|
||||
|
||||
virtual bool IsType( const Uint32& type );
|
||||
|
||||
virtual void FlagSet( const Uint32& Flag );
|
||||
|
||||
virtual Uint32 DataId();
|
||||
|
||||
@@ -37,6 +37,10 @@ Uint32 cGameObjectVirtual::Type() const {
|
||||
return GAMEOBJECT_TYPE_VIRTUAL;
|
||||
}
|
||||
|
||||
bool cGameObjectVirtual::IsType( const Uint32& type ) {
|
||||
return ( Type() == type ) ? true : cGameObject::IsType( type );
|
||||
}
|
||||
|
||||
Uint32 cGameObjectVirtual::RealType() const {
|
||||
return mType;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,8 @@ class EE_API cGameObjectVirtual : public cGameObject {
|
||||
|
||||
virtual Uint32 Type() const;
|
||||
|
||||
virtual bool IsType( const Uint32& type );
|
||||
|
||||
virtual Uint32 RealType() const;
|
||||
|
||||
virtual Uint32 DataId();
|
||||
|
||||
@@ -1209,7 +1209,7 @@ cGameObject * cMap::IsTypeInTilePos( const Uint32& Type, const eeVector2i& TileP
|
||||
cGameObject * tObj = NULL;
|
||||
|
||||
if ( ( tObj = tLayer->GetGameObject( TilePos ) ) ) {
|
||||
if ( tObj->Type() == Type ) {
|
||||
if ( tObj->IsType( Type ) ) {
|
||||
return tObj;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace EE { namespace UI {
|
||||
|
||||
cUIMessageBox::cUIMessageBox( const cUIMessageBox::CreateParams& Params ) :
|
||||
cUIWindow( Params ),
|
||||
mType( Params.Type )
|
||||
mMsgBoxType( Params.Type )
|
||||
{
|
||||
cUIPushButton::CreateParams ButtonParams;
|
||||
ButtonParams.Parent( Container() );
|
||||
@@ -31,7 +31,7 @@ cUIMessageBox::cUIMessageBox( const cUIMessageBox::CreateParams& Params ) :
|
||||
|
||||
mTextBox->Text( Params.Message );
|
||||
|
||||
switch ( mType ) {
|
||||
switch ( mMsgBoxType ) {
|
||||
case MSGBOX_OKCANCEL:
|
||||
{
|
||||
mButtonOK->Text( "OK" );
|
||||
|
||||
@@ -37,7 +37,7 @@ class EE_API cUIMessageBox : public cUIWindow {
|
||||
|
||||
cUIPushButton * ButtonCancel() const;
|
||||
protected:
|
||||
UI_MSGBOX_TYPE mType;
|
||||
UI_MSGBOX_TYPE mMsgBoxType;
|
||||
cUITextBox * mTextBox;
|
||||
cUIPushButton * mButtonOK;
|
||||
cUIPushButton * mButtonCancel;
|
||||
|
||||
Reference in New Issue
Block a user