VideoEnde.cpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #include "VideoEnde.h"
  2. #include <Bild.h>
  3. #include <MausEreignis.h>
  4. #include <Rahmen.h>
  5. #include <Schrift.h>
  6. #include <Text.h>
  7. // Inhalt der VideoEnde Klasse aus VideoEnde.h
  8. // Konstruktor
  9. VideoEnde::VideoEnde( Schrift *zSchrift )
  10. {
  11. text = new TextFeld();
  12. text->setStyle( TextFeld::Style::Text | TextFeld::Style::Center | TextFeld::Style::Rahmen | TextFeld::Style::Hintergrund | TextFeld::Style::HAlpha );
  13. text->removeStyle( TextFeld::Style::Sichtbar );
  14. text->setSchriftZ( zSchrift->getThis() );
  15. text->setText( "" );
  16. text->setSchriftFarbe( 0xFFFFFFFF );
  17. text->setSize( 220, 70 );
  18. text->setLinienRahmenBreite( 2 );
  19. text->setLinienRahmenFarbe( 0xFFFFFFFF );
  20. text->setHintergrundFarbe( 0xA0000000 );
  21. ref = 1;
  22. }
  23. // Destruktor
  24. VideoEnde::~VideoEnde()
  25. {
  26. text->release();
  27. }
  28. // nicht constant
  29. void VideoEnde::setSichtbar( bool b )
  30. {
  31. text->setStyle( TextFeld::Style::Sichtbar, b );
  32. }
  33. void VideoEnde::setText( const char *txt )
  34. {
  35. text->zSchrift()->lock();
  36. text->zSchrift()->setSchriftSize( 12 );
  37. Text t = txt;
  38. text->setSize( 10 + text->zSchrift()->getTextBreite( &t ), 10 + text->zSchrift()->getTextHeight( &t ) );
  39. text->zSchrift()->unlock();
  40. text->setText( txt );
  41. }
  42. void VideoEnde::render( Bild &zRObj )
  43. {
  44. text->setPosition( zRObj.getBreite() / 2 - text->getBreite() / 2, zRObj.getHeight() / 2 - text->getHeight() / 2 );
  45. text->render( zRObj );
  46. }
  47. // constant
  48. bool VideoEnde::istSichtbar() const
  49. {
  50. return text->hatStyle( TextFeld::Style::Sichtbar );
  51. }
  52. // Reference Counting
  53. VideoEnde *VideoEnde::getThis()
  54. {
  55. ref++;
  56. return this;
  57. }
  58. VideoEnde *VideoEnde::release()
  59. {
  60. ref--;
  61. if( !ref )
  62. delete this;
  63. return 0;
  64. }