123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187 |
- #include "KSGSAnimation2D.h"
- #include "KSGSTyp.h"
- #include "../Error/Error.h"
- #include "../Main/KSGScriptObj.h"
- #include "KSGSMausEreignis.h"
- #include "KSGSInt.h"
- #include "KSGSBool.h"
- #include "KSGSAnimation2DData.h"
- #include <ToolTip.h>
- #include "KSGSText.h"
- using namespace KSGScript;
- // Inhalt der KSGSAnimation2DKlasse aus KSGSAnimaion2D
- // Konstruktor
- KSGSAnimation2DKlasse::KSGSAnimation2DKlasse( KSGScriptProcessor *zObj, Animation2D *std )
- : KSGSKlasseInstanz( KSGS_ANIMATION2D, 0, 0, zObj )
- {
- val = std;
- }
- // Destruktor
- KSGSAnimation2DKlasse::~KSGSAnimation2DKlasse()
- {
- val->release();
- }
- // nicht constant
- KSGSVariable *KSGSAnimation2DKlasse::startFunktion( int id, bool access, RCArray< KSGSVariable > *parameter )
- {
- KSGSVariable *ret = 0;
- switch( id )
- {
- case 0: // void setRahmen( bool )
- if( parameter->getEintragAnzahl() < 1 )
- error( 20, {}, obj );
- val->setRahmen( parameter->z( 0 ) ? parameter->z( 0 )->getBool() : 0 );
- break;
- case 1: // void setRahmenBreite( int )
- if( parameter->getEintragAnzahl() < 1 )
- error( 20, {}, obj );
- val->setRahmenBreite( parameter->z( 0 ) ? parameter->z( 0 )->getInt() : 0 );
- break;
- case 2: // void setRahmenFarbe( int )
- if( parameter->getEintragAnzahl() < 1 )
- error( 20, {}, obj );
- val->setRahmenFarbe( parameter->z( 0 ) ? parameter->z( 0 )->getInt() : 0 );
- break;
- case 3: // void setAnimationData( Animation2DData )
- if( parameter->getEintragAnzahl() < 1 )
- error( 20, {}, obj );
- val->setAnimationDataZ( parameter->z( 0 ) ? parameter->z( 0 )->getAnimation2DData() : 0 );
- break;
- case 4: // void setAlphaMaske( int )
- if( parameter->getEintragAnzahl() < 1 )
- error( 20, {}, obj );
- val->setAlphaMaske( parameter->z( 0 ) ? parameter->z( 0 )->getInt() : 0 );
- break;
- case 5: // void setAPS( int )
- if( parameter->getEintragAnzahl() < 1 )
- error( 20, {}, obj );
- val->setAPS( parameter->z( 0 ) ? parameter->z( 0 )->getInt() : 0 );
- break;
- case 6: // void setSichtbar( bool )
- if( parameter->getEintragAnzahl() < 1 )
- error( 20, {}, obj );
- val->setSichtbar( parameter->z( 0 ) ? parameter->z( 0 )->getBool() : 0 );
- break;
- case 7: // bool tick( double )
- if( parameter->getEintragAnzahl() < 1 )
- error( 20, {}, obj );
- ret = new KSGSBoolKlasse( obj, val->tick( parameter->z( 0 ) ? parameter->z( 0 )->getDouble() : 0 ) );
- break;
- case 8: // void render( int, int, Bild )
- if( 1 )
- {
- if( parameter->getEintragAnzahl() < 1 )
- error( 20, {}, obj );
- Bild *b = parameter->z( 0 ) ? parameter->z( 0 )->getBild() : 0;
- if( b )
- {
- val->render( *b );
- b->release();
- }
- }
- break;
- case 9: // Animation2DData getAnimationData()
- if( val->zAnimationData() )
- ret = new KSGSAnimation2DDataKlasse( obj, val->getAnimationData() );
- break;
- case 10: // bool istSichtbar()
- ret = new KSGSBoolKlasse( obj, val->istSichtbar() );
- break;
- case 11: // int getJetzt()
- ret = new KSGSIntKlasse( obj, val->getJetzt() );
- break;
- case 12: // int getAlphaMaske()
- ret = new KSGSIntKlasse( obj, val->getAlphaMaske() );
- break;
- case 13: // bool hatRahmen()
- ret = new KSGSBoolKlasse( obj, val->hatRahmen() );
- break;
- case 14: // int getRahmenBreite()
- ret = new KSGSIntKlasse( obj, val->getRahmenBreite() );
- break;
- case 15: // int getRahmenFarbe()
- ret = new KSGSIntKlasse( obj, val->getRahmenFarbe() );
- break;
- case 16: // void setToolTipText( Text )
- if( 1 )
- {
- if( parameter->getEintragAnzahl() < 1 )
- error( 20, {}, obj );
- Text *txt = parameter->z( 0 ) ? parameter->z( 0 )->getText() : 0;
- val->setToolTipText( txt ? *txt : 0, obj->zBildschirm(), obj->zSchrift() );
- if( txt )
- txt->release();
- }
- break;
- case 17: // void setPosition( int, int )
- if( parameter->getEintragAnzahl() < 2 )
- error( 20, {}, obj );
- val->setPosition( parameter->z( 0 ) ? parameter->z( 0 )->getInt() : 0,
- parameter->z( 1 ) ? parameter->z( 1 )->getInt() : 0 );
- break;
- case 18: // void setGröße( int, int )
- if( parameter->getEintragAnzahl() < 2 )
- error( 20, {}, obj );
- val->setSize( parameter->z( 0 ) ? parameter->z( 0 )->getInt() : 0,
- parameter->z( 1 ) ? parameter->z( 1 )->getInt() : 0 );
- break;
- case 19: // int getBreite()
- ret = new KSGSIntKlasse( obj, val->getBreite() );
- break;
- case 20: // int getHöhe()
- ret = new KSGSIntKlasse( obj, val->getHeight() );
- break;
- case 21: // int getX()
- ret = new KSGSIntKlasse( obj, val->getX() );
- break;
- case 22: // int getY()
- ret = new KSGSIntKlasse( obj, val->getY() );
- break;
- default: // unbekannt
- error( 19, {}, obj );
- break;
- }
- parameter->release();
- return ret;
- }
- KSGSVariable *KSGSAnimation2DKlasse::doOperator( int id, KSGSVariable *rechts )
- {
- if( !rechts )
- {
- error( 3, {}, obj );
- return 0;
- }
- KSGSVariable *ret = 0;
- switch( id )
- {
- case KSGS_O_SET:
- if( 1 )
- {
- val->release();
- val = rechts->getAnimation2D();
- ret = (KSGSVariable *)getThis();
- }
- break;
- }
- if( !ret )
- error( 21, {}, obj );
- if( rechts )
- rechts->release();
- return ret;
- }
- // constant
- Animation2D *KSGSAnimation2DKlasse::getVal() const
- {
- return (Animation2D *)val->getThis();
- }
- Animation2D *KSGSAnimation2DKlasse::zVal() const
- {
- return val;
- }
|