123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- #include "Editor.h"
- #include <iostream>
- // Inhalt der Editor Klasse aus Editor.h
- // Konstruktor
- Editor::Editor()
- {
- schrift = 0;
- klient = 0;
- laden = 0;
- i = 0;
- alpha = 0;
- verlassen = 0;
- dialogs = new Array< Dialog* >();
- rend = 1;
- ref = 1;
- }
- // Destruktor
- Editor::~Editor()
- {
- if( schrift )
- schrift->release();
- if( klient )
- klient->release();
- if( laden )
- laden->release();
- if( i )
- i->release();
- }
- // nicht constant
- void Editor::setSchrift( Schrift *schrift )
- {
- if( this->schrift )
- this->schrift->release();
- this->schrift = schrift;
- if( !i )
- i = new Interface( schrift );
- }
- void Editor::setKlient( EditorKlientV *ekv )
- {
- if( klient )
- klient->release();
- klient = new EditorKlient( ekv );
- }
- void Editor::setLadeAnimation( Animation2D *la )
- {
- if( laden )
- laden->release();
- laden = la;
- }
- void Editor::setSichtbar()
- {
- verlassen = 0;
- rend = 1;
- }
- void Editor::doMausEreignis( MausEreignis &me )
- {
- for( auto i = dialogs->getArray(); i.set && i.var; i++ )
- i.var->doMausEreignis( me );
- i->doMausEreignis( me );
- verlassen = i->hatVerlassen();
- }
- void Editor::doTastaturEreignis( TastaturEreignis &te )
- {
- for( auto i = dialogs->getArray(); i.set && i.var; i++ )
- i.var->doTastaturEreignis( te );
- i->doTastaturEreignis( te );
- }
- bool Editor::tick( double z )
- {
- rend |= i->tick( z );
- for( auto i = dialogs->getArray(); i.set && i.var; i++ )
- rend |= i.var->tick( z );
- bool tmp = rend;
- rend = 0;
- return tmp;
- }
- void Editor::render( Bild &zRObj )
- {
- i->render( zRObj );
- for( int i = dialogs->getEintragAnzahl() - 1; i >= 0; i-- )
- {
- dialogs->get( i )->render( zRObj );
- if( dialogs->get( i )->hatVerlassen() )
- {
- delete dialogs->get( i );
- dialogs->remove( i );
- }
- }
- }
- // constant
- bool Editor::hatVerlassen( bool jetzt ) const
- {
- return verlassen;
- }
- // Reference Counting
- EditorV *Editor::getThis()
- {
- ref++;
- return this;
- }
- EditorV *Editor::release()
- {
- ref--;
- if( !ref )
- delete this;
- return 0;
- }
|