Shkyera Engine
Easy to use, game engine for Python
Image.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <filesystem>
4 
5 namespace shkyera {
6 
11 class Image {
12  public:
19  Image(size_t width, size_t height);
20 
26  Image(std::filesystem::path path);
27 
33  void load(std::filesystem::path path);
34 
40  void save(std::filesystem::path path) const;
41 
45  void updateTextureId();
46 
52  uint64_t getTextureId() const;
53 
54  // Static image objects representing icons
60 
64 
69 
72 
73  private:
74  uint8_t *_data;
75 
76  int _width;
77  int _height;
79 
81  uint64_t _textureId;
82 };
83 
84 } // namespace shkyera
A class for working with images and textures.
Definition: Image.hpp:11
static Image ICON_FILES_IMAGE
Definition: Image.hpp:67
uint64_t getTextureId() const
Get the OpenGL texture ID associated with the image.
Definition: Image.cpp:56
static Image ICON_FILES_FOLDER
Definition: Image.hpp:65
void save(std::filesystem::path path) const
Save the image to a file in PNG format.
Definition: Image.cpp:33
static Image ICON_FILES_PYTHON
Definition: Image.hpp:66
static Image ICON_BUTTON_STOP
Definition: Image.hpp:71
static Image ICON_CONSOLE_ERROR
Definition: Image.hpp:56
uint8_t * _data
The image pixel data.
Definition: Image.hpp:74
Image(size_t width, size_t height)
Constructor for creating an image with the specified width and height.
Definition: Image.cpp:19
void load(std::filesystem::path path)
Load an image from a file.
Definition: Image.cpp:26
void updateTextureId()
Update the OpenGL texture ID associated with the image.
Definition: Image.cpp:37
static Image ICON_CONSOLE_SUCCESS
Definition: Image.hpp:59
static Image ICON_CONSOLE_VERBOSE
Definition: Image.hpp:58
int _width
The width of the image.
Definition: Image.hpp:76
static Image ICON_BUTTON_PLAY
Definition: Image.hpp:70
static Image ICON_FILES_TEXT
Definition: Image.hpp:68
static Image ICON_COMPONENT_TRANSFORM
Definition: Image.hpp:61
int _components
The number of color components.
Definition: Image.hpp:78
static Image ICON_COMPONENT_SCRIPT
Definition: Image.hpp:62
static Image ICON_CONSOLE_TOTAL
Definition: Image.hpp:55
uint64_t _textureId
The OpenGL texture ID.
Definition: Image.hpp:81
static Image ICON_CONSOLE_INFO
Definition: Image.hpp:57
static Image ICON_COMPONENT_SHAPE
Definition: Image.hpp:63
int _height
The height of the image.
Definition: Image.hpp:77
bool _wasAssignedTextureId
Flag indicating if the texture ID has been assigned.
Definition: Image.hpp:80
Definition: Entity.cpp:3