|
@ -1,16 +1,21 @@ |
|
|
|
|
|
#include <iostream>
|
|
|
#include "raylib.h"
|
|
|
#include "raylib.h"
|
|
|
#include "scene.h"
|
|
|
#include "scene.h"
|
|
|
#include "render_state.h"
|
|
|
#include "render_state.h"
|
|
|
#include "entities/ui_fps_entity.h"
|
|
|
#include "entities/ui_fps_entity.h"
|
|
|
#include "entities/background_entity.h"
|
|
|
#include "entities/background_entity.h"
|
|
|
#include "components/sprite_component.h"
|
|
|
#include "components/sprite_component.h"
|
|
|
|
|
|
#include "components/panel_component.h"
|
|
|
|
|
|
|
|
|
using namespace std::string_literals; |
|
|
using namespace std::string_literals; |
|
|
|
|
|
|
|
|
int main() { |
|
|
int main() { |
|
|
InitWindow(800, 600, "Example"); |
|
|
InitWindow(800, 600, "Example"); |
|
|
ant::core::scene::current = std::make_shared<ant::core::scene>(); |
|
|
ant::core::scene::current = std::make_shared<ant::core::scene>(); |
|
|
ant::core::scene::current->root_nodes.push_back(ant::core::make_entity<ant::entities::utilities::ui_fps_entity>()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ant::core::scene::current->root_nodes.push_back(ant::core::make_entity<ant::entities::utilities::ui_fps_entity>()); |
|
|
|
|
|
ant::core::scene::current->root_nodes.push_back(ant::core::make_entity<ant::entities::utilities::background_entity>(BLACK)); |
|
|
|
|
|
|
|
|
ant::core::scene::current->root_nodes.push_back(ant::core::make_entity<ant::core::entity>()); |
|
|
ant::core::scene::current->root_nodes.push_back(ant::core::make_entity<ant::core::entity>()); |
|
|
ant::core::scene::current->root_nodes.back() |
|
|
ant::core::scene::current->root_nodes.back() |
|
|
->add_component<ant::components::graphical::sprite_component>( |
|
|
->add_component<ant::components::graphical::sprite_component>( |
|
@ -21,10 +26,32 @@ int main() { |
|
|
); |
|
|
); |
|
|
ant::core::scene::current->root_nodes.back()->transform().position = {250,250}; |
|
|
ant::core::scene::current->root_nodes.back()->transform().position = {250,250}; |
|
|
ant::core::scene::current->root_nodes.back()->transform().angle = 120; |
|
|
ant::core::scene::current->root_nodes.back()->transform().angle = 120; |
|
|
ant::core::scene::current->root_nodes.push_back(ant::core::make_entity<ant::entities::utilities::background_entity>(BLACK)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ant::core::scene::current->root_nodes.push_back(ant::core::make_entity<ant::core::entity>()); |
|
|
|
|
|
ant::core::scene::current->root_nodes.back() |
|
|
|
|
|
->add_component<ant::components::ui::panel_component>( |
|
|
|
|
|
100, |
|
|
|
|
|
BLUE, |
|
|
|
|
|
ant::core::Vec2<>{400, 400}, |
|
|
|
|
|
ant::core::Vec2<>{1,1} |
|
|
|
|
|
); |
|
|
|
|
|
ant::core::scene::current->root_nodes.back()->transform().position = {390, 10}; |
|
|
|
|
|
|
|
|
|
|
|
auto child = ant::core::make_entity(ant::core::scene::current->root_nodes.back()); |
|
|
|
|
|
child->transform().position = {150,150}; |
|
|
|
|
|
child |
|
|
|
|
|
->add_component<ant::components::ui::panel_component>( |
|
|
|
|
|
12, |
|
|
|
|
|
RED, |
|
|
|
|
|
ant::core::Vec2<>{100, 100}, |
|
|
|
|
|
ant::core::Vec2<>{1,1} |
|
|
|
|
|
)->initialize(); |
|
|
|
|
|
// TODO: investigate the rendering of subpanels
|
|
|
|
|
|
|
|
|
auto ref = std::chrono::steady_clock::now(); |
|
|
auto ref = std::chrono::steady_clock::now(); |
|
|
std::chrono::duration<double> frame_time = ref - ref; |
|
|
std::chrono::duration<double> frame_time = ref - ref; |
|
|
while(not WindowShouldClose()) { |
|
|
while(not WindowShouldClose()) { |
|
|
|
|
|
std::cout << "Frame start\n"; |
|
|
ant::core::scene::current->update(frame_time); |
|
|
ant::core::scene::current->update(frame_time); |
|
|
ant::core::scene::current->render(); |
|
|
ant::core::scene::current->render(); |
|
|
BeginDrawing(); |
|
|
BeginDrawing(); |
|
|