what the fuck is a renderable
This commit is contained in:
@@ -9,11 +9,11 @@ using Core::App;
|
||||
using Core::Display;
|
||||
using Core::DisplayProperties;
|
||||
|
||||
using Input::Input;
|
||||
using Input::InputController;
|
||||
|
||||
App::App( const AppProperties& props, const DisplayProperties& dispProps )
|
||||
: mDisplay()
|
||||
, mInput()
|
||||
, mInput(InputController::GetInstance())
|
||||
{
|
||||
PushThisAsSink( "ENGINE_DISPLAY_CORE" );
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
private:
|
||||
Display mDisplay;
|
||||
|
||||
Input mInput;
|
||||
Input::InputController& mInput;
|
||||
|
||||
// Game layers from z orderxko285132046
|
||||
std::vector<GameLayer*> mGameLayers;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <iostream>
|
||||
|
||||
#include "Aeon/Assert.hpp"
|
||||
#include "Aeon/Rendering/RenderMaster.hpp"
|
||||
#include "Aeon/Rendering/ImGui.hpp"
|
||||
|
||||
using Core::Display;
|
||||
@@ -10,6 +11,7 @@ using Core::Display;
|
||||
Display::Display()
|
||||
: mWindow( nullptr )
|
||||
, mContext( NULL )
|
||||
, mRenderer( Rendering::RenderMaster::GetInstance() )
|
||||
, mClearColour{ 1.0f, 1.0f, 1.0f, 1.0f }
|
||||
{
|
||||
PushThisAsSink( "ENGINE_DISPLAY_CORE" );
|
||||
|
||||
@@ -11,7 +11,8 @@ extern "C" {
|
||||
#include "Aeon/Core/EngineConfig.hpp"
|
||||
#include "Aeon/Core/Events.hpp"
|
||||
|
||||
class Rendering::Rendermaster;
|
||||
namespace Rendering { class RenderMaster; }
|
||||
using namespace Rendering;
|
||||
|
||||
namespace Core {
|
||||
|
||||
@@ -41,10 +42,10 @@ private:
|
||||
SDL_Window* mWindow;
|
||||
SDL_GLContext mContext;
|
||||
|
||||
RenderMaster& mRenderer;
|
||||
|
||||
|
||||
unsigned int mWidth, mHeight;
|
||||
unsigned int mX, mY;
|
||||
unsigned int mWidth, mHeight = 0;
|
||||
unsigned int mX, mY = 0;
|
||||
float mClearColour[4];
|
||||
|
||||
private:
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
|
||||
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
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
#include "Aeon/Input/InputMap.hpp"
|
||||
#include "Aeon/Rendering/ImGui.hpp"
|
||||
|
||||
using Input::Input;
|
||||
using Input::InputController;
|
||||
|
||||
Input::Input()
|
||||
InputController::InputController()
|
||||
: mEvent()
|
||||
, mDisplayEventDispatcher()
|
||||
, mKeyboardEventDispatcher()
|
||||
@@ -25,7 +25,7 @@ Input::Input()
|
||||
mKbdState = static_cast<const uint8_t*>(SDL_GetKeyboardState( &mNumScancodes ));
|
||||
}
|
||||
|
||||
Input::~Input()
|
||||
InputController::~InputController()
|
||||
{
|
||||
mDisplayEventDispatcher.DeRegisterAsSource( "ENGINE_DISPLAY_CORE" );
|
||||
mMouseEventDispatcher.DeRegisterAsSource( "ENGINE_INPUT_MOUSE" );
|
||||
@@ -34,7 +34,7 @@ Input::~Input()
|
||||
// Do not free mKbdState as that is done by SDL
|
||||
}
|
||||
|
||||
void Input::PollInput()
|
||||
void InputController::PollInput()
|
||||
{
|
||||
//SDL_PumpEvents();
|
||||
while ( SDL_PollEvent( &mEvent ) )
|
||||
@@ -80,7 +80,7 @@ void Input::PollInput()
|
||||
mPollScanKeyboard();
|
||||
}
|
||||
|
||||
void Input::mPollDisplay()
|
||||
void InputController::mPollDisplay()
|
||||
{
|
||||
switch ( mEvent.window.event )
|
||||
{
|
||||
@@ -150,7 +150,7 @@ void Input::mPollDisplay()
|
||||
}
|
||||
}
|
||||
|
||||
void Input::mPollMouse()
|
||||
void InputController::mPollMouse()
|
||||
{
|
||||
Core::GenericEvent e;
|
||||
e.x = mEvent.motion.x;
|
||||
@@ -161,7 +161,7 @@ void Input::mPollMouse()
|
||||
mMouseEventDispatcher.Dispatch( e );
|
||||
}
|
||||
|
||||
void Input::mPollScroll()
|
||||
void InputController::mPollScroll()
|
||||
{
|
||||
Core::GenericEvent e;
|
||||
e.y = mEvent.wheel.y;
|
||||
@@ -169,7 +169,7 @@ void Input::mPollScroll()
|
||||
mMouseEventDispatcher.Dispatch( e );
|
||||
}
|
||||
|
||||
void Input::mPollClick()
|
||||
void InputController::mPollClick()
|
||||
{
|
||||
if ( mEvent.button.state == SDL_PRESSED )
|
||||
{
|
||||
@@ -215,7 +215,7 @@ void Input::mPollClick()
|
||||
}
|
||||
}
|
||||
|
||||
void Input::mPollKeyboard()
|
||||
void InputController::mPollKeyboard()
|
||||
{
|
||||
EKeyCode keycode = KeyCodeFromSDL( mEvent.key.keysym.sym );
|
||||
Core::GenericEvent e;
|
||||
@@ -237,7 +237,7 @@ void Input::mPollKeyboard()
|
||||
mKeyboardEventDispatcher.Dispatch( e );
|
||||
}
|
||||
|
||||
void Input::mPollScanKeyboard()
|
||||
void InputController::mPollScanKeyboard()
|
||||
{
|
||||
//this is naive, can be optimised with double buffering
|
||||
for ( int i = 0; i < mNumScancodes; i++ )
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
|
||||
namespace Input {
|
||||
|
||||
class Input
|
||||
class InputController : public Helpers::Singleton<InputController>
|
||||
{
|
||||
public:
|
||||
Input();
|
||||
~Input();
|
||||
InputController();
|
||||
~InputController();
|
||||
|
||||
void PollInput();
|
||||
|
||||
|
||||
13
Aeon/Rendering/RenderMaster.cpp
Normal file
13
Aeon/Rendering/RenderMaster.cpp
Normal file
@@ -0,0 +1,13 @@
|
||||
#include "Aeon/Rendering/RenderMaster.hpp"
|
||||
|
||||
using Rendering;
|
||||
|
||||
RenderMaster::RenderMaster()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RenderMaster::QueueRenderable()
|
||||
{
|
||||
|
||||
}
|
||||
@@ -6,9 +6,13 @@
|
||||
namespace Rendering
|
||||
{
|
||||
|
||||
class Renderable;
|
||||
|
||||
class RenderMaster : public Helpers::Singleton<RenderMaster>
|
||||
{
|
||||
RenderMaster();
|
||||
|
||||
void QueueRenderable( Renderable* renderable );
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <Aeon/Aeon.hpp>
|
||||
#include <Aeon/Core/Events.hpp>
|
||||
#include <Aeon/Rendering/ImGui.hpp>
|
||||
|
||||
class BackgroundLevel : public Core::GameLayer {
|
||||
|
||||
@@ -23,6 +24,9 @@ public:
|
||||
void FrameTick() override
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void TimeTick() override
|
||||
@@ -32,7 +36,44 @@ public:
|
||||
|
||||
bool EventRecieved( Core::GenericEvent& e ) override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void Detach() override
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
class DebugLayer : public Core::GameLayer
|
||||
{
|
||||
public:
|
||||
DebugLayer()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Attach() override
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void FrameTick() override
|
||||
{
|
||||
|
||||
ImGui::Begin( "Debug" );
|
||||
|
||||
ImGui::End();
|
||||
|
||||
}
|
||||
|
||||
void TimeTick() override
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool EventRecieved( Core::GenericEvent& e ) override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -50,6 +91,8 @@ public:
|
||||
{
|
||||
Level* level = new Level;
|
||||
PushLayer( (Core::GameLayer*)level );
|
||||
DebugLayer* debug = new DebugLayer;
|
||||
PushDebugLayer( debug );
|
||||
Run();
|
||||
delete level;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user