HoverRace  2.0
SdlTexture.h
Go to the documentation of this file.
1 
2 // SdlTexture.h
3 //
4 // Copyright (c) 2013-2015 Michael Imamura.
5 //
6 // Licensed under GrokkSoft HoverRace SourceCode License v1.0(the "License");
7 // you may not use this file except in compliance with the License.
8 //
9 // A copy of the license should have been attached to the package from which
10 // you have taken this file. If you can not find the license you can not use
11 // this file.
12 //
13 //
14 // The author makes no representations about the suitability of
15 // this software for any purpose. It is provided "as is" "AS IS",
16 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
17 // implied.
18 //
19 // See the License for the specific language governing permissions
20 // and limitations under the License.
21 
22 #pragma once
23 
24 #include <SDL2/SDL.h>
25 
26 #include "../Texture.h"
27 
28 #if defined(_WIN32) && defined(HR_ENGINE_SHARED)
29 # ifdef MR_ENGINE
30 # define MR_DllDeclare __declspec( dllexport )
31 # else
32 # define MR_DllDeclare __declspec( dllimport )
33 # endif
34 #else
35 # define MR_DllDeclare
36 #endif
37 
38 namespace HoverRace {
39  namespace Display {
40  namespace SDL {
41  class SdlDisplay;
42  }
43  }
44 }
45 
46 namespace HoverRace {
47 namespace Display {
48 namespace SDL {
49 
55 {
56  using SUPER = Texture;
57 
58 public:
59  SdlTexture() = delete;
60  SdlTexture(SdlDisplay &display, SDL_Texture *texture) :
61  SUPER(), texture(texture), display(display) { }
62  SdlTexture(const SdlTexture&) = delete;
63 
64  virtual ~SdlTexture()
65  {
66  if (texture) SDL_DestroyTexture(texture);
67  }
68 
69  SdlTexture &operator=(const SdlTexture&) = delete;
70 
71 public:
72  SDL_Texture *Get() const { return texture; }
73 
74 protected:
75  SDL_Texture *texture;
77 };
78 
79 } // namespace SDL
80 } // namespace Display
81 } // namespace HoverRace
82 
83 #undef MR_DllDeclare
A hardware texture.
Definition: Texture.h:41
SdlDisplay & display
Definition: SdlTexture.h:76
SDL_Texture * texture
Definition: SdlTexture.h:75
#define MR_DllDeclare
Definition: SdlTexture.h:35
virtual ~SdlTexture()
Definition: SdlTexture.h:64
Wrapper for SDL_Texture.
Definition: SdlTexture.h:54
SDL_Texture * Get() const
Definition: SdlTexture.h:72
Definition: Announcement.h:24
SdlTexture(SdlDisplay &display, SDL_Texture *texture)
Definition: SdlTexture.h:60
SDL-based software rendering.
Definition: SdlDisplay.h:60