3#include "GraphicApi.hpp"
4#include <Covellite/Api/Vertex.hpp>
5#include <Covellite/Api/Defines.hpp>
6#include <Covellite/Api/Component.inl>
17GraphicApi::GraphicApi(
void) :
18 m_StartProgram{ std::chrono::system_clock::now() },
19 m_CurrentFrameTime{ 0.0f }
23 { uT(
"Test"), [=](
const ComponentPtr_t &)
24 {
return [](void) {}; } },
25 { uT(
"Camera"), [=](
const ComponentPtr_t & _pComponent)
26 {
return CreateCamera(_pComponent); } },
27 { uT(
"BkSurface"), [=](
const ComponentPtr_t & _pComponent)
28 {
return CreateBkSurface(_pComponent); } },
29 { uT(
"State"), [=](
const ComponentPtr_t & _pComponent)
30 {
return CreateState(_pComponent); } },
31 { uT(
"Texture"), [=](
const ComponentPtr_t & _pComponent)
32 {
return CreateTexture(_pComponent); } },
33 { uT(
"Shader"), [=](
const ComponentPtr_t & _pComponent)
34 {
return CreateShader(_pComponent); } },
35 { uT(
"Buffer"), [=](
const ComponentPtr_t & _pComponent)
36 {
return CreateBuffer(_pComponent); } },
37 { uT(
"Transform"), [
this](
const ComponentPtr_t & _pComponent)
38 {
return CreateTransform(_pComponent); } },
39 { uT(
"Present"), [=](
const ComponentPtr_t & _pComponent)
40 {
return CreatePresentBuffer(_pComponent); } },
41 { uT(
"Updater"), [
this](
const ComponentPtr_t & _pComponent)
42 {
return CreateUpdater(_pComponent); } },
46void GraphicApi::PresentFrame(
void)
48 const ::std::chrono::duration<float> Time =
49 (std::chrono::system_clock::now() - m_StartProgram);
50 m_CurrentFrameTime = Time.count();
51 m_IsResizeWindow =
false;
54auto GraphicApi::GetCreators(
void)
const noexcept ->
const Creators_t &
59auto GraphicApi::CreateUpdater(
const ComponentPtr_t & _pComponent)
const -> Render_t
61 using ::covellite::api::Updater_t;
62 using ::covellite::api::Component;
64 static const auto hFunctionName = Component::GetHash(uT(
"function"));
65 static const Updater_t Empty = [](
const float) {};
77 const Updater_t Updater = (*_pComponent)[hFunctionName].Default(Empty);
79 Updater(m_CurrentFrameTime);