Compare commits

...

10 Commits

Author SHA1 Message Date
Ben Kyd
e54a790524 riddle me that 2025-07-03 23:46:43 +01:00
Ben Kyd
83758c90b3 commit 2025-07-02 20:41:20 +01:00
Ben Kyd
b25e5b3937 add assimp as submodule 2025-06-30 20:45:41 +01:00
Ben Kyd
f8a7038ab2 remvoe submodules 2025-06-30 08:52:06 +01:00
Ben Kyd
e66a2eec47 restructure more 2025-06-29 23:33:26 +01:00
Ben Kyd
8e713e38e6 assimp and ECS, also renderpass? not really tho 2025-06-28 23:11:16 +01:00
Ben Kyd
0db51249ea gitignore 2025-06-28 23:10:20 +01:00
Ben Kyd
841631eb95 restructure around entt 2025-06-28 19:11:10 +01:00
Ben Kyd
a8b80e6013 move towareds new esc 2025-06-27 23:11:37 +01:00
Ben Kyd
f1e2f0b950 lets go 2025-06-26 22:47:09 +01:00
1200 changed files with 169676 additions and 76598 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

1
.gitignore vendored
View File

@@ -3,3 +3,4 @@
out/
target/
build/
.cache/

3
.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "ThirdParty/assimp"]
path = ThirdParty/assimp
url = https://github.com/assimp/assimp

View File

@@ -1,8 +1,8 @@
#include "Aeon.hpp"
#include <Aeon/Includes.hpp>
#include <Aeon/Rendering/ImGui.hpp>
#include <yolo/yolo.hpp>
using Core::App;
using Core::Display;
@@ -10,85 +10,89 @@ using Core::DisplayProperties;
using Input::InputController;
App::App( const AppProperties& props, const DisplayProperties& dispProps )
: mDisplay()
, mInput(InputController::GetInstance())
, mEntityController( )
App::App(const AppProperties& props, const DisplayProperties& dispProps)
: mDisplay(), mInput(InputController::GetInstance()), mEntityRegistry()
{
PushThisAsSink( "ENGINE_DISPLAY_CORE" );
yolo::info("AEON Initialising...");
mDisplay.Create( dispProps );
PushThisAsSink("ENGINE_DISPLAY_CORE");
mDisplay.Create(dispProps);
}
void App::Run()
{
while ( !mSIGTERM )
{
// Should do this ONLY on update (but needs to be on main thread)
mInput.PollInput();
while (!mSIGTERM)
{
// Should do this ONLY on update (but needs to be on main thread)
mInput.PollInput();
// tick through game layers
for ( const auto& layer : mGameLayers )
{
layer->FrameTick();
}
for ( const auto& layer : mTopLayers )
{
layer->FrameTick();
}
for ( const auto& layer : mDebugLayers )
{
layer->FrameTick();
}
// tick through game layers
for (const auto& layer : mGameLayers)
{
layer->FrameTick();
}
for (const auto& layer : mTopLayers)
{
layer->FrameTick();
}
for (const auto& layer : mDebugLayers)
{
layer->FrameTick();
}
// tick through game layers *but timed*
// TODO: Timed event thread (won't allow rendering)
for ( const auto& layer : mGameLayers )
{
layer->TimeTick();
}
for ( const auto& layer : mTopLayers )
{
layer->TimeTick();
}
for ( const auto& layer : mDebugLayers )
{
layer->TimeTick();
}
// tick through game layers *but timed*
// TODO: Timed event thread (won't allow rendering)
for (const auto& layer : mGameLayers)
{
layer->TimeTick();
}
for (const auto& layer : mTopLayers)
{
layer->TimeTick();
}
for (const auto& layer : mDebugLayers)
{
layer->TimeTick();
}
mDisplay.EndFrame();
}
mDisplay.EndFrame();
}
mDisplay.Destroy();
mDisplay.Destroy();
}
const Display& App::GetDisplay()
{
return mDisplay;
return mDisplay;
}
void App::PushLayer( GameLayer* layer )
EC::Registry& App::GetEntityRegistry()
{
mGameLayers.push_back( layer );
return mEntityRegistry;
}
void App::PushTopLayer( GameLayer* layer )
void App::PushLayer(GameLayer* layer)
{
mTopLayers.push_back( layer );
mGameLayers.push_back(layer);
}
void App::PushDebugLayer( GameLayer* layer )
void App::PushTopLayer(GameLayer* layer)
{
mDebugLayers.push_back( layer );
mTopLayers.push_back(layer);
}
bool App::EventRecieved( GenericEvent& e )
void App::PushDebugLayer(GameLayer* layer)
{
if ( e.Type == "DISPLAY_CLOSED" )
{
mSIGTERM = true;
}
return false;
mDebugLayers.push_back(layer);
}
bool App::EventRecieved(GenericEvent& e)
{
if (e.Type == "DISPLAY_CLOSED")
{
mSIGTERM = true;
}
return false;
}

View File

@@ -1,15 +1,14 @@
#ifndef AEON_AEON_H_
#define AEON_AEON_H_
#include <Aeon/Includes.hpp>
#include <Aeon/Core/Display.hpp>
#include <Aeon/Core/Events.hpp>
#include <Aeon/Core/GameLayer.hpp>
#include <Aeon/Entity/Entity.hpp>
#include <Aeon/Includes.hpp>
#include <Aeon/Input/Input.hpp>
#include <Aeon/Entity/EntityController.hpp>
namespace Core
namespace Core
{
// NOTE: Derivations / children of "App" cannot attatch
@@ -17,46 +16,46 @@ namespace Core
// first add a gamelayer to handle events
// App stores the GLOBAL gamestate
// It is OK to store this globally
// It is OK to store this globally
// every component needs to use state
class App : public EventListener
{
public:
App( const AppProperties& props, const DisplayProperties& dispProps );
App(const AppProperties& props, const DisplayProperties& dispProps);
void Run();
void Run();
const Display& GetDisplay();
const Display& GetDisplay();
EC::Registry& GetEntityRegistry();
// Layers, once assigned, until poped are assumed to
// never change their spot in the layer hierarchy
void PushLayer( GameLayer* layer );
void PushTopLayer( GameLayer* layer );
void PushDebugLayer( GameLayer* layer );
// Layers, once assigned, until poped are assumed to
// never change their spot in the layer hierarchy
void PushLayer(GameLayer* layer);
void PushTopLayer(GameLayer* layer);
void PushDebugLayer(GameLayer* layer);
bool EventRecieved( GenericEvent& e ) override;
bool EventRecieved(GenericEvent& e) override;
public:
void PopLayer();
void PopTopLayer();
void PopDebugLayer();
void PopLayer();
void PopTopLayer();
void PopDebugLayer();
private:
Display mDisplay;
Display mDisplay;
EC::EntityRegistry mEntityController;
Input::InputController& mInput;
EC::Registry mEntityRegistry;
Input::InputController& mInput;
// Game layers from z order
std::vector<GameLayer*> mGameLayers;
std::vector<GameLayer*> mTopLayers;
std::vector<GameLayer*> mDebugLayers;
// Game layers from z order
std::vector<GameLayer*> mGameLayers;
std::vector<GameLayer*> mTopLayers;
std::vector<GameLayer*> mDebugLayers;
private:
bool mSIGTERM = false;
bool mSIGTERM = false;
};
}
} // namespace Core
#endif

View File

@@ -1,143 +1,143 @@
#include "Display.hpp"
#include <Aeon/Includes.hpp>
#include <Aeon/Assert.hpp>
#include <Aeon/Rendering/RenderMaster.hpp>
#include <Aeon/Includes.hpp>
#include <Aeon/Rendering/ImGui.hpp>
#include <yolo/yolo.hpp>
using Core::Display;
Display::Display()
: mWindow( nullptr )
, mContext( NULL )
, mRenderer( Rendering::RenderMaster::GetInstance() )
, mClearColour{ 1.0f, 1.0f, 1.0f, 1.0f }
: mWindow(nullptr), mContext(NULL), mClearColour {1.0f, 1.0f, 1.0f, 1.0f}
{
PushThisAsSink( "ENGINE_DISPLAY_CORE" );
mYoloModule = yolo::registerModule("DISPLAY", "\e[0;33m");
PushThisAsSink("ENGINE_DISPLAY_CORE");
}
Display::~Display()
{
}
bool Display::Create( const DisplayProperties& properties )
bool Display::Create(const DisplayProperties& properties)
{
SDL_Init( SDL_INIT_VIDEO );
SDL_Init(SDL_INIT_VIDEO);
SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 8 );
SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 8 );
SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 8 );
SDL_GL_SetAttribute( SDL_GL_ALPHA_SIZE, 8 );
SDL_GL_SetAttribute( SDL_GL_BUFFER_SIZE, 32 );
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, 32);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute( SDL_GL_MULTISAMPLEBUFFERS, 1 );
SDL_GL_SetAttribute( SDL_GL_MULTISAMPLESAMPLES, 4 );
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4);
SDL_GL_SetAttribute( SDL_GL_CONTEXT_MAJOR_VERSION, 4 );
SDL_GL_SetAttribute( SDL_GL_CONTEXT_MINOR_VERSION, 5 );
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 5);
mWindow = SDL_CreateWindow( properties.Name.c_str(),
SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED, properties.Width, properties.Height,
SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE );
mWindow = SDL_CreateWindow(properties.Name.c_str(),
SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED,
properties.Width,
properties.Height,
SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE);
AEON_ASSERT( mWindow, "Can't initialise window" );
AEON_ASSERT(mWindow, "Can't initialise window");
mContext = SDL_GL_CreateContext( mWindow );
mContext = SDL_GL_CreateContext(mWindow);
AEON_ASSERT( mContext, "Can't initialise context" );
AEON_ASSERT(mContext, "Can't initialise context");
SDL_GL_SetSwapInterval( static_cast<int>(!properties.VSync) );
SDL_GL_SetSwapInterval(static_cast<int>(!properties.VSync));
gladLoadGLLoader( SDL_GL_GetProcAddress );
glEnable( GL_MULTISAMPLE );
glCullFace( GL_BACK );
glEnable( GL_DEPTH_TEST );
gladLoadGLLoader(SDL_GL_GetProcAddress);
glEnable(GL_MULTISAMPLE);
glCullFace(GL_BACK);
glEnable(GL_DEPTH_TEST);
mWidth = properties.Width;
mHeight = properties.Height;
mWidth = properties.Width;
mHeight = properties.Height;
Rendering::SetupImGui( mWindow, mContext );
Rendering::SetupImGui(mWindow, mContext);
// Make sure ImGUI is ready to be used on the first frame
ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplSDL2_NewFrame();
ImGui::NewFrame();
// Make sure ImGUI is ready to be used on the first frame
ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplSDL2_NewFrame();
ImGui::NewFrame();
return true;
return true;
}
const unsigned int Display::GetWidth()
{
return mWidth;
return mWidth;
}
const unsigned int Display::GetHeight()
{
return mHeight;
return mHeight;
}
const SDL_Window* Display::GetWindow()
{
return mWindow;
return mWindow;
}
const SDL_GLContext& Display::GetContext()
{
return mContext;
return mContext;
}
void Display::SetClearColour( float r, float g, float b, float a )
void Display::SetClearColour(float r, float g, float b, float a)
{
mClearColour[0] = r * a;
mClearColour[1] = g * a;
mClearColour[2] = b * a;
mClearColour[3] = a;
mClearColour[0] = r * a;
mClearColour[1] = g * a;
mClearColour[2] = b * a;
mClearColour[3] = a;
}
void Display::EndFrame()
{
ImGui::Render();
ImGui_ImplOpenGL3_RenderDrawData( ImGui::GetDrawData() );
SDL_GL_SwapWindow( mWindow );
glClearColor( mClearColour[0], mClearColour[1], mClearColour[2], mClearColour[3] );
glClear( GL_COLOR_BUFFER_BIT );
ImGui::Render();
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplSDL2_NewFrame();
ImGui::NewFrame();
SDL_GL_SwapWindow(mWindow);
glClearColor(mClearColour[0], mClearColour[1], mClearColour[2], mClearColour[3]);
glClear(GL_COLOR_BUFFER_BIT);
ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplSDL2_NewFrame();
ImGui::NewFrame();
}
void Display::Destroy()
{
Rendering::CleanupImGui();
SDL_DestroyWindow( mWindow );
// dangly balls
mWindow = nullptr;
mWidth = 0;
mHeight = 0;
Rendering::CleanupImGui();
SDL_DestroyWindow(mWindow);
// dangly balls
mWindow = nullptr;
mWidth = 0;
mHeight = 0;
}
bool Display::EventRecieved( GenericEvent& e )
bool Display::EventRecieved(GenericEvent& e)
{
if ( e.Type == "DISPLAY_RESIZE" )
{
mWidth = e.x;
mHeight = e.y;
return true;
}
yolo::info(mYoloModule, "Recieved Event {}", e.Type.c_str());
if ( e.Type == "DISPLAY_MOVE" )
{
mX = e.x;
mY = e.y;
return true;
}
if (e.Type == "DISPLAY_RESIZE")
{
mWidth = e.x;
mHeight = e.y;
return true;
}
return false;
if (e.Type == "DISPLAY_MOVE")
{
mX = e.x;
mY = e.y;
return true;
}
return false;
}

View File

@@ -1,15 +1,12 @@
#ifndef AEON_CORE_DISPLAY_H_
#define AEON_CORE_DISPLAY_H_
#include <Aeon/Includes.hpp>
#include <Aeon/Rendering/RenderMaster.hpp>
#include <Aeon/Core/EngineConfig.hpp>
#include <Aeon/Core/Events.hpp>
#include <Aeon/Includes.hpp>
using namespace Rendering;
namespace Core {
namespace Core
{
class Display : public EventListener
{
@@ -17,7 +14,7 @@ public:
Display();
~Display();
bool Create( const DisplayProperties& properties );
bool Create(const DisplayProperties& properties);
const unsigned int GetWidth();
const unsigned int GetHeight();
@@ -25,29 +22,31 @@ public:
const SDL_Window* GetWindow();
const SDL_GLContext& GetContext();
void SetClearColour( float r, float g, float b, float a = 1.0f );
void SetClearColour(float r, float g, float b, float a = 1.0f);
void EndFrame();
void Destroy();
bool EventRecieved( GenericEvent& e ) override;
bool EventRecieved(GenericEvent& e) override;
private:
SDL_Window* mWindow;
SDL_GLContext mContext;
RenderMaster& mRenderer;
unsigned int mWidth, mHeight = 0;
unsigned int mX, mY = 0;
float mClearColour[4];
private:
Display( Display const& ) = delete;
void operator=( Display const& ) = delete;
uint8_t mYoloModule;
private:
Display(Display const&)
= delete;
void operator=(Display const&) = delete;
};
}
} // namespace Core
#endif

View File

@@ -1,6 +1,8 @@
#ifndef AEON_CORE_ENGINECONFIG_H_
#define AEON_CORE_ENGINECONFIG_H_
#include <Aeon/Includes.hpp>
namespace Core
{

View File

@@ -1,263 +1,268 @@
#include "Events.hpp"
#include <Aeon/Assert.hpp>
#include <yolo/yolo.hpp>
using Core::GenericEvent;
using Core::EventListener;
using Core::EventDispatcher;
using Core::EventListener;
using Core::EventManager;
using Core::GenericEvent;
// TODO: Events should use pre-allocated memory ALWAYS!
// TODO: Look into Bump Allocation
EventListener::EventListener()
{
}
EventListener::~EventListener()
{
}
void EventListener::PushThisAsSink( std::string system )
void EventListener::PushThisAsSink(std::string system)
{
mListenerID = EventManager::GetInstance().RegisterSinkPush( this, system );
AEON_ASSERT( mListenerID != -1, "Cannot register event sink" );
mListenerID = EventManager::GetInstance().RegisterSinkPush(this, system);
AEON_ASSERT(mListenerID != -1, "Cannot register event sink");
}
void EventListener::PushAndStickThisAsSink( std::string system )
void EventListener::PushAndStickThisAsSink(std::string system)
{
mListenerID = EventManager::GetInstance().RegisterSinkPushStick( this, system );
AEON_ASSERT( mListenerID != -1, "Cannot register event sink" );
mListenerID = EventManager::GetInstance().RegisterSinkPushStick(this, system);
AEON_ASSERT(mListenerID != -1, "Cannot register event sink");
}
void EventListener::UnshiftThisAsSink( std::string system )
void EventListener::UnshiftThisAsSink(std::string system)
{
mListenerID = EventManager::GetInstance().RegisterSinkUnshift( this, system );
AEON_ASSERT( mListenerID != -1, "Cannot register event sink" );
mListenerID = EventManager::GetInstance().RegisterSinkUnshift(this, system);
AEON_ASSERT(mListenerID != -1, "Cannot register event sink");
}
void EventListener::ShiftSinkLeft( std::string forSystem )
void EventListener::ShiftSinkLeft(std::string forSystem)
{
EventManager::GetInstance().MoveSinkLeft( this, forSystem );
EventManager::GetInstance().MoveSinkLeft(this, forSystem);
}
void EventListener::ShiftSinkRight( std::string forSystem )
void EventListener::ShiftSinkRight(std::string forSystem)
{
EventManager::GetInstance().MoveSinkRight( this, forSystem );
EventManager::GetInstance().MoveSinkRight(this, forSystem);
}
void EventListener::DeRegisterAsSink( std::string system )
void EventListener::DeRegisterAsSink(std::string system)
{
}
EventDispatcher::EventDispatcher()
{
}
EventDispatcher::EventDispatcher( std::string system )
EventDispatcher::EventDispatcher(std::string system)
{
RegisterAsSource( system );
RegisterAsSource(system);
}
EventDispatcher::~EventDispatcher()
{
}
void EventDispatcher::RegisterAsSource( std::string system )
void EventDispatcher::RegisterAsSource(std::string system)
{
mDispatcherID = EventManager::GetInstance().RegisterSource( this, system );
AEON_ASSERT( mDispatcherID != -1, "Cannot register event source" );
mSystem = system;
mDispatcherID = EventManager::GetInstance().RegisterSource(this, system);
AEON_ASSERT(mDispatcherID != -1, "Cannot register event source");
mSystem = system;
}
void EventDispatcher::DeRegisterAsSource( std::string system )
void EventDispatcher::DeRegisterAsSource(std::string system)
{
}
void EventDispatcher::Dispatch( GenericEvent e )
void EventDispatcher::Dispatch(GenericEvent e)
{
e.System = mSystem;
EventManager::GetInstance().Dispatch( mDispatcherID, e );
e.System = mSystem;
EventManager::GetInstance().Dispatch(mDispatcherID, e);
}
void EventDispatcher::Dispatch( std::string type )
void EventDispatcher::Dispatch(std::string type)
{
GenericEvent e;
e.Type = type;
e.System = mSystem;
EventManager::GetInstance().Dispatch( mDispatcherID, e );
GenericEvent e;
e.Type = type;
e.System = mSystem;
EventManager::GetInstance().Dispatch(mDispatcherID, e);
}
EventManager::EventManager()
{
}
EventManager::~EventManager()
{
}
int EventManager::RegisterSource( EventDispatcher* source, std::string system )
int EventManager::RegisterSource(EventDispatcher* source, std::string system)
{
int id = mNextHeighest;
mSources[id] = system;
mNextHeighest++;
return id;
int id = mNextHeighest;
mSources[id] = system;
mNextHeighest++;
return id;
}
int EventManager::RegisterSinkPush( EventListener* sink, std::string system )
int EventManager::RegisterSinkPush(EventListener* sink, std::string system)
{
int id = mNextHeighest;
mListeners[id] = sink;
int id = mNextHeighest;
mListeners[id] = sink;
auto& sinkVector = mSinks[system];
sinkVector.push_back( { sink, id } );
auto& sinkVector = mSinks[system];
sinkVector.push_back({sink, id});
mNextHeighest++;
return id;
mNextHeighest++;
return id;
}
int EventManager::RegisterSinkPushStick( EventListener* sink, std::string system )
int EventManager::RegisterSinkPushStick(EventListener* sink, std::string system)
{
int id = mNextHeighest;
mListeners[id] = sink;
int id = mNextHeighest;
mListeners[id] = sink;
auto& sinkVector = mStickySinks[system];
sinkVector.push_back( { sink, id } );
auto& sinkVector = mStickySinks[system];
sinkVector.push_back({sink, id});
mNextHeighest++;
return id;
mNextHeighest++;
return id;
}
int EventManager::RegisterSinkUnshift( EventListener* sink, std::string system )
int EventManager::RegisterSinkUnshift(EventListener* sink, std::string system)
{
int id = mNextHeighest;
mListeners[id] = sink;
int id = mNextHeighest;
mListeners[id] = sink;
if ( !mSinks.count( system ) )
{
return RegisterSinkPush( sink, system );
}
if (!mSinks.count(system))
{
return RegisterSinkPush(sink, system);
}
auto& sinkVector = mSinks[system];
sinkVector.insert( sinkVector.begin(), { sink, id } );
auto& sinkVector = mSinks[system];
sinkVector.insert(sinkVector.begin(), {sink, id});
mNextHeighest++;
return id;
mNextHeighest++;
return id;
}
void EventManager::MoveSinkLeft( EventListener* sink, std::string system )
void EventManager::MoveSinkLeft(EventListener* sink, std::string system)
{
}
void EventManager::MoveSinkRight( EventListener* sink, std::string system )
void EventManager::MoveSinkRight(EventListener* sink, std::string system)
{
}
void EventManager::RemoveSource( int dispatcherID, std::string system )
void EventManager::RemoveSource(int dispatcherID, std::string system)
{
}
void EventManager::RemoveSink( int listenerID, std::string system )
void EventManager::RemoveSink(int listenerID, std::string system)
{
}
// it is important to reverse the lists so that the dispatching is done correctly
// this is more efficiently done at insert... lol
template <typename C>
struct reverse_wrapper {
struct reverse_wrapper
{
C& c_;
reverse_wrapper(C& c) : c_(c) {}
C& c_;
reverse_wrapper(C& c) : c_(c)
{}
typename C::reverse_iterator begin() { return c_.rbegin(); }
typename C::reverse_iterator end() { return c_.rend(); }
typename C::reverse_iterator begin()
{
return c_.rbegin();
}
typename C::reverse_iterator end()
{
return c_.rend();
}
};
template <typename C, size_t N>
struct reverse_wrapper< C[N] > {
struct reverse_wrapper<C[N]>
{
C(&c_)[N];
reverse_wrapper(C(&c)[N]) : c_(c) {}
C(&c_)
[N];
reverse_wrapper(C (&c)[N]) : c_(c)
{}
typename std::reverse_iterator<const C*> begin() { return std::rbegin(c_); }
typename std::reverse_iterator<const C*> end() { return std::rend(c_); }
typename std::reverse_iterator<const C*> begin()
{
return std::rbegin(c_);
}
typename std::reverse_iterator<const C*> end()
{
return std::rend(c_);
}
};
template <typename C>
reverse_wrapper<C> r_wrap(C& c) {
return reverse_wrapper<C>(c);
reverse_wrapper<C> r_wrap(C& c)
{
return reverse_wrapper<C>(c);
}
void EventManager::Dispatch( int dispatcherID, GenericEvent e )
void EventManager::Dispatch(int dispatcherID, GenericEvent e)
{
std::string targetSink = mSources[dispatcherID];
auto stickySinks = mStickySinks[targetSink];
auto sinks = mSinks[targetSink];
std::string targetSink = mSources[dispatcherID];
auto stickySinks = mStickySinks[targetSink];
auto sinks = mSinks[targetSink];
if ( !stickySinks.empty() )
{
for ( auto& listenerPair : r_wrap(stickySinks))
{
EventListener* listener = std::get<0>( listenerPair );
bool handled = listener->EventRecieved( e );
if ( handled ) e.Handled = handled;
if (!stickySinks.empty())
{
for (auto& listenerPair : r_wrap(stickySinks))
{
EventListener* listener = std::get<0>(listenerPair);
bool handled = listener->EventRecieved(e);
if (handled)
e.Handled = handled;
if ( e.Handled )
{
// destroy event
return;
}
}
}
if (e.Handled)
{
// destroy event
return;
}
}
}
if (!sinks.empty())
{
for (auto& listenerPair : r_wrap(sinks))
{
EventListener* listener = std::get<0>(listenerPair);
bool handled = listener->EventRecieved(e);
if (handled) e.Handled = handled;
if (!sinks.empty())
{
for (auto& listenerPair : r_wrap(sinks))
{
EventListener* listener = std::get<0>(listenerPair);
bool handled = listener->EventRecieved(e);
if (handled)
e.Handled = handled;
if (e.Handled)
{
// destroy event
return;
}
}
}
if (e.Handled)
{
// destroy event
return;
}
}
}
}
void EventManager::DebugPrint()
{
std::cout << "----- BEGIN EVENTS DEBUG -----" << std::endl;
for (auto const& [dispatcher, targetSink] : mSources)
{
auto stickySinks = mStickySinks[targetSink];
auto sinks = mSinks[targetSink];
yolo::debug("----- BEGIN EVENTS DEBUG -----");
int sourceCount = 0;
for (auto const& [id, source] : mSources)
if (source == targetSink) sourceCount++;
for (auto const& [dispatcher, targetSink] : mSources)
{
auto stickySinks = mStickySinks[targetSink];
auto sinks = mSinks[targetSink];
std::cout << targetSink << " has " << stickySinks.size() << " sticky and " << sinks.size() << " sink(s) and is being dispatched from " << sourceCount << " different source(s)" << std::endl;
}
std::cout << "----- END EVENTS DEBUG -----" << std::endl;
int sourceCount = 0;
for (auto const& [id, source] : mSources)
if (source == targetSink)
sourceCount++;
yolo::debug("{} has {} sticky and {} sink(s) and is being dispatched from {} dufferent source(s)", targetSink, stickySinks.size(), sinks.size(), sourceCount);
}
yolo::debug("----- END EVENTS DEBUG -----");
}

View File

@@ -2,173 +2,176 @@
#define AEON_CORE_EVENTS_H_
/*
- Events have a source and a sink, where from and where too
- Event sinks are systems that events are dispatched to from
a source of the same system
- Event listeners are layered, 0 is front, larger is back so
events propogate from the front to the back, not going
further once handled
- Event sources can only dispatch events to a single system
- Systems can request to only receive events from a certain
"system" category, or multiple
- Events are blocking for now
- Events have a source and a sink, where from and where too
- Event sinks are systems that events are dispatched to from
a source of the same system
- Event listeners are layered, 0 is front, larger is back so
events propogate from the front to the back, not going
further once handled
- Event sources can only dispatch events to a single system
- Systems can request to only receive events from a certain
"system" category, or multiple
- Events are blocking for now
*/
#include <Aeon/Includes.hpp>
#include <Aeon/Singleton.hpp>
#include <Aeon/Input/InputMap.hpp>
#include <Aeon/Singleton.hpp>
namespace Core
namespace Core
{
// THis needs some redesigning so i can do this.AttachSpecificListener(Type, Action, [&] => {...})
// More specifically to support enumerator calling AND custom defined string calling
// Maybe through a reserved enumeration map 0-100: system etc..
/*
* Engine event systems / type
* ENGINE_SYSTEM_CORE - start, stop, pause, etc
* ENGINE_START - starts game loop execution
* ENGINE_STOP
* ENGINE_PAUSE
* ENGINE_DISPLAY_CORE - window open, window close, etc
* DISPLAY_RESIZE (x, y) - rezise to x, y being new w, h
* DISPLAY_MOVE (x, y) - move to x, y
* DISPLAY_SHOW - no data
* DISPLAY_HIDE - no data
* DISPLAY_MINIMISED - no data
* DISPLAY_MAXIMISED - no data
* DISPLAY_CLOSED - no data
* DISPLAY_MOUSE_ENTER - no data
* DISPLAY_MOUSE_LEAVE - no data
* DISPLAY_FOCUS - no data
* DISPLAY_OUT_OF_FOCUS - no data
* ENGINE_INPUT_MOUSE
* MOUSE_LEFT_DOWN - no data
* MOUSE_LEFT_UP - no data
* MOUSE_RIGHT_DOWN - no data
* MOUSE_RIGHT_UP - no data
* MOUSE_MIDDLE_DOWN - no data
* MOUSE_MIDDLE_UP - no data
* MOUSE_SCROLL - y+-
* MOUSE_MOVE - move to x, y relative dx, dy
* ENGINE_INPUT_KEYBOARD
* KEYBOARD_KEYDOWN - keycode, keymod
* KEYBOARD_KEYUP - keycode, keymod
* KEYBOARD_KEYPRESS - keycode for continual pressing, keymod
*/
* Engine event systems / type
* ENGINE_SYSTEM_CORE - start, stop, pause, etc
* ENGINE_START - starts game loop execution
* ENGINE_STOP
* ENGINE_PAUSE
* ENGINE_DISPLAY_CORE - window open, window close, etc
* DISPLAY_RESIZE (x, y) - rezise to x, y being new w, h
* DISPLAY_MOVE (x, y) - move to x, y
* DISPLAY_SHOW - no data
* DISPLAY_HIDE - no data
* DISPLAY_MINIMISED - no data
* DISPLAY_MAXIMISED - no data
* DISPLAY_CLOSED - no data
* DISPLAY_MOUSE_ENTER - no data
* DISPLAY_MOUSE_LEAVE - no data
* DISPLAY_FOCUS - no data
* DISPLAY_OUT_OF_FOCUS - no data
* ENGINE_INPUT_MOUSE
* MOUSE_LEFT_DOWN - no data
* MOUSE_LEFT_UP - no data
* MOUSE_RIGHT_DOWN - no data
* MOUSE_RIGHT_UP - no data
* MOUSE_MIDDLE_DOWN - no data
* MOUSE_MIDDLE_UP - no data
* MOUSE_SCROLL - y+-
* MOUSE_MOVE - move to x, y relative dx, dy
* ENGINE_INPUT_KEYBOARD
* KEYBOARD_KEYDOWN - keycode, keymod
* KEYBOARD_KEYUP - keycode, keymod
* KEYBOARD_KEYPRESS - keycode for continual pressing, keymod
*/
struct GenericEvent
{
// always populated
std::string System;
std::string Type;
// the rest can be empty
// user defined
std::string Data;
// always populated
std::string System;
std::string Type;
// DISPLAY_RESIZE DISPLAY_MOVE MOUSE_MOVE
int x, y;
// MOUSE_MOVE
int dx, dy;
// KEYBOARD_KEYDOWN KEYBOARD_KEYUP KEYBOARD_PRESSED
Input::EKeyCode keyCode;
uint16_t keyMods;
// the rest can be empty
// user defined
std::string Data;
bool Handled = false;
// DISPLAY_RESIZE DISPLAY_MOVE MOUSE_MOVE
int x, y;
// MOUSE_MOVE
int dx, dy;
// KEYBOARD_KEYDOWN KEYBOARD_KEYUP KEYBOARD_PRESSED
Input::EKeyCode keyCode;
uint16_t keyMods;
// USER EVENTS
void* UserData = nullptr;
bool Handled = false;
};
class EventListener
{
public:
EventListener();
virtual ~EventListener();
EventListener();
virtual ~EventListener();
// Pushes sink to the top of the listener stack
// underneath the stuck listeners
void PushThisAsSink( std::string system );
// Pushes sink to the top of the listener stack
// with all of the other "stuck" listeners
void PushAndStickThisAsSink( std::string system );
// Pushes sink to the bottom of the listener stack
void UnshiftThisAsSink( std::string system );
// Pushes sink to the top of the listener stack
// underneath the stuck listeners
void PushThisAsSink(std::string system);
// Pushes sink to the top of the listener stack
// with all of the other "stuck" listeners
void PushAndStickThisAsSink(std::string system);
// Pushes sink to the bottom of the listener stack
void UnshiftThisAsSink(std::string system);
void ShiftSinkLeft( std::string forSystem );
void ShiftSinkRight( std::string forSystem );
void ShiftSinkLeft(std::string forSystem);
void ShiftSinkRight(std::string forSystem);
void DeRegisterAsSink( std::string system );
void DeRegisterAsSink(std::string system);
// return true = event handled and will not be further
// propogated
virtual bool EventRecieved( GenericEvent& e ) = 0;
// return true = event handled and will not be further
// propogated
virtual bool EventRecieved(GenericEvent& e) = 0;
private:
int mListenerID = -1;
int mListenerID = -1;
friend class EventManager;
friend class EventManager;
};
class EventDispatcher
{
public:
EventDispatcher();
EventDispatcher( std::string system );
~EventDispatcher();
EventDispatcher();
EventDispatcher(std::string system);
~EventDispatcher();
void RegisterAsSource( std::string system );
void DeRegisterAsSource( std::string system );
void RegisterAsSource(std::string system);
void DeRegisterAsSource(std::string system);
void Dispatch( GenericEvent e );
// no data needed, listeners act on the event happening
void Dispatch( std::string type );
void Dispatch(GenericEvent e);
// no data needed, listeners act on the event happening
void Dispatch(std::string type);
private:
std::string mSystem;
int mDispatcherID = -1;
std::string mSystem;
int mDispatcherID = -1;
friend class EventManager;
friend class EventManager;
};
class EventManager : public Helpers::Singleton<EventManager>
{
public:
EventManager();
~EventManager();
EventManager();
~EventManager();
int RegisterSource( EventDispatcher* source, std::string system );
int RegisterSource(EventDispatcher* source, std::string system);
int RegisterSinkPush( EventListener* sink, std::string system );
int RegisterSinkPushStick( EventListener* sink, std::string system );
int RegisterSinkUnshift( EventListener* sink, std::string system );
int RegisterSinkPush(EventListener* sink, std::string system);
int RegisterSinkPushStick(EventListener* sink, std::string system);
int RegisterSinkUnshift(EventListener* sink, std::string system);
void MoveSinkLeft( EventListener* sink, std::string system );
void MoveSinkRight( EventListener* sink, std::string system );
void MoveSinkLeft(EventListener* sink, std::string system);
void MoveSinkRight(EventListener* sink, std::string system);
void RemoveSource( int dispatcherID, std::string system );
void RemoveSink( int listenerID, std::string system );
void RemoveSource(int dispatcherID, std::string system);
void Dispatch( int dispatcherID, GenericEvent e );
void RemoveSink(int listenerID, std::string system);
void DebugPrint();
void Dispatch(int dispatcherID, GenericEvent e);
void DebugPrint();
private:
// indexed by listener ID for quick lookup
std::map<int, const EventListener*> mListeners;
// indexed by dispatcher ID for itteration
std::map<int, std::string> mSources;
// indexed by (sink) system ID (string)
// their position in the vector is their layer
std::map<std::string, std::vector<std::tuple<EventListener*, int>>> mStickySinks;
std::map<std::string, std::vector<std::tuple<EventListener*, int>>> mSinks;
// indexed by listener ID for quick lookup
std::map<int, const EventListener*> mListeners;
// indexed by dispatcher ID for itteration
std::map<int, std::string> mSources;
// indexed by (sink) system ID (string)
// their position in the vector is their layer
std::map<std::string, std::vector<std::tuple<EventListener*, int>>> mStickySinks;
std::map<std::string, std::vector<std::tuple<EventListener*, int>>> mSinks;
int mNextHeighest = 0;
int mNextHeighest = 0;
private:
uint8_t mYoloModule;
};
}
} // namespace Core
#endif

View File

@@ -2,6 +2,7 @@
#define AEON_CORE_GAMELAYER_H_
#include <Aeon/Core/Events.hpp>
#include <Aeon/Entity/Entity.hpp>
namespace Core
{
@@ -9,15 +10,12 @@ namespace Core
class GameLayer : public EventListener
{
public:
virtual void Attach() = 0;
virtual void FrameTick() = 0;
virtual void TimeTick() = 0;
virtual void Detach() = 0;
protected:
virtual void Attach() = 0;
virtual void FrameTick() = 0;
virtual void TimeTick() = 0;
virtual void Detach() = 0;
};
}
} // namespace Core
#endif

View File

@@ -1,70 +0,0 @@
#ifndef AEON_ENTITY_COMPONENTCONTROLLER_H_
#define AEON_ENTITY_COMPONENTCONTROLLER_H_
#include <Aeon/Includes.hpp>
struct Entity;
namespace EC
{
// I wish i diddn't have to do it like this
// someone fix this ahaha
struct IComponentContainer
{
virtual void Create(const Entity) = 0;
virtual void Destroy(const Entity) = 0;
};
template <typename TComponent>
struct ComponentContainer : public IComponentContainer
{
ComponentContainer()
{
}
void Create(const Entity) override
{
}
void Destroy(const Entity) override
{
}
private:
};
class ComponentController
{
public:
inline ComponentController()
{
}
inline ~ComponentController()
{
}
template <typename TComponent>
inline void Register()
{
std::string componentTypeName = static_cast<std::string>(typeid(TComponent).name());
std::cout << componentTypeName << std::endl;
}
private:
// std::map<std::string, IComponentContainer> mComponentContainers;
};
}
#endif

View File

@@ -0,0 +1,16 @@
#ifndef AEON_ENTITY_CORECOMPONENTS_MATERIAL_H_
#define AEON_ENTITY_CORECOMPONENTS_MATERIAL_H_
#include <Aeon/Rendering/Material.hpp>
namespace EC
{
struct MaterialComponent
{
MaterialHandle Handle;
};
}; // namespace EC
#endif

View File

@@ -0,0 +1,16 @@
#ifndef AEON_ENTITY_CORECOMPONENTS_MESH_H_
#define AEON_ENTITY_CORECOMPONENTS_MESH_H_
#include <Aeon/Rendering/Mesh.hpp>
namespace EC
{
struct MeshComponent
{
MeshHandle Handle;
};
}; // namespace EC
#endif

View File

@@ -1,10 +0,0 @@
#ifndef AEON_ENTITY_CORECOMPONENTS_POSITIONCOMPONENT_H_
#define AEON_ENTITY_CORECOMPONENTS_POSITIONCOMPONENT_H_
template <typename T, uint8_t D>
struct Position
{
// Vector<D, T> data;
}
#endif

View File

@@ -0,0 +1,25 @@
#ifndef AEON_ENTITY_CORECOMPONENTS_TRANSFORM_H_
#define AEON_ENTITY_CORECOMPONENTS_TRANSFORM_H_
#include <glm/glm.hpp>
#include <glm/gtx/quaternion.hpp>
namespace EC
{
struct Transform
{
Transform(glm::vec3 position) : Position(position)
{
}
glm::vec3 Position;
glm::quat Rotation = glm::quat(1.0f, 0.0f, 0.0f, 0.0f);
float Scale = 1.0f;
glm::mat4 Model;
};
} // namespace EC
#endif

View File

@@ -1,18 +1,21 @@
#ifndef AEON_ENTITY_ENTITY_H_
#define AEON_ENTITY_ENTITY_H_
#include <Aeon/Includes.hpp>
#include <entt/entity/registry.hpp>
#include <entt/entt.hpp>
namespace EC
{
using Entity = entt::entity;
using Registry = entt::registry;
using Handle = entt::handle;
using Entity = uint32_t;
template <typename... Components>
using View = entt::basic_view<entt::entity, entt::exclude_t<>, Components...>;
struct EntityDebugMetadata
{
std::string DebugName;
};
using Dispatcher = entt::dispatcher;
}
static constexpr auto null = entt::null;
} // namespace EC
#endif

View File

@@ -1,51 +0,0 @@
#include "EntityController.hpp"
using namespace EC;
EntityRegistry::EntityRegistry()
{
}
EntityRegistry::~EntityRegistry()
{
}
Entity EntityRegistry::Create()
{
uint32_t entityId;
if ( mFreedEntities.empty() )
{
mEntityCeiling++;
entityId = mEntityCeiling;
}
else
{
mFreedEntities.pop();
}
mEntities[entityId] = std::vector<std::string>();
return entityId;
}
Entity Copy( const Entity& entity )
{
// look up everything, create a new entity and populate
// with the components in the og entity
return static_cast<uint32_t>( 0 );
}
void EntityRegistry::Destroy( Entity entity )
{
if ( !this->Valid( entity ) ) return;
mFreedEntities.push(entity);
mEntities.erase(entity);
}
bool EntityRegistry::Valid( const Entity entity )
{
return mEntities.find(entity) != mEntities.end();
}

View File

@@ -1,64 +0,0 @@
#ifndef AEON_ENTITY_ENTITYCONTROLLER_H_
#define AEON_ENTITY_ENTITYCONTROLLER_H_
#include <Aeon/Includes.hpp>
#include <Aeon/Entity/Entity.hpp>
namespace EC
{
// TODO: Entities space in memory should be pre-allocated
// using the engine's lifecycle bump allocator
class EntityRegistry
{
public:
EntityRegistry();
~EntityRegistry();
Entity Create();
Entity Copy( const Entity entity );
void Destroy( Entity entity );
bool Valid( const Entity entity );
// add, replace components
template <typename TComponent>
TComponent& Add(const Entity entity);
template <typename TComponent>
TComponent& Replace(const Entity entity);
// replace in-place
template <typename TComponent>
TComponent& Patch(const Entity entity);
// Get component from entity based on T
template <typename TComponent>
TComponent& Get(const Entity entity);
// Get std::optional from entity based on T
template <typename TComponent>
std::optional<TComponent&> Opt(const Entity entity);
// TODO: Sort by component properties, for example list of
// entities with the renderable components, sorted by Y pos
// of position component
// template <typename T>
// std::vector<T&> Sort(std::function<;
private:
// Keep track of IDs that were freed for re-allocation
std::queue<uint32_t> mFreedEntities;
uint32_t mEntityCeiling = 0;
// Currently unused
std::unordered_map<Entity, EntityDebugMetadata> mEntityDebug;
// That's not very cache-friendly of you
// optimisations coming soon TM
std::unordered_map<Entity, std::vector<std::string>> mEntities;
};
}
#endif

11
Aeon/Handle.hpp Normal file
View File

@@ -0,0 +1,11 @@
#ifndef AEON_RENDERING_HANDLE_H_
#define AEON_RENDERING_HANDLE_H_
#include <Aeon/Includes.hpp>
constexpr uint32_t InvalidID = UINT32_MAX;
typedef uint32_t Handle;
#endif

View File

@@ -10,7 +10,7 @@
#endif
extern "C" {
#include <Aeon/ThirdParty/glad.h>
#include <glad.h>
}
#include <assert.h>

View File

@@ -1,76 +1,67 @@
#include "Input.hpp"
#include <Aeon/Includes.hpp>
#include <Aeon/Core/Events.hpp>
#include <Aeon/Includes.hpp>
#include <Aeon/Input/InputMap.hpp>
#include <Aeon/Rendering/ImGui.hpp>
using Input::InputController;
InputController::InputController()
: mEvent()
, mDisplayEventDispatcher()
, mKeyboardEventDispatcher()
, mMouseEventDispatcher()
: mEvent(), mDisplayEventDispatcher(), mKeyboardEventDispatcher(), mMouseEventDispatcher()
{
mDisplayEventDispatcher.RegisterAsSource( "ENGINE_DISPLAY_CORE" );
mMouseEventDispatcher.RegisterAsSource( "ENGINE_INPUT_MOUSE" );
mKeyboardEventDispatcher.RegisterAsSource( "ENGINE_INPUT_KEYBOARD" );
mDisplayEventDispatcher.RegisterAsSource("ENGINE_DISPLAY_CORE");
mMouseEventDispatcher.RegisterAsSource("ENGINE_INPUT_MOUSE");
mKeyboardEventDispatcher.RegisterAsSource("ENGINE_INPUT_KEYBOARD");
mKbdState = static_cast<const uint8_t*>(SDL_GetKeyboardState( &mNumScancodes ));
mKbdState = static_cast<const uint8_t*>(SDL_GetKeyboardState(&mNumScancodes));
}
InputController::~InputController()
{
mDisplayEventDispatcher.DeRegisterAsSource( "ENGINE_DISPLAY_CORE" );
mMouseEventDispatcher.DeRegisterAsSource( "ENGINE_INPUT_MOUSE" );
mKeyboardEventDispatcher.DeRegisterAsSource( "ENGINE_INPUT_KEYBOARD" );
mDisplayEventDispatcher.DeRegisterAsSource("ENGINE_DISPLAY_CORE");
mMouseEventDispatcher.DeRegisterAsSource("ENGINE_INPUT_MOUSE");
mKeyboardEventDispatcher.DeRegisterAsSource("ENGINE_INPUT_KEYBOARD");
// Do not free mKbdState as that is done by SDL
}
void InputController::PollInput()
{
//SDL_PumpEvents();
while ( SDL_PollEvent( &mEvent ) )
{
// SDL_PumpEvents();
while (SDL_PollEvent(&mEvent))
{
// Provide to non-event driven subsystem
ImGui_ImplSDL2_ProcessEvent( &mEvent );
ImGui_ImplSDL2_ProcessEvent(&mEvent);
switch ( mEvent.type )
{
case SDL_WINDOWEVENT:
{
switch (mEvent.type)
{
case SDL_WINDOWEVENT: {
mPollDisplay();
break;
}
case SDL_MOUSEWHEEL:
{
}
case SDL_MOUSEWHEEL: {
mPollScroll();
break;
}
case SDL_MOUSEBUTTONDOWN:
case SDL_MOUSEBUTTONUP:
{
case SDL_MOUSEBUTTONUP: {
mPollClick();
break;
}
case SDL_MOUSEMOTION:
{
case SDL_MOUSEMOTION: {
mPollMouse();
break;
}
case SDL_KEYDOWN:
case SDL_KEYUP:
{
case SDL_KEYUP: {
mPollKeyboard();
}
}
}
}
}
// just in case
mKbdState = static_cast<const uint8_t*>(SDL_GetKeyboardState( &mNumScancodes ));
mKbdState = static_cast<const uint8_t*>(SDL_GetKeyboardState(&mNumScancodes));
// keyboard processing
mPollScanKeyboard();
@@ -78,69 +69,58 @@ void InputController::PollInput()
void InputController::mPollDisplay()
{
switch ( mEvent.window.event )
switch (mEvent.window.event)
{
case SDL_WINDOWEVENT_SHOWN:
{
mDisplayEventDispatcher.Dispatch( "DISPLAY_SHOW" );
case SDL_WINDOWEVENT_SHOWN: {
mDisplayEventDispatcher.Dispatch("DISPLAY_SHOW");
break;
}
case SDL_WINDOWEVENT_HIDDEN:
{
mDisplayEventDispatcher.Dispatch( "DISPLAY_HIDE" );
case SDL_WINDOWEVENT_HIDDEN: {
mDisplayEventDispatcher.Dispatch("DISPLAY_HIDE");
break;
}
case SDL_WINDOWEVENT_MOVED:
{
case SDL_WINDOWEVENT_MOVED: {
Core::GenericEvent e;
e.x = mEvent.window.data1;
e.y = mEvent.window.data2;
e.Type = "DISPLAY_MOVE";
mDisplayEventDispatcher.Dispatch( e );
mDisplayEventDispatcher.Dispatch(e);
break;
}
case SDL_WINDOWEVENT_RESIZED:
{
case SDL_WINDOWEVENT_RESIZED: {
Core::GenericEvent e;
e.x = mEvent.window.data1;
e.y = mEvent.window.data2;
e.Type = "DISPLAY_RESIZE";
mDisplayEventDispatcher.Dispatch( e );
mDisplayEventDispatcher.Dispatch(e);
break;
}
case SDL_WINDOWEVENT_MINIMIZED:
{
mDisplayEventDispatcher.Dispatch( "DISPLAY_MINIMISED" );
case SDL_WINDOWEVENT_MINIMIZED: {
mDisplayEventDispatcher.Dispatch("DISPLAY_MINIMISED");
break;
}
case SDL_WINDOWEVENT_MAXIMIZED:
{
mDisplayEventDispatcher.Dispatch( "DISPLAY_MAXIMISED" );
case SDL_WINDOWEVENT_MAXIMIZED: {
mDisplayEventDispatcher.Dispatch("DISPLAY_MAXIMISED");
break;
}
case SDL_WINDOWEVENT_ENTER:
{
mDisplayEventDispatcher.Dispatch( "DISPLAY_MOUSE_ENTER" );
case SDL_WINDOWEVENT_ENTER: {
mDisplayEventDispatcher.Dispatch("DISPLAY_MOUSE_ENTER");
break;
}
case SDL_WINDOWEVENT_LEAVE:
{
mDisplayEventDispatcher.Dispatch( "DISPLAY_MOUSE_LEAVE" );
case SDL_WINDOWEVENT_LEAVE: {
mDisplayEventDispatcher.Dispatch("DISPLAY_MOUSE_LEAVE");
break;
}
case SDL_WINDOWEVENT_FOCUS_GAINED:
{
mDisplayEventDispatcher.Dispatch( "DISPLAY_FOCUS" );
case SDL_WINDOWEVENT_FOCUS_GAINED: {
mDisplayEventDispatcher.Dispatch("DISPLAY_FOCUS");
break;
}
case SDL_WINDOWEVENT_FOCUS_LOST:
{
mDisplayEventDispatcher.Dispatch( "DISPLAY_OUT_OF_FOCUS" );
case SDL_WINDOWEVENT_FOCUS_LOST: {
mDisplayEventDispatcher.Dispatch("DISPLAY_OUT_OF_FOCUS");
break;
}
case SDL_WINDOWEVENT_CLOSE:
{
mDisplayEventDispatcher.Dispatch( "DISPLAY_CLOSED" );
case SDL_WINDOWEVENT_CLOSE: {
mDisplayEventDispatcher.Dispatch("DISPLAY_CLOSED");
break;
}
}
@@ -154,7 +134,7 @@ void InputController::mPollMouse()
e.dx = mEvent.motion.xrel;
e.dy = mEvent.motion.yrel;
e.Type = "MOUSE_MOVE";
mMouseEventDispatcher.Dispatch( e );
mMouseEventDispatcher.Dispatch(e);
}
void InputController::mPollScroll()
@@ -162,49 +142,43 @@ void InputController::mPollScroll()
Core::GenericEvent e;
e.y = mEvent.wheel.y;
e.Type = "MOUSE_SCROLL";
mMouseEventDispatcher.Dispatch( e );
mMouseEventDispatcher.Dispatch(e);
}
void InputController::mPollClick()
{
if ( mEvent.button.state == SDL_PRESSED )
if (mEvent.button.state == SDL_PRESSED)
{
switch ( mEvent.button.button )
switch (mEvent.button.button)
{
case SDL_BUTTON_LEFT:
{
mDisplayEventDispatcher.Dispatch( "MOUSE_LEFT_DOWN" );
case SDL_BUTTON_LEFT: {
mDisplayEventDispatcher.Dispatch("MOUSE_LEFT_DOWN");
break;
}
case SDL_BUTTON_RIGHT:
{
mDisplayEventDispatcher.Dispatch( "MOUSE_RIGHT_DOWN" );
case SDL_BUTTON_RIGHT: {
mDisplayEventDispatcher.Dispatch("MOUSE_RIGHT_DOWN");
break;
}
case SDL_BUTTON_MIDDLE:
{
mDisplayEventDispatcher.Dispatch( "MOUSE_MIDDLE_DOWN" );
case SDL_BUTTON_MIDDLE: {
mDisplayEventDispatcher.Dispatch("MOUSE_MIDDLE_DOWN");
break;
}
}
}
else if ( mEvent.button.state == SDL_RELEASED )
else if (mEvent.button.state == SDL_RELEASED)
{
switch ( mEvent.button.button )
switch (mEvent.button.button)
{
case SDL_BUTTON_LEFT:
{
mDisplayEventDispatcher.Dispatch( "MOUSE_LEFT_UP" );
case SDL_BUTTON_LEFT: {
mDisplayEventDispatcher.Dispatch("MOUSE_LEFT_UP");
break;
}
case SDL_BUTTON_RIGHT:
{
mDisplayEventDispatcher.Dispatch( "MOUSE_RIGHT_UP" );
case SDL_BUTTON_RIGHT: {
mDisplayEventDispatcher.Dispatch("MOUSE_RIGHT_UP");
break;
}
case SDL_BUTTON_MIDDLE:
{
mDisplayEventDispatcher.Dispatch( "MOUSE_MIDDLE_UP" );
case SDL_BUTTON_MIDDLE: {
mDisplayEventDispatcher.Dispatch("MOUSE_MIDDLE_UP");
break;
}
}
@@ -213,41 +187,41 @@ void InputController::mPollClick()
void InputController::mPollKeyboard()
{
EKeyCode keycode = KeyCodeFromSDL( mEvent.key.keysym.sym );
EKeyCode keycode = KeyCodeFromSDL(mEvent.key.keysym.sym);
Core::GenericEvent e;
e.keyCode = KeyCodeFromSDL(keycode);
if ( mEvent.key.state == SDL_PRESSED )
if (mEvent.key.state == SDL_PRESSED)
{
e.Type = "KEYBOARD_KEYDOWN";
}
else if ( mEvent.key.state == SDL_RELEASED )
else if (mEvent.key.state == SDL_RELEASED)
{
e.Type = "KEYBOARD_KEYUP";
}
uint16_t mods = mEvent.key.keysym.mod;
e.keyMods = mods;
mModKeyState = mods;
mKeyboardEventDispatcher.Dispatch( e );
mKeyboardEventDispatcher.Dispatch(e);
}
void InputController::mPollScanKeyboard()
{
//this is naive, can be optimised with double buffering
for ( int i = 0; i < mNumScancodes; i++ )
// this is naive, can be optimised with double buffering
for (int i = 0; i < mNumScancodes; i++)
{
bool isKeyPressed = (bool)mKbdState[i];
if ( isKeyPressed )
if (isKeyPressed)
{
EKeyCode whatKeyPressed = KeyCodeFromScanCode( (SDL_Scancode)i );
EKeyCode whatKeyPressed = KeyCodeFromScanCode((SDL_Scancode)i);
Core::GenericEvent e;
e.keyCode = whatKeyPressed;
e.keyMods = mModKeyState;
e.Type = "KEYBOARD_KEYPRESS";
mKeyboardEventDispatcher.Dispatch( e );
mKeyboardEventDispatcher.Dispatch(e);
}
}
}

View File

@@ -1,42 +1,43 @@
#ifndef AEON_INPUT_INPUT_H_
#define AEON_INPUT_INPUT_H_
#include <Aeon/Includes.hpp>
#include <Aeon/Singleton.hpp>
#include <Aeon/Core/Events.hpp>
#include <Aeon/Includes.hpp>
#include <Aeon/Singleton.hpp>
namespace Input
namespace Input
{
// confusing name, not part of the ecs
// could be tho
class InputController : public Helpers::Singleton<InputController>
{
public:
InputController();
~InputController();
InputController();
~InputController();
void PollInput();
void PollInput();
private:
void mPollDisplay();
void mPollMouse();
void mPollScroll();
void mPollClick();
void mPollKeyboard();
void mPollScanKeyboard();
void mPollDisplay();
void mPollMouse();
void mPollScroll();
void mPollClick();
void mPollKeyboard();
void mPollScanKeyboard();
private:
SDL_Event mEvent;
SDL_Event mEvent;
int mNumScancodes = 242;
const uint8_t* mKbdState;
uint16_t mModKeyState = 0x0;
int mNumScancodes = 242;
const uint8_t* mKbdState;
uint16_t mModKeyState = 0x0;
Core::EventDispatcher mDisplayEventDispatcher;
Core::EventDispatcher mKeyboardEventDispatcher;
Core::EventDispatcher mMouseEventDispatcher;
Core::EventDispatcher mDisplayEventDispatcher;
Core::EventDispatcher mKeyboardEventDispatcher;
Core::EventDispatcher mMouseEventDispatcher;
};
}
} // namespace Input
#endif

View File

@@ -3,9 +3,9 @@
#include <Aeon/Includes.hpp>
#include <Aeon/ThirdParty/ImGui/imgui.h>
#include <Aeon/ThirdParty/ImGui/imgui_impl_sdl.h>
#include <Aeon/ThirdParty/ImGui/imgui_impl_opengl3.h>
#include <ImGui/imgui.h>
#include <ImGui/imgui_impl_sdl.h>
#include <ImGui/imgui_impl_opengl3.h>
namespace Rendering
{

View File

@@ -0,0 +1,15 @@
#ifndef AEON_RENDERING_MATERIAL_H_
#define AEON_RENDERING_MATERIAL_H_
#include <Aeon/Includes.hpp>
#include <Aeon/Handle.hpp>
struct Material
{
};
typedef Handle MaterialHandle;
#endif

15
Aeon/Rendering/Mesh.hpp Normal file
View File

@@ -0,0 +1,15 @@
#ifndef AEON_RENDERING_MESH_H_
#define AEON_RENDERING_MESH_H_
#include <Aeon/Includes.hpp>
#include <Aeon/Handle.hpp>
struct Mesh
{
};
typedef Handle MeshHandle;
#endif

View File

@@ -0,0 +1,4 @@
#ifndef AEON_RENDERING_MESH_H_
#define AEON_RENDERING_MESH_H_
#endif

View File

View File

View File

@@ -1,13 +0,0 @@
#include "RenderMaster.hpp"
using namespace Rendering;
RenderMaster::RenderMaster()
{
}
void RenderMaster::QueueRenderable( Renderable* renderable )
{
}

View File

@@ -1,22 +0,0 @@
#ifndef AEON_RENDERING_RENDERMASTER_H_
#define AEON_RENDERING_RENDERMASTER_H_
#include <Aeon/Singleton.hpp>
class Renderable;
namespace Rendering
{
class RenderMaster : public Helpers::Singleton<Rendering::RenderMaster>
{
public:
RenderMaster();
void QueueRenderable( Renderable* renderable );
};
}
#endif

View File

View File

@@ -0,0 +1,2 @@
#ifndef AEON_RENDERING_RENDERPASS_H_

View File

@@ -0,0 +1,9 @@
#ifndef AEON_RENDERING_RENDERPIPELINE_H_
#define AEON_RENDERING_RENDERPIPELINE_H_
class Pipline
{
};
#endif

View File

View File

View File

View File

@@ -1,2 +0,0 @@

View File

View File

@@ -0,0 +1,28 @@
#ifndef AEON_RENDERING_TEXTURE_H_
#define AEON_RENDERING_TEXTURE_H_
#include <Aeon/Includes.hpp>
#include <Aeon/Handle.hpp>
enum class TextureType {
Albedo,
Normal,
Metallic,
Roughness,
AO,
Emissive,
Custom
};
struct TextureDesc
{
};
struct Texture
{
Handle handle;
};
#endif

View File

View File

0
Aeon/ResoucePool.hpp Normal file
View File

0
Aeon/Scene.cpp Normal file
View File

27
Aeon/Scene.hpp Normal file
View File

@@ -0,0 +1,27 @@
#ifndef AEON_SCENE_H_
#define AEON_SCENE_H_
#include <Aeon/Entity/Entity.hpp>
#include <Aeon/Entity/CoreComponents/MaterialComponent.hpp>
#include <Aeon/Entity/CoreComponents/MeshComponent.hpp>
#include <Aeon/Entity/CoreComponents/Transform.hpp>
#include <Aeon/Includes.hpp>
class Scene
{
public:
Scene();
~Scene();
EC::Registry& GetEntityRegistry();
inline std::vector<EC::Entity> GatherRenderables()
{
return mEntityRegistry.view<Transform, MeshComponent, MaterialComponent>();
}
private:
EC::Registry mEntityRegistry;
};
#endif

View File

@@ -30,9 +30,9 @@ file(GLOB EngineSource
Aeon/Input/*.cpp
Aeon/Maths/*.cpp
Aeon/Rendering/*.cpp
Aeon/ThirdParty/*.cpp
Aeon/ThirdParty/*.c
Aeon/ThirdParty/ImGui/*.cpp
ThirdParty/*.cpp
ThirdParty/*.c
ThirdParty/ImGui/*.cpp
)
#temp
@@ -42,18 +42,26 @@ file(GLOB GameSource
include_directories(${Aeon}
"."
"ThirdParty/"
"ThirdParty/glm/"
"ThirdParty/entt/src/"
"ThirdParty/assimp/"
"ThirdParty/Yolo/include"
${WinSDK}
${SDL2_INCLUDE_DIRS}
)
add_executable(${Aeon}
${EngineSource}
${EngineSource}
${GameSource}
)
add_subdirectory("ThirdParty/assimp")
target_link_libraries(${Aeon}
${WinSDK}
${SDL2_LIBRARIES}
Threads::Threads
OpenGL::GL
assimp
)

View File

@@ -1,197 +0,0 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#.rst:
# FindSDL2
# -------
#
# Locate SDL2 library
#
# This module defines
#
# ::
#
# SDL2_LIBRARY, the name of the library to link against
# SDL2_FOUND, if false, do not try to link to SDL
# SDL2_INCLUDE_DIR, where to find SDL.h
# SDL2_VERSION_STRING, human-readable string containing the version of SDL
#
#
#
# This module responds to the flag:
#
# ::
#
# SDL2_BUILDING_LIBRARY
# If this is defined, then no SDL2_main will be linked in because
# only applications need main().
# Otherwise, it is assumed you are building an application and this
# module will attempt to locate and set the proper link flags
# as part of the returned SDL2_LIBRARY variable.
#
#
#
# Don't forget to include SDLmain.h and SDLmain.m your project for the
# OS X framework based version. (Other versions link to -lSDLmain which
# this module will try to find on your behalf.) Also for OS X, this
# module will automatically add the -framework Cocoa on your behalf.
#
#
#
# Additional Note: If you see an empty SDL2_LIBRARY_TEMP in your
# configuration and no SDL2_LIBRARY, it means CMake did not find your SDL
# library (SDL.dll, libsdl.so, SDL.framework, etc). Set
# SDL2_LIBRARY_TEMP to point to your SDL library, and configure again.
# Similarly, if you see an empty SDLMAIN_LIBRARY, you should set this
# value as appropriate. These values are used to generate the final
# SDL2_LIBRARY variable, but when these values are unset, SDL2_LIBRARY
# does not get created.
#
#
#
# $SDL2DIR is an environment variable that would correspond to the
# ./configure --prefix=$SDL2DIR used in building SDL. l.e.galup 9-20-02
#
# Modified by Eric Wing. Added code to assist with automated building
# by using environmental variables and providing a more
# controlled/consistent search behavior. Added new modifications to
# recognize OS X frameworks and additional Unix paths (FreeBSD, etc).
# Also corrected the header search path to follow "proper" SDL
# guidelines. Added a search for SDLmain which is needed by some
# platforms. Added a search for threads which is needed by some
# platforms. Added needed compile switches for MinGW.
#
# On OSX, this will prefer the Framework version (if found) over others.
# People will have to manually change the cache values of SDL2_LIBRARY to
# override this selection or set the CMake environment
# CMAKE_INCLUDE_PATH to modify the search paths.
#
# Note that the header path has changed from SDL/SDL.h to just SDL.h
# This needed to change because "proper" SDL convention is #include
# "SDL.h", not <SDL/SDL.h>. This is done for portability reasons
# because not all systems place things in SDL/ (see FreeBSD).
if(NOT SDL2_DIR)
set(SDL2_DIR "" CACHE PATH "SDL2 directory")
endif()
find_path(SDL2_INCLUDE_DIR SDL.h
HINTS
ENV SDL2DIR
${SDL2_DIR}
PATH_SUFFIXES SDL2
# path suffixes to search inside ENV{SDL2DIR}
include/SDL2 include
)
# AWLAYS 64 bit
set(VC_LIB_PATH_SUFFIX lib/x64)
find_library(SDL2_LIBRARY_TEMP
NAMES SDL2
HINTS
ENV SDL2DIR
${SDL2_DIR}
PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX}
)
# Hide this cache variable from the user, it's an internal implementation
# detail. The documented library variable for the user is SDL2_LIBRARY
# which is derived from SDL2_LIBRARY_TEMP further below.
set_property(CACHE SDL2_LIBRARY_TEMP PROPERTY TYPE INTERNAL)
if(NOT SDL2_BUILDING_LIBRARY)
if(NOT SDL2_INCLUDE_DIR MATCHES ".framework")
# Non-OS X framework versions expect you to also dynamically link to
# SDLmain. This is mainly for Windows and OS X. Other (Unix) platforms
# seem to provide SDLmain for compatibility even though they don't
# necessarily need it.
find_library(SDL2MAIN_LIBRARY
NAMES SDL2main
HINTS
ENV SDL2DIR
${SDL2_DIR}
PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX}
PATHS
/sw
/opt/local
/opt/csw
/opt
)
endif()
endif()
# SDL may require threads on your system.
# The Apple build may not need an explicit flag because one of the
# frameworks may already provide it.
# But for non-OSX systems, I will use the CMake Threads package.
if(NOT APPLE)
find_package(Threads)
endif()
# MinGW needs an additional link flag, -mwindows
# It's total link flags should look like -lmingw32 -lSDLmain -lSDL -mwindows
if(MINGW)
set(MINGW32_LIBRARY mingw32 "-mwindows" CACHE STRING "link flags for MinGW")
endif()
if(SDL2_LIBRARY_TEMP)
# For SDLmain
if(SDL2MAIN_LIBRARY AND NOT SDL2_BUILDING_LIBRARY)
list(FIND SDL2_LIBRARY_TEMP "${SDLMAIN_LIBRARY}" _SDL2_MAIN_INDEX)
if(_SDL2_MAIN_INDEX EQUAL -1)
set(SDL2_LIBRARY_TEMP "${SDLMAIN_LIBRARY}" ${SDL2_LIBRARY_TEMP})
endif()
unset(_SDL2_MAIN_INDEX)
endif()
# For OS X, SDL uses Cocoa as a backend so it must link to Cocoa.
# CMake doesn't display the -framework Cocoa string in the UI even
# though it actually is there if I modify a pre-used variable.
# I think it has something to do with the CACHE STRING.
# So I use a temporary variable until the end so I can set the
# "real" variable in one-shot.
if(APPLE)
set(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} "-framework Cocoa")
endif()
# For threads, as mentioned Apple doesn't need this.
# In fact, there seems to be a problem if I used the Threads package
# and try using this line, so I'm just skipping it entirely for OS X.
if(NOT APPLE)
set(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} ${CMAKE_THREAD_LIBS_INIT})
endif()
# For MinGW library
if(MINGW)
set(SDL2_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL2_LIBRARY_TEMP})
endif()
# Set the final string here so the GUI reflects the final state.
set(SDL2_LIBRARY ${SDL2_LIBRARY_TEMP} CACHE STRING "Where the SDL Library can be found")
endif()
if(SDL2_INCLUDE_DIR AND EXISTS "${SDL2_INCLUDE_DIR}/SDL2_version.h")
file(STRINGS "${SDL2_INCLUDE_DIR}/SDL2_version.h" SDL2_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL2_MAJOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL2_INCLUDE_DIR}/SDL2_version.h" SDL2_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL2_MINOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL2_INCLUDE_DIR}/SDL2_version.h" SDL2_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL2_PATCHLEVEL[ \t]+[0-9]+$")
string(REGEX REPLACE "^#define[ \t]+SDL2_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_VERSION_MAJOR "${SDL2_VERSION_MAJOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL2_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_VERSION_MINOR "${SDL2_VERSION_MINOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL2_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL2_VERSION_PATCH "${SDL2_VERSION_PATCH_LINE}")
set(SDL2_VERSION_STRING ${SDL2_VERSION_MAJOR}.${SDL2_VERSION_MINOR}.${SDL2_VERSION_PATCH})
unset(SDL2_VERSION_MAJOR_LINE)
unset(SDL2_VERSION_MINOR_LINE)
unset(SDL2_VERSION_PATCH_LINE)
unset(SDL2_VERSION_MAJOR)
unset(SDL2_VERSION_MINOR)
unset(SDL2_VERSION_PATCH)
endif()
set(SDL2_LIBRARIES ${SDL2_LIBRARY} ${SDL2MAIN_LIBRARY})
set(SDL2_INCLUDE_DIRS ${SDL2_INCLUDE_DIR})
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL
REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR
VERSION_VAR SDL2_VERSION_STRING)

View File

@@ -1,26 +0,0 @@
{
"configurations": [
{
"name": "x64-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "-DSDL2_PATH=\"C:/Users/benja/Programming/lib/SDL2-2.0.16/\"",
"buildCommandArgs": "-v",
"ctestCommandArgs": ""
},
{
"name": "x64-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "-DSDL2_DIR=\"C:/Users/benja/Programming/lib/SDL2-2.0.16/\"",
"buildCommandArgs": "-v",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ]
}
]
}

View File

@@ -1,8 +1,12 @@
#include <Aeon/Aeon.hpp>
#include <Aeon/Core/Events.hpp>
#include <Aeon/Entity/ComponentController.hpp>
#include <Aeon/Entity/CoreComponents/MaterialComponent.hpp>
#include <Aeon/Entity/CoreComponents/MeshComponent.hpp>
#include <Aeon/Entity/CoreComponents/Transform.hpp>
#include <Aeon/Entity/Entity.hpp>
#include <Aeon/Rendering/ImGui.hpp>
#include <iostream>
#include <thread>
class BackgroundLevel : public Core::GameLayer
{
@@ -51,7 +55,6 @@ public:
void FrameTick() override
{
ImGui::Begin("Debug");
ImGui::End();
@@ -77,36 +80,18 @@ public:
ExampleGame()
: App({"Example"}, {"Game with AEON!"})
{
// EC::EntityRegistry registry;
//
// EC::Entity entity1 = registry.Create();
//
// std::cout << "1: " << entity1 << std::endl;
//
// std::vector<EC::Entity> entities;
//
// for (int i = 0; i < 100; i++)
// {
// entities.push_back(registry.Create());
// }
//
// std::cout << entities[entities.size()] << std::endl;
//
// for (int i = 0; i < 100; i++)
// {
// std::cout << "ENtity in vector pos " << i << " " << entities[i] << std::endl;
// registry.Destroy(entities[i]);
// }
//
// EC::Entity entity2 = registry.Create();
// std::cout << "2: " << entity2 << std::endl;
EC::Entity entity = GetEntityRegistry().create();
GetEntityRegistry().emplace<EC::Transform>(entity, EC::Transform({0.0f, 0.0f, 0.0f}));
GetEntityRegistry().emplace<EC::MeshComponent>(entity, EC::MeshComponent {});
GetEntityRegistry().emplace<EC::MaterialComponent>(entity, EC::MaterialComponent {});
Level* level = new Level;
PushLayer((Core::GameLayer*)level);
DebugLayer* debug = new DebugLayer;
PushDebugLayer(debug);
DebugLayer debug;
PushDebugLayer(&debug);
Run();
delete level;
}
~ExampleGame()

Some files were not shown because too many files have changed in this diff Show More