Chronos
0.0
A advanced 2D rendering and animation system
Loading...
Searching...
No Matches
managerTextureFunctions.cpp
Go to the documentation of this file.
1
/*
2
Copyright (c) 2024 Rahul Satish Vadhyar
3
4
Permission is hereby granted, free of charge, to any person obtaining a copy
5
of this software and associated documentation files (the "Software"), to deal
6
in the Software without restriction, including without limitation the rights
7
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
copies of the Software, and to permit persons to whom the Software is
9
furnished to do so, subject to the following conditions:
10
11
The above copyright notice and this permission notice shall be included in all
12
copies or substantial portions of the Software.
13
14
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
SOFTWARE.
21
*/
22
23
#include "
chronos.hpp
"
24
25
int
Chronos::Manager::Manager::addTexture
(
26
std::string texturePath, std::string textureName)
27
{
28
for
(
auto
& textureDetail :
getTextureDetails
()) {
29
if
(textureDetail.textureName == textureName) {
30
break
;
31
}
32
}
33
return
engine
.
textureManager
.
addTexture
(texturePath, textureName);
34
}
35
void
Chronos::Manager::Manager::removeTexture
(
int
textureNo)
36
{
37
engine.textureManager.removeTexture(textureNo);
38
}
39
40
std::vector<Chronos::Manager::TextureDetails>
41
Chronos::Manager::Manager::getTextureDetails
()
42
{
43
std::vector<Chronos::Manager::TextureDetails> textureDetails;
44
for
(
auto
& texture : engine.textureManager.textures) {
45
Chronos::Manager::TextureDetails
details;
46
details.
textureNo
= texture.first;
47
details.
textureName
= texture.second.textureName;
48
details.
texturePath
= texture.second.texturePath;
49
details.
height
= texture.second.height;
50
details.
width
= texture.second.width;
51
#ifdef ENABLE_EDITOR
52
details.descriptorSet = texture.second.descriptorSet;
53
#endif
54
textureDetails.push_back(details);
55
}
56
return
textureDetails;
57
}
chronos.hpp
Main API for chronos. Any applications should include this file.
Chronos::Engine::Engine::textureManager
Chronos::Engine::TextureManager textureManager
Used to create and manage textures.
Definition
engine.hpp:107
Chronos::Engine::TextureManager::addTexture
int addTexture(std::string texturePath, std::string textureName)
Adds a texture to the texture manager.
Definition
textureManager.cpp:32
Chronos::Manager::Manager::engine
Chronos::Engine::Engine engine
The backend Vulkan engine, used for rendering the desired shapes and text.s.
Definition
chronos.hpp:509
Chronos::Manager::Manager::removeTexture
void removeTexture(int textureNo)
Removes the texture from the window.
Definition
managerTextureFunctions.cpp:35
Chronos::Manager::Manager::addTexture
int addTexture(std::string texturePath, std::string textureName)
Loads a texture from file.
Definition
managerTextureFunctions.cpp:25
Chronos::Manager::Manager::getTextureDetails
std::vector< TextureDetails > getTextureDetails()
Returns the details of all textures defined.
Definition
managerTextureFunctions.cpp:41
Chronos::Manager::TextureDetails
Holds some details about the texture.
Definition
chronos.hpp:90
Chronos::Manager::TextureDetails::height
int height
Definition
chronos.hpp:95
Chronos::Manager::TextureDetails::textureNo
int textureNo
Definition
chronos.hpp:93
Chronos::Manager::TextureDetails::width
int width
Definition
chronos.hpp:94
Chronos::Manager::TextureDetails::texturePath
std::string texturePath
Definition
chronos.hpp:92
Chronos::Manager::TextureDetails::textureName
std::string textureName
Definition
chronos.hpp:91
Source
API
managerTextureFunctions.cpp
Generated by
1.9.8