GraphicsApi.cpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. #ifdef _WIN32
  16. if( fenster )
  17. fenster->release();
  18. #endif
  19. }
  20. void GraphicsApi::initialize( WFenster * fenster, Vec2<int> backBufferSize, bool fullScreen )
  21. {
  22. #ifdef _WIN32
  23. if( this->fenster )
  24. this->fenster->release();
  25. this->fenster = fenster;
  26. if( !backBufferSize.x || !backBufferSize.y )
  27. backBufferSize = fenster ? fenster->getKörperGröße() : Punkt( 0, 0 );
  28. #endif
  29. this->backBufferSize = backBufferSize;
  30. this->fullScreen = fullScreen;
  31. }
  32. void GraphicsApi::setBackBufferSize( Vec2< int > size )
  33. {
  34. backBufferSize = size;
  35. update();
  36. }
  37. void GraphicsApi::setFullScreen( bool fullScreen )
  38. {
  39. this->fullScreen = fullScreen;
  40. update();
  41. }
  42. void GraphicsApi::beginFrame( bool fill2D, bool fill3D, int fillColor )
  43. {}
  44. void GraphicsApi::renderKamera( Kam3D * zKamera )
  45. {}
  46. Textur *GraphicsApi::createOrGetTextur( const char *name, Bild * b )
  47. {
  48. if( b )
  49. b->release();
  50. return 0;
  51. }
  52. GraphicApiType GraphicsApi::getTyp() const
  53. {
  54. return typ;
  55. }
  56. Vec2< int > GraphicsApi::getBackBufferSize() const
  57. {
  58. return backBufferSize;
  59. }
  60. bool GraphicsApi::isFullScreen() const
  61. {
  62. return fullScreen;
  63. }
  64. GraphicsApi *GraphicsApi::getThis()
  65. {
  66. ref++;
  67. return this;
  68. }
  69. GraphicsApi *GraphicsApi::release()
  70. {
  71. if( !--ref )
  72. delete this;
  73. return 0;
  74. }