libAlgAudio  v1.99-440-g08538e5-dirty
The development library for AlgAudio framework.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SDLTexture.hpp
Go to the documentation of this file.
1 #ifndef SDLTEXTURE_HPP
2 #define SDLTEXTURE_HPP
3 /*
4 This file is part of AlgAudio.
5 
6 AlgAudio, Copyright (C) 2015 CeTA - Audiovisual Technology Center
7 
8 AlgAudio is free software: you can redistribute it and/or modify
9 it under the terms of the GNU Lesser General Public License as
10 published by the Free Software Foundation, either version 3 of the
11 License, or (at your option) any later version.
12 
13 AlgAudio is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU Lesser General Public License for more details.
17 
18 You should have received a copy of the GNU Lesser General Public License
19 along with AlgAudio. If not, see <http://www.gnu.org/licenses/>.
20 */
21 #include "Color.hpp"
22 #include "SDLHandle.hpp"
23 #include <memory>
24 
25 struct SDL_Texture;
26 struct SDL_Surface;
27 
28 namespace AlgAudio{
29 
30 class Window;
31 
33 class SDLTexture{
34 public:
35  SDLTexture(std::weak_ptr<Window> parent_window, Size2D size);
36  SDLTexture(std::weak_ptr<Window> parent_window, SDL_Surface*);
37  ~SDLTexture();
38  //SDLTexture(SDLTexture&& other);
39  //SDLTexture& operator=(SDLTexture&& other);
40  SDLTexture(const SDLTexture& other) = delete; // No copyconstructing
41  SDLTexture& operator=(const SDLTexture& other) = delete; // No copying
42  void Resize(Size2D size);
43  Size2D GetSize() {return size;}
44  friend class DrawContext;
45 private:
46  SDLHandle handle;
47  SDL_Texture* texture;
48  // Creating a textire of 0 size will mark it as invalid.
49  bool valid = true;
50  std::weak_ptr<Window> parent;
51  Size2D size;
52 };
53 
58 class SDLTextTexture : public SDLTexture{
59 public:
60  SDLTextTexture(std::weak_ptr<Window> parent_window, SDL_Surface* s) :
61  SDLTexture(parent_window,s) {}
62  SDLTextTexture(std::weak_ptr<Window> parent_window, Size2D s) :
63  SDLTexture(parent_window,s) {}
64 };
65 
66 } // namespace AlgAudio
67 
68 #endif // SDLTEXTURE_HPP
SDLTexture & operator=(const SDLTexture &other)=delete
Definition: DrawContext.hpp:65
Definition: SDLHandle.hpp:40
SDLTextTexture(std::weak_ptr< Window > parent_window, SDL_Surface *s)
Definition: SDLTexture.hpp:60
Definition: SDLTexture.hpp:58
Definition: Alertable.hpp:26
Definition: SDLTexture.hpp:33
SDLTextTexture(std::weak_ptr< Window > parent_window, Size2D s)
Definition: SDLTexture.hpp:62
SDLTexture(std::weak_ptr< Window > parent_window, Size2D size)
void Resize(Size2D size)
Size2D GetSize()
Definition: SDLTexture.hpp:43
Definition: Utilities.hpp:40