LkEngine
Structure
The engine is split up into several modules: Core, LkEditor, LTesto.
Core
Macros
Controversial topic, I know :100:
The engine utilize macros for different things, such as:
- Static class registration
- Dynamic object registration
The macros can be divided in to different types for their different uses.
Macro Type | Usage |
---|---|
Header | Placed in class/struct definitions |
Constructor | Placed in constructors |
Header
A header macro is used in a static context and is most often used to implement static and/or abstract functions.
Constructor
A constructor macro is used in dynamic contexts.
An example is registering a created object instance to the garbage collector.
The engine macros can be viewed in the table below.
Macro | Type | Details |
---|---|---|
LCLASS | Header | Implements abstract LObject functions and static getters for the class type. |
LSTRUCT | Header | :warning: Not done :warning: |
LOBJECT_REGISTER | Constructor | :x: |
LObject
The base object class for the engine.
All derivations of LObject must declare the LCLASS macro somewhere in the class declaration.
TObjectPtr
The LObject class uses TObjectPtr for its smart pointer implementation.
The TObjectPtr class requires an object to be derived from LObject to work, this is because the counted references is stored in the LObject instance.
Events
All events derive from the base event class LEvent.
Input events are reported from the active GLFW context that is managed by LWindow.
Event | Category | Description |
---|---|---|
LKeyPressedEvent | Input | Contains info about a single key press |
LMouseButtonPressedEvent | Input | Contains info about a pressed mouse button |
Event Queue
Events are placed in a LEventQueue.
LEventQueue EventQueue;
...
/* Execute all queued events, no matter the type. */
EventQueue.Process();
/* Only execute queued LMousePressedEvent events, skip the others. */
EventQueue.ProcessFiltered<LMousePressedEvent>();
Delegates
The delegate implementation is found in Delegate.h.
Delegate Macro Declaration | Type | Returns |
---|---|---|
LK_DECLARE_DELEGATE(Args…) | Single | Nothing |
LK_DECLARE_DELEGATE_RET(Name, ReturnType, Args…) | Single | ReturnType |
LK_DECLARE_MULTICAST_DELEGATE(Args…) | Multicast | Nothing |
Math Library
LkEngine makes use of templates to support seamless mathematical operations for containers from glm and ImGui.
Vectors
The header that includes LVector2, LVector3 and LVector4 can be found in Vector.h.
LVector3 is also aliased to LVector because the three component vector is the most used vector type in 3D contexts.
LkEditor
The engine editor.
LTesto
Test Framework for LkEngine