Chronos
0.0
A advanced 2D rendering and animation system
Loading...
Searching...
No Matches
editorMain.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 "
editorManager.hpp
"
24
#include "
logging.hpp
"
25
Chronos::Editor::EditorManager
editorManager
;
26
27
void
addElements
() {
editorManager
.
addElements
(); }
28
29
int
main
()
30
{
31
Chronos::Manager::Initializer
initializer;
32
initializer.
WindowWidth
= 800;
33
initializer.
WindowHeight
= 600;
34
initializer.
BackgroundColor
[0] = 0;
35
initializer.
BackgroundColor
[1] = 0;
36
initializer.
BackgroundColor
[2] = 0;
37
initializer.editorAddElements =
addElements
;
38
39
Chronos::Manager::Manager
manager(initializer);
40
LOG
(2,
"Manager created."
)
41
editorManager
.
init
(&manager);
42
LOG
(3,
"EditorManager created."
)
43
44
// Chronos::Manager::ShapeParams shapeParams;
45
// shapeParams.color = {1.0f, 1.0f, 1.0f};
46
// shapeParams.xSize = 0.5f;
47
// shapeParams.ySize = 0.5f;
48
// int shapeNo = manager.addPolygon(shapeParams, {false, true});
49
50
// int keyframeNo = manager.addKeyframeVariable({{0, 0}, {400, 0.1}, {800,
51
// 0.5}, {1200, 0.4}, {1600, 0.2}});
52
53
while
(!glfwWindowShouldClose(manager.
getWindow
())) {
54
if
(glfwGetKey(manager.
getWindow
(), GLFW_KEY_ESCAPE) == GLFW_PRESS) {
55
glfwSetWindowShouldClose(manager.
getWindow
(),
true
);
56
}
57
// shapeParams.x = manager.keyframeGetVariable(keyframeNo);
58
// manager.updatePolygon(shapeNo, shapeParams);
59
manager.
drawFrame
();
60
LOG
(4,
"Frame drawn."
)
61
}
62
LOG
(2,
"Exited rendering loop, closing program."
)
63
return
0;
64
}
Chronos::Editor::EditorManager
Definition
editorManager.hpp:27
Chronos::Editor::EditorManager::addElements
void addElements()
Definition
editorManager.cpp:29
Chronos::Editor::EditorManager::init
void init(Chronos::Manager::Manager *manager)
Definition
editorManager.hpp:29
Chronos::Manager::Manager
The main manager of chronos.
Definition
chronos.hpp:109
Chronos::Manager::Manager::getWindow
GLFWwindow * getWindow()
Gets a reference to the GLFWWindow.
Definition
manager.cpp:25
Chronos::Manager::Manager::drawFrame
void drawFrame()
Draws the current frame to the window.
Definition
manager.cpp:52
editorManager
Chronos::Editor::EditorManager editorManager
Definition
editorMain.cpp:25
addElements
void addElements()
Definition
editorMain.cpp:27
main
int main()
Definition
editorMain.cpp:29
editorManager.hpp
logging.hpp
LOG
#define LOG(LEVEL, MESSAGE)
Definition
logging.hpp:60
Chronos::Manager::Initializer
This struct contains the details for initialing the manager.
Definition
chronos.hpp:46
Chronos::Manager::Initializer::WindowHeight
int WindowHeight
Definition
chronos.hpp:48
Chronos::Manager::Initializer::WindowWidth
int WindowWidth
Definition
chronos.hpp:47
Chronos::Manager::Initializer::BackgroundColor
int BackgroundColor[3]
Definition
chronos.hpp:49
Source
Editor
editorMain.cpp
Generated by
1.9.8