Bomberman
Image.hpp
Go to the documentation of this file.
1 /*
2 ** EPITECH PROJECT, 2021
3 ** Bomberman
4 ** File description:
5 ** Image
6 */
7 
8 #ifndef IMAGE_HPP_
9 #define IMAGE_HPP_
10 
11 #include <raylib.h>
12 #include <string>
13 #include "Texture.hpp"
14 #include "Utils/Cache.hpp"
16 
17 namespace RAY
18 {
21  public:
25  Image(const std::string &filename, bool lonely = false);
26 
28  Image(const Image &image) = default;
29 
31  Image &operator=(const Image &image) = default;
32 
34  ~Image() override = default;
35 
38  bool exportTo(const std::string &outputPath);
39 
42 
44  void drawOn(RAY::Window &) override;
45 
47  void drawOn(RAY::Image &image) override;
48 
50  void resize(const RAY::Vector2 &dimensions);
51 
53  Image &use(const std::string &filename);
54 
55  private:
57  std::shared_ptr<::Image> _image;
58 
60 
61  std::string _ressourcePath;
62 
63 
64  INTERNAL:
66  operator ::Image() const;
67  operator ::Image *();
68  };
69 }
70 
71 #endif /* !IMAGE_HPP_ */
Rectangle.hpp
RAY::Image::exportTo
bool exportTo(const std::string &outputPath)
export to file
Definition: Image.cpp:30
RAY::Image::draw
void draw(Drawables::ADrawable2D &)
draw drawable on image
Definition: Image.cpp:55
Cache.hpp
RAY::Image::_imagesCache
static Cache<::Image > _imagesCache
Definition: Image.hpp:59
RAY::Window
Definition: Window.hpp:32
RAY::Vector2
A Two-dimensionnal Vector data type.
Definition: Vector2.hpp:15
RAY::Image::operator=
Image & operator=(const Image &image)=default
An image is assignable.
RAY
Definition: IAudio.hpp:12
RAY::Image::Image
Image(const std::string &filename, bool lonely=false)
Create an image, loading a file.
Definition: Image.cpp:22
Texture.hpp
RAY::Drawables::Drawables2D::Rectangle
Rectangle in a two-dimensional space.
Definition: Rectangle.hpp:17
RAY::Image
Object representation of a framebuffer.
Definition: Image.hpp:20
RAY::Image::~Image
~Image() override=default
Image destructor, will unload ressources.
RAY::Image::_ressourcePath
std::string _ressourcePath
Definition: Image.hpp:61
RAY::Image::drawOn
void drawOn(RAY::Window &) override
Draw image on window.
Definition: Image.cpp:66
RAY::Cache
A templated class used to cache ressources, indexed with a string.
Definition: Cache.hpp:23
RAY::Drawables::ADrawable2D
Abstraction of any two-dimensionnal drawable.
Definition: ADrawable2D.hpp:21
RAY::Image::_image
std::shared_ptr<::Image > _image
Image, really, that's just it...
Definition: Image.hpp:57
RAY::Image::resize
void resize(const RAY::Vector2 &dimensions)
Resize image;.
Definition: Image.cpp:60
RAY::Image::use
Image & use(const std::string &filename)
Load image from file, lets one use one entity for multiple files.
Definition: Image.cpp:41