GraphicsApi.cpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #include "GraphicsApi.h"
  2. #include "Fenster.h"
  3. #include "Bild.h"
  4. using namespace Framework;
  5. GraphicsApi::GraphicsApi( GraphicApiType typ )
  6. {
  7. this->typ = typ;
  8. fenster = 0;
  9. backBufferSize = Vec2<int>( 0, 0 );
  10. fullScreen = 0;
  11. ref = 1;
  12. }
  13. GraphicsApi::~GraphicsApi()
  14. {
  15. if( fenster )
  16. fenster->release();
  17. }
  18. void GraphicsApi::initialize( WFenster * fenster, Vec2<int> backBufferSize, bool fullScreen )
  19. {
  20. if( this->fenster )
  21. this->fenster->release();
  22. this->fenster = fenster;
  23. if( !backBufferSize.x || !backBufferSize.y )
  24. backBufferSize = fenster ? fenster->getKörperGröße() : Punkt( 0, 0 );
  25. this->backBufferSize = backBufferSize;
  26. this->fullScreen = fullScreen;
  27. }
  28. void GraphicsApi::setBackBufferSize( Vec2< int > size )
  29. {
  30. backBufferSize = size;
  31. update();
  32. }
  33. void GraphicsApi::setFullScreen( bool fullScreen )
  34. {
  35. this->fullScreen = fullScreen;
  36. update();
  37. }
  38. void GraphicsApi::beginFrame( bool fill2D, bool fill3D, int fillColor )
  39. {}
  40. void GraphicsApi::renderKamera( Kam3D * zKamera )
  41. {}
  42. Textur *GraphicsApi::createOrGetTextur( const char *name, Bild * b )
  43. {
  44. if( b )
  45. b->release();
  46. return 0;
  47. }
  48. GraphicApiType GraphicsApi::getTyp() const
  49. {
  50. return typ;
  51. }
  52. Vec2< int > GraphicsApi::getBackBufferSize() const
  53. {
  54. return backBufferSize;
  55. }
  56. bool GraphicsApi::isFullScreen() const
  57. {
  58. return fullScreen;
  59. }
  60. GraphicsApi *GraphicsApi::getThis()
  61. {
  62. ref++;
  63. return this;
  64. }
  65. GraphicsApi *GraphicsApi::release()
  66. {
  67. if( !--ref )
  68. delete this;
  69. return 0;
  70. }