Core

group core

Core components of the CoffeeEngine.

The SystemInfo class provides information about the Operating System.

Typedefs

using KeyCode = uint16_t

Functions

Application *CreateApplication()

Creates the application. To be defined in the client.

Returns:

A pointer to the created application.

class Application
#include <Application.h>

The Application class is responsible for managing the main application loop, handling events, and managing layers and overlays.

Public Types

using EventCallbackFn = std::function<void(Event&)>

Type definition for event callback function.

Public Functions

Application()

Constructs the Application object.

virtual ~Application()

Destroys the Application object.

void Run()

Starts the main application loop.

void OnEvent(Event &e)

Handles incoming events.

Parameters:

e – The event to handle.

void PushLayer(Layer *layer)

Pushes a layer onto the layer stack.

Parameters:

layer – The layer to push.

void PushOverlay(Layer *layer)

Pushes an overlay onto the layer stack.

Parameters:

layer – The overlay to push.

inline Window &GetWindow()

Gets the main application window.

Returns:

A reference to the main application window.

inline void SetEventCallback(const EventCallbackFn &callback)

Sets the event callback function.

Parameters:

callback – The event callback function.

void Close()

Closes the application.

inline ImGuiLayer *GetImGuiLayer()

Gets the ImGui layer.

Returns:

A pointer to the ImGui layer.

Public Static Functions

static inline Application &Get()

Gets the singleton instance of the Application.

Returns:

A reference to the singleton instance.

struct FileDialogArgs
#include <FileDialog.h>

Arguments for the file dialog.

Public Members

std::vector<Filter> Filters = {}

List of filters.

std::string DefaultPath = ""

Default path for the file dialog.

std::string DefaultName = ""

Default name for the file dialog.

struct Filter
#include <FileDialog.h>

Filter for file types.

Public Members

const char *Name

Name of the filter.

const char *Extension

Extension of the filter.

class FileDialog
#include <FileDialog.h>

Class for handling file dialogs.

Public Static Functions

static const std::filesystem::path OpenFile(const FileDialogArgs &args = {})

Opens a file dialog to select a file.

Parameters:

args – Arguments for the file dialog.

Returns:

The selected file path.

static const std::filesystem::path SaveFile(const FileDialogArgs &args = {})

Opens a file dialog to save a file.

Parameters:

args – Arguments for the file dialog.

Returns:

The selected file path.

class Input

Public Static Functions

static bool IsKeyPressed(const KeyCode key)

Checks if a specific key is currently being pressed.

Parameters:

key – The key code of the key to check.

Returns:

True if the key is currently being pressed, false otherwise.

static bool IsMouseButtonPressed(const MouseCode button)

Checks if a mouse button is currently pressed.

Parameters:

button – The mouse button to check.

Returns:

True if the mouse button is pressed, false otherwise.

static glm::vec2 GetMousePosition()

Retrieves the current position of the mouse.

Returns:

The current position of the mouse as a 2D vector.

static float GetMouseX()

Retrieves the current x-coordinate of the mouse cursor.

Returns:

The x-coordinate of the mouse cursor.

static float GetMouseY()

Retrieves the current y-coordinate of the mouse cursor.

Returns:

The y-coordinate of the mouse cursor.

class Layer

Subclassed by Coffee::ImGuiLayer

Public Functions

inline Layer(const std::string &name = "Layer")

Constructor for the Layer class.

Parameters:

name – The name of the layer, default is “Layer”.

virtual ~Layer() = default

Virtual destructor for the Layer class.

inline virtual void OnAttach()

Called when the layer is attached.

inline virtual void OnDetach()

Called when the layer is detached.

inline virtual void OnUpdate(float dt)

Called every frame to update the layer.

Parameters:

dt – Delta time since the last frame.

inline virtual void OnImGuiRender()

Called to render ImGui elements.

inline virtual void OnEvent(Event &event)

Called when an event occurs.

Parameters:

event – The event that occurred.

inline const std::string &GetName() const

Gets the name of the layer.

Returns:

The name of the layer.

class Log
#include <Log.h>

The Log class is responsible for initializing and providing access to the core and client loggers.

Public Static Functions

static void Init()

Initializes the logging system.

static inline std::shared_ptr<spdlog::logger> &GetCoreLogger()

Gets the core logger.

Returns:

A shared pointer to the core logger.

static inline std::shared_ptr<spdlog::logger> &GetClientLogger()

Gets the client logger.

Returns:

A shared pointer to the client logger.

class Stopwatch
#include <Stopwatch.h>

A class to measure elapsed time.

The Stopwatch class provides functionality to start, stop, reset, and retrieve the elapsed time. It supports both regular and high-precision timing.

Public Functions

Stopwatch()

Constructs a new Stopwatch object.

void Start()

Starts the stopwatch.

If the stopwatch is already running, this method has no effect.

void Stop()

Stops the stopwatch.

If the stopwatch is not running, this method has no effect.

void Reset()

Resets the stopwatch.

This method stops the stopwatch and resets the elapsed time to zero.

float GetElapsedTime() const

Gets the elapsed time in seconds.

Returns:

The elapsed time in seconds.

double GetPreciseElapsedTime() const

Gets the precise elapsed time in seconds.

This method uses SDL_GetPerformanceCounter for higher precision.

Returns:

The precise elapsed time in seconds.

class SystemInfo

Subclassed by Coffee::LinuxSystemInfo, Coffee::WindowsSystemInfo

Public Functions

virtual uint32_t GetPhysicalProcessorCountImpl() const = 0

Gets the number of physical processors.

Returns:

The number of physical processors.

virtual uint64_t GetAvailableMemoryImpl() const = 0

Gets the amount of available memory in the system.

Returns:

The amount of available memory in the system.

virtual uint64_t GetUsedMemoryImpl() const = 0

Gets the amount of memory used in the system.

Returns:

The amount of memory used in the system.

virtual uint64_t GetProcessMemoryUsageImpl() const = 0

Gets the amount of memory used by the process.

Returns:

The amount of memory used by the process.

Public Static Functions

static uint32_t GetLogicalProcessorCount()

Gets the number of logical processors.

static uint32_t GetPhysicalProcessorCount()

Gets the number of physical processors.

static uint64_t GetTotalMemory()

Gets the total memory in the system.

static uint64_t GetAvailableMemory()

Gets the available memory in the system.

static uint64_t GetUsedMemory()

Gets the used memory in the system.

static uint64_t GetProcessMemoryUsage()

Gets the memory used by the process.

class Timer
#include <Timer.h>

A class that represents a timer with various functionalities.

Public Functions

inline Timer()

Default constructor.

Timer(double waitTime, bool autoStart, bool oneShot, TimerCallback callback)

Parameterized constructor.

Parameters:
  • waitTime – The time to wait before the timer triggers.

  • autoStart – Whether the timer should start automatically.

  • oneShot – Whether the timer should trigger only once.

  • callback – The callback function to be called when the timer triggers.

void Start(double waitTime)

Starts the timer with a specified wait time.

Parameters:

waitTime – The time to wait before the timer triggers.

void Stop()

Stops the timer.

void setWaitTime(double waitTime)

Sets the wait time for the timer.

Parameters:

waitTime – The time to wait before the timer triggers.

inline double getWaitTime() const

Gets the wait time of the timer.

Returns:

The time to wait before the timer triggers.

inline void setOneShot(bool oneShot)

Sets whether the timer should trigger only once.

Parameters:

oneShot – Whether the timer should trigger only once.

inline bool isOneShot() const

Checks if the timer is set to trigger only once.

Returns:

True if the timer is set to trigger only once, false otherwise.

inline void setAutoStart(bool autoStart)

Sets whether the timer should start automatically.

Parameters:

autoStart – Whether the timer should start automatically.

inline bool isAutoStart() const

Checks if the timer is set to start automatically.

Returns:

True if the timer is set to start automatically, false otherwise.

void setPaused(bool paused)

Sets whether the timer is paused.

Parameters:

paused – Whether the timer is paused.

inline bool isPaused() const

Checks if the timer is paused.

Returns:

True if the timer is paused, false otherwise.

void isStopped()

Checks if the timer is stopped.

inline double GetTimeLeft() const

Gets the remaining time before the timer triggers.

Returns:

The remaining time before the timer triggers.

inline void SetCallback(TimerCallback callback)

Sets the callback function to be called when the timer triggers.

Parameters:

callback – The callback function.

inline TimerCallback GetCallback() const

Gets the callback function to be called when the timer triggers.

Returns:

The callback function.

struct WindowProps
#include <Window.h>

Structure to hold window properties such as title, width, and height.

Public Functions

inline WindowProps(const std::string &title = "Coffee Engine", uint32_t width = 1600, uint32_t height = 900)

Constructs WindowProps with default or specified values.

Parameters:
  • title – The title of the window.

  • width – The width of the window.

  • height – The height of the window.

Public Members

std::string Title

The title of the window.

uint32_t Width

The width of the window.

uint32_t Height

The height of the window.

class Window
#include <Window.h>

The Window class is responsible for managing the window and its properties.

Public Functions

Window(const WindowProps &props)

Constructs a Window object with the specified properties.

Parameters:

props – The properties of the window.

virtual ~Window()

Destroys the Window object.

void OnUpdate()

Updates the window.

inline unsigned int GetWidth() const

Gets the width of the window.

Returns:

The width of the window.

inline unsigned int GetHeight() const

Gets the height of the window.

Returns:

The height of the window.

void SetVSync(bool enabled)

Enables or disables VSync.

Parameters:

enabled – True to enable VSync, false to disable.

bool IsVSync() const

Checks if VSync is enabled.

Returns:

True if VSync is enabled, false otherwise.

void SetTitle(const std::string &title)

Sets the title of the window.

Parameters:

title – The new title of the window.

inline const std::string &GetTitle() const

Gets the title of the window.

Returns:

The title of the window.

void SetIcon(const std::string &path)

Sets the icon of the window.

Parameters:

path – The path to the icon file.

inline virtual void *GetNativeWindow() const

Gets the native window handle.

Returns:

A pointer to the native window.

Public Static Functions

static inline Scope<Window> Create(const WindowProps &props = WindowProps())

Creates a window with the specified properties.

Parameters:

props – The properties of the window.

Returns:

A scoped pointer to the created window.

namespace Coffee

Typedefs

template<typename T>
using Scope = std::unique_ptr<T>
template<typename T>
using Ref = std::shared_ptr<T>
using MouseCode = uint16_t

Enums

enum class ResourceType

Enumeration of different types of resources.

Values:

enumerator Unknown

Unknown resource type.

enumerator Texture

Texture resource type.

enumerator Model

Model resource type.

enumerator Shader

Shader resource type.

enum class ResourceFormat

Enumeration of resource formats.

Values:

enumerator Binary

Binary format.

enumerator JSON

JSON format.

enum class PrimitiveType

Enum class representing different types of primitive meshes.

Values:

enumerator Quad

A quad mesh.

enumerator Cube

A cube mesh.

enumerator Sphere

A sphere mesh.

enumerator Plane

A plane mesh.

enumerator Cylinder

A cylinder mesh.

enumerator Cone

A cone mesh.

enumerator Torus

A torus mesh.

enumerator Capsule

A capsule mesh.

enumerator None

No mesh.

Functions

template<typename T, typename ...Args>
Scope<T> CreateScope(Args&&... args)
template<typename T, typename ...Args>
Ref<T> CreateRef(Args&&... args)
ResourceFormat GetResourceSaveFormatFromType(ResourceType type)
glm::mat4 aiMatrix4x4ToGLMMat4(const aiMatrix4x4 &aiMat)
void OpenGLMessageCallback(unsigned source, unsigned type, unsigned id, unsigned severity, int length, const char *message, const void *userParam)
GLenum ImageFormatToOpenGLInternalFormat(ImageFormat format)
GLenum ImageFormatToOpenGLFormat(ImageFormat format)
static GLenum ShaderDataTypeToOpenGLBaseType(ShaderDataType type)

Variables

SDL_TimerCallback timerCallback = [](void* param, uint32_t interval, uint32_t elapsed) -> uint32_t{Timer* timer = static_cast<Timer*>(param);if(timer->GetCallback()){timer->GetCallback()();}if(timer->isOneShot()){timer->Stop();return 0;}if(timer->isAutoStart()){timer->Start(timer->getWaitTime());}return 0;}
static uint8_t s_SDLWindowCount = 0
static Ref<Project> s_ActiveProject
static const uint32_t s_MaxFramebufferSize = 8192
static bool s_viewportResized = false
static uint32_t s_viewportWidth = 0
static uint32_t s_viewportHeight = 0
static Ref<Material> missingMaterial
struct AABB
#include <Mesh.h>

Structure representing an axis-aligned bounding box (AABB).

Public Functions

inline AABB(const glm::vec3 &min, const glm::vec3 &max)

Constructs an AABB with specified minimum and maximum points.

Parameters:
  • min – The minimum point of the AABB.

  • max – The maximum point of the AABB.

Public Members

glm::vec3 min = glm::vec3(0.0f)

The minimum point of the AABB.

glm::vec3 max = glm::vec3(0.0f)

The maximum point of the AABB.

class Application
#include <Application.h>

The Application class is responsible for managing the main application loop, handling events, and managing layers and overlays.

Public Types

using EventCallbackFn = std::function<void(Event&)>

Type definition for event callback function.

Public Functions

Application()

Constructs the Application object.

virtual ~Application()

Destroys the Application object.

void Run()

Starts the main application loop.

void OnEvent(Event &e)

Handles incoming events.

Parameters:

e – The event to handle.

void PushLayer(Layer *layer)

Pushes a layer onto the layer stack.

Parameters:

layer – The layer to push.

void PushOverlay(Layer *layer)

Pushes an overlay onto the layer stack.

Parameters:

layer – The overlay to push.

inline Window &GetWindow()

Gets the main application window.

Returns:

A reference to the main application window.

inline void SetEventCallback(const EventCallbackFn &callback)

Sets the event callback function.

Parameters:

callback – The event callback function.

void Close()

Closes the application.

inline ImGuiLayer *GetImGuiLayer()

Gets the ImGui layer.

Returns:

A pointer to the ImGui layer.

Public Static Functions

static inline Application &Get()

Gets the singleton instance of the Application.

Returns:

A reference to the singleton instance.

class AppRenderEvent : public Coffee::Event
#include <ApplicationEvent.h>

Event for application render.

class AppTickEvent : public Coffee::Event
#include <ApplicationEvent.h>

Event for application tick.

class AppUpdateEvent : public Coffee::Event
#include <ApplicationEvent.h>

Event for application update.

struct BufferAttribute
#include <Buffer.h>

Structure representing a buffer attribute.

Public Functions

BufferAttribute() = default

Default constructor for BufferAttribute.

inline BufferAttribute(ShaderDataType type, const std::string &name, bool normalized = false)

Constructs a BufferAttribute with the specified parameters.

Parameters:
  • type – The type of the attribute.

  • name – The name of the attribute.

  • normalized – Whether the attribute is normalized.

inline uint32_t GetComponentCount() const

Returns the number of components in the attribute.

Returns:

The number of components.

Public Members

std::string Name

The name of the attribute.

ShaderDataType Type

The type of the attribute.

uint32_t Size

The size of the attribute.

size_t Offset

The offset of the attribute.

bool Normalized

Whether the attribute is normalized.

class BufferLayout
#include <Buffer.h>

Class representing a buffer layout.

Public Functions

inline BufferLayout()

Default constructor for BufferLayout.

inline BufferLayout(std::initializer_list<BufferAttribute> elements)

Constructs a BufferLayout with the specified attributes.

Parameters:

elements – The list of buffer attributes.

inline uint32_t GetStride() const

Returns the stride of the buffer layout.

Returns:

The stride in bytes.

inline const std::vector<BufferAttribute> &GetElements() const

Returns the list of buffer attributes.

Returns:

The list of buffer attributes.

inline std::vector<BufferAttribute>::iterator begin()

Returns an iterator to the beginning of the buffer attributes.

Returns:

An iterator to the beginning.

inline std::vector<BufferAttribute>::iterator end()

Returns an iterator to the end of the buffer attributes.

Returns:

An iterator to the end.

inline std::vector<BufferAttribute>::const_iterator begin() const

Returns a constant iterator to the beginning of the buffer attributes.

Returns:

A constant iterator to the beginning.

inline std::vector<BufferAttribute>::const_iterator end() const

Returns a constant iterator to the end of the buffer attributes.

Returns:

A constant iterator to the end.

class CacheManager
#include <CacheManager.h>

Manages cache-related operations for the CoffeeEngine.

Public Static Functions

static inline void SetCachePath(const std::filesystem::path &path)

Sets the cache path.

Parameters:

path – The path to set as the cache directory.

static inline const std::filesystem::path &GetCachePath()

Gets the current cache path.

Returns:

The current cache path.

static inline void CreateCacheDirectory()

Creates the cache directory.

static inline void ClearCache()

Clears the cache by removing all files in the cache directory.

static inline std::filesystem::path GetCachedFilePath(const std::string &filename)

Gets the file path for a cached file.

Parameters:

filename – The name of the file to be cached.

Returns:

The full path to the cached file.

class Camera
#include <Camera.h>

The Camera class is responsible for managing the camera’s projection matrix.

Subclassed by Coffee::EditorCamera, Coffee::SceneCamera

Public Functions

Camera() = default

Default constructor for the Camera class.

inline Camera(const glm::mat4 &projection)

Constructs a Camera object with the specified projection matrix.

Parameters:

projection – The projection matrix.

virtual ~Camera() = default

Virtual destructor for the Camera class.

inline const glm::mat4 &GetProjection() const

Gets the projection matrix of the camera.

Returns:

The projection matrix.

inline void SetViewportSize(float width, float height)

Sets the size of the viewport and updates the projection matrix.

Parameters:
  • width – The width of the viewport.

  • height – The height of the viewport.

struct CameraComponent
#include <Components.h>

Component representing a camera.

Public Functions

template<class Archive>
inline void serialize(Archive &archive)

Serializes the CameraComponent.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

Public Members

SceneCamera Camera

The scene camera.

class DebugRenderer
#include <DebugRenderer.h>

Class responsible for rendering debug lines.

Public Static Functions

static void Init()

Initializes the DebugRenderer.

static void Shutdown()

Shuts down the DebugRenderer.

static void DrawLine(const glm::vec3 &start, const glm::vec3 &end, glm::vec4 color = glm::vec4(1.0f), float lineWidth = 1.0f)

Draws a line between two points.

Parameters:
  • start – The starting point of the line.

  • end – The ending point of the line.

  • color – The color of the line. Default is white.

  • lineWidth – The width of the line. Default is 1.0f.

struct DebugVertex
#include <DebugRenderer.h>

Structure representing a vertex in a line.

Public Members

glm::vec3 Position

The position of the vertex.

glm::vec4 Color

The color of the vertex.

class EditorCamera : public Coffee::Camera
#include <EditorCamera.h>

The EditorCamera class is responsible for managing the editor camera’s view and projection matrices.

Public Types

enum class CameraState

Enum class representing the state of the camera.

Values:

enumerator NONE

No camera state.

enumerator ORBIT

Camera is in orbit mode.

enumerator FLY

Camera is in fly mode.

Public Functions

EditorCamera() = default

Default constructor for the EditorCamera class.

EditorCamera(float fov, ProjectionType projection = ProjectionType::PERSPECTIVE, float aspectRatio = 1.778, float nearClip = 0.1f, float farClip = 1000.0f)

Constructs an EditorCamera object with the specified parameters.

Parameters:
  • fov – The field of view for the perspective projection.

  • projection – The type of projection (perspective or orthographic).

  • aspectRatio – The aspect ratio of the viewport.

  • nearClip – The near clipping plane distance.

  • farClip – The far clipping plane distance.

void OnUpdate(float dt)

Updates the camera’s view matrix.

void OnEvent(Event &event)

Handles events for the camera.

Parameters:

event – The event to handle.

inline void SetFocusPoint(glm::vec3 focusPoint)

Sets the focal point of the camera.

Parameters:

focusPoint – The focal point.

inline const glm::mat4 GetViewMatrix() const

Gets the view matrix of the camera.

Returns:

The view matrix.

glm::vec3 GetUpDirection() const

Gets the up direction of the camera.

Returns:

The up direction.

glm::vec3 GetRightDirection() const

Gets the right direction of the camera.

Returns:

The right direction.

glm::vec3 GetForwardDirection() const

Gets the forward direction of the camera.

Returns:

The forward direction.

inline const glm::vec3 &GetPosition() const

Gets the position of the camera.

Returns:

The position.

glm::quat GetOrientation() const

Gets the orientation of the camera.

Returns:

The orientation.

inline const CameraState &GetState() const

Gets the current state of the camera.

Returns:

The current state of the camera.

class Entity
#include <Entity.h>

Class representing an entity in the scene.

Public Functions

Entity() = default

Default constructor for Entity.

Entity(entt::entity handle, Scene *scene)

Constructor for Entity with handle and scene.

Parameters:
  • handle – The entity handle.

  • scene – The scene the entity belongs to.

Entity(const Entity &other) = default

Copy constructor for Entity.

Parameters:

other – The other entity to copy from.

template<typename T, typename ...Args>
inline T &AddComponent(Args&&... args)

Add a component to the entity.

Template Parameters:
  • T – The component type.

  • Args – The component constructor arguments.

Parameters:

args – The component constructor arguments.

Returns:

Reference to the added component.

template<typename T>
inline T &GetComponent()

Get a component from the entity.

Template Parameters:

T – The component type.

Returns:

Reference to the component.

template<typename T>
inline bool HasComponent()

Check if the entity has a component.

Template Parameters:

T – The component type.

Returns:

True if the entity has the component, false otherwise.

template<typename T>
inline void RemoveComponent()

Remove a component from the entity.

Template Parameters:

T – The component type.

inline operator bool() const

Check if the entity is valid.

Returns:

True if the entity is valid, false otherwise.

inline operator entt::entity() const

Convert the entity to its handle.

Returns:

The entity handle.

inline operator uint32_t() const

Convert the entity to its handle as a uint32_t.

Returns:

The entity handle as a uint32_t.

inline bool operator==(const Entity &other) const

Equality operator.

Parameters:

other – The other entity to compare with.

Returns:

True if the entities are equal, false otherwise.

inline bool operator!=(const Entity &other) const

Inequality operator.

Parameters:

other – The other entity to compare with.

Returns:

True if the entities are not equal, false otherwise.

inline void SetParent(Entity entity)

Set the parent of the entity.

Parameters:

entity – The parent entity.

class Event
#include <Event.h>

Base class for all events.

Subclassed by Coffee::AppRenderEvent, Coffee::AppTickEvent, Coffee::AppUpdateEvent, Coffee::FileDropEvent, Coffee::KeyEvent, Coffee::MouseButtonEvent, Coffee::MouseMovedEvent, Coffee::MouseScrolledEvent, Coffee::WindowCloseEvent, Coffee::WindowResizeEvent

Public Functions

virtual EventType GetEventType() const = 0

Get the type of the event.

Returns:

The event type.

virtual const char *GetName() const = 0

Get the name of the event.

Returns:

The event name.

virtual int GetCategoryFlags() const = 0

Get the category flags of the event.

Returns:

The category flags.

inline virtual std::string ToString() const

Convert the event to a string representation.

Returns:

A string representation of the event.

inline bool IsInCategory(EventCategory category)

Check if the event is in a specific category.

Parameters:

category – The category to check.

Returns:

True if the event is in the category, false otherwise.

class EventDispatcher
#include <Event.h>

Event dispatcher to handle events.

Public Functions

template<typename T, typename F>
inline bool Dispatch(const F &func)

Dispatches the event if it matches the type.

Template Parameters:
  • T – The event type.

  • F – The function type.

Parameters:

func – The function to call if the event matches the type.

Returns:

True if the event was dispatched, false otherwise.

class FileDialog
#include <FileDialog.h>

Class for handling file dialogs.

Public Static Functions

static const std::filesystem::path OpenFile(const FileDialogArgs &args = {})

Opens a file dialog to select a file.

Parameters:

args – Arguments for the file dialog.

Returns:

The selected file path.

static const std::filesystem::path SaveFile(const FileDialogArgs &args = {})

Opens a file dialog to save a file.

Parameters:

args – Arguments for the file dialog.

Returns:

The selected file path.

struct FileDialogArgs
#include <FileDialog.h>

Arguments for the file dialog.

Public Members

std::vector<Filter> Filters = {}

List of filters.

std::string DefaultPath = ""

Default path for the file dialog.

std::string DefaultName = ""

Default name for the file dialog.

struct Filter
#include <FileDialog.h>

Filter for file types.

Public Members

const char *Name

Name of the filter.

const char *Extension

Extension of the filter.

class FileDropEvent : public Coffee::Event
#include <ApplicationEvent.h>

Event for Dropping a file.

Public Functions

inline uint64_t GetTimestamp() const

Get the timestamp of the event.

Returns:

The timestamp of the event.

inline uint32_t GetWindowID() const

Get the window ID of the event.

Returns:

The window ID of the event.

inline float GetX() const

Get the x position of the event.

Returns:

The x position of the event.

inline float GetY() const

Get the y position of the event.

Returns:

The y position of the event.

inline const std::string &GetSource() const

Get the source of the event.

Returns:

The source of the event.

inline const std::string &GetFile() const

Get the file of the event.

Returns:

The file of the event.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

class Framebuffer
#include <Framebuffer.h>

Class representing a framebuffer.

Public Functions

Framebuffer(uint32_t width, uint32_t height, std::initializer_list<ImageFormat> attachments)

Constructs a Framebuffer with the specified width, height, and attachments.

Parameters:
  • width – The width of the framebuffer.

  • height – The height of the framebuffer.

  • attachments – The list of image formats for the attachments.

~Framebuffer()

Destroys the Framebuffer.

void Invalidate()

Invalidates the framebuffer, forcing it to be recreated.

void Bind()

Binds the framebuffer.

void UnBind()

Unbinds the framebuffer.

void SetDrawBuffers(std::initializer_list<Ref<Texture>> colorAttachments)

Sets the draw buffers for the framebuffer.

Warning

This function is not finished, does not work, and is slow. Do not use it 🫡.

Parameters:

colorAttachments – The list of color attachments.

void SetDrawBuffers(std::initializer_list<uint32_t> colorAttachments)

Sets the draw buffers for the framebuffer.

Parameters:

colorAttachments – The list of color attachment indices.

void Resize(uint32_t width, uint32_t height)

Resizes the framebuffer.

Parameters:
  • width – The new width of the framebuffer.

  • height – The new height of the framebuffer.

inline const uint32_t GetWidth() const

Gets the width of the framebuffer.

Returns:

The width of the framebuffer.

inline const uint32_t GetHeight() const

Gets the height of the framebuffer.

Returns:

The height of the framebuffer.

void AttachColorTexture(Ref<Texture> &texture)

Attaches a color texture to the framebuffer.

Parameters:

texture – The color texture to attach.

void AttachDepthTexture(Ref<Texture> &texture)

Attaches a depth texture to the framebuffer.

Parameters:

texture – The depth texture to attach.

inline const Ref<Texture> &GetColorTexture(uint32_t index = 0) const

Gets the color texture at the specified index.

Parameters:

index – The index of the color texture.

Returns:

A reference to the color texture.

inline const Ref<Texture> &GetDepthTexture() const

Gets the depth texture.

Returns:

A reference to the depth texture.

Public Static Functions

static Ref<Framebuffer> Create(uint32_t width, uint32_t height, std::initializer_list<ImageFormat> attachments)

Creates a framebuffer with the specified width, height, and attachments.

Parameters:
  • width – The width of the framebuffer.

  • height – The height of the framebuffer.

  • attachments – The list of image formats for the attachments.

Returns:

A reference to the created framebuffer.

class GraphicsContext
#include <GraphicsContext.h>

Class representing the graphics context.

Public Functions

GraphicsContext(SDL_Window *windowHandle)

Constructs a GraphicsContext with the specified window handle.

Parameters:

windowHandle – The handle to the SDL window.

virtual ~GraphicsContext()

Virtual destructor for the GraphicsContext class.

void Init()

Initializes the graphics context.

void SwapBuffers()

Swaps the front and back buffers.

Public Static Functions

static Scope<GraphicsContext> Create(SDL_Window *window)

Creates a graphics context for the specified window.

Parameters:

window – The handle to the SDL window.

Returns:

A scope pointer to the created graphics context.

struct HierarchyComponent
#include <SceneTree.h>

Component for managing entity hierarchy.

Public Functions

HierarchyComponent(entt::entity parent)

Constructor with parent entity.

Parameters:

parent – The parent entity.

HierarchyComponent()

Default constructor.

template<class Archive>
inline void serialize(Archive &archive)

Serialize the component.

Template Parameters:

Archive – The archive type.

Parameters:

archive – The archive.

Public Static Functions

static void OnConstruct(entt::registry &registry, entt::entity entity)

Called when the component is constructed.

Parameters:
  • registry – The entity registry.

  • entity – The entity.

static void OnDestroy(entt::registry &registry, entt::entity entity)

Called when the component is destroyed.

Parameters:
  • registry – The entity registry.

  • entity – The entity.

static void OnUpdate(entt::registry &registry, entt::entity entity)

Called when the component is updated.

Parameters:
  • registry – The entity registry.

  • entity – The entity.

static void Reparent(entt::registry &registry, entt::entity entity, entt::entity parent)

Reparent the entity to a new parent.

Parameters:
  • registry – The entity registry.

  • entity – The entity to reparent.

  • parent – The new parent entity.

class ImGuiLayer : public Coffee::Layer
#include <ImGuiLayer.h>

The ImGuiLayer class is responsible for managing the ImGui layer in the application.

Public Functions

ImGuiLayer()

Constructs the ImGuiLayer object.

~ImGuiLayer()

Destroys the ImGuiLayer object.

virtual void OnAttach() override

Attaches the ImGui layer to the application.

virtual void OnDetach() override

Detaches the ImGui layer from the application.

virtual void OnEvent(Event &e) override

Handles events for the ImGui layer.

Parameters:

e – The event to handle.

void Begin()

Begins a new ImGui frame.

void End()

Ends the current ImGui frame.

virtual void OnImGuiRender() override

Renders ImGui elements.

inline void BlockEvents(bool block)

Blocks or unblocks events from being handled by the ImGui layer.

Parameters:

block – True to block events, false to unblock.

void SetTeaColorStyle()

Sets the Coffee color style for ImGui.

void SetGodotColorStyle()

Sets the Godot color style for ImGui.

void SetCoffeeColorStyle()

Sets the Coffee color style for ImGui.

class IndexBuffer
#include <Buffer.h>

Class representing an index buffer.

Public Functions

IndexBuffer(uint32_t *indices, uint32_t count)

Constructs an IndexBuffer with the specified indices and count.

Parameters:
  • indices – The index data.

  • count – The number of indices.

virtual ~IndexBuffer()

Destroys the IndexBuffer.

void Bind()

Binds the index buffer.

void Unbind()

Unbinds the index buffer.

inline uint32_t GetCount() const

Returns the number of indices in the buffer.

Returns:

The number of indices.

Public Static Functions

static Ref<IndexBuffer> Create(uint32_t *indices, uint32_t count)

Creates an index buffer with the specified indices and count.

Parameters:
  • indices – The index data.

  • count – The number of indices.

Returns:

A reference to the created index buffer.

class Input

Public Static Functions

static bool IsKeyPressed(const KeyCode key)

Checks if a specific key is currently being pressed.

Parameters:

key – The key code of the key to check.

Returns:

True if the key is currently being pressed, false otherwise.

static bool IsMouseButtonPressed(const MouseCode button)

Checks if a mouse button is currently pressed.

Parameters:

button – The mouse button to check.

Returns:

True if the mouse button is pressed, false otherwise.

static glm::vec2 GetMousePosition()

Retrieves the current position of the mouse.

Returns:

The current position of the mouse as a 2D vector.

static float GetMouseX()

Retrieves the current x-coordinate of the mouse cursor.

Returns:

The x-coordinate of the mouse cursor.

static float GetMouseY()

Retrieves the current y-coordinate of the mouse cursor.

Returns:

The y-coordinate of the mouse cursor.

class KeyEvent : public Coffee::Event
#include <KeyEvent.h>

Base class for key events.

Subclassed by Coffee::KeyPressedEvent, Coffee::KeyReleasedEvent, Coffee::KeyTypedEvent

Public Functions

inline KeyCode GetKeyCode() const

Get the key code associated with the event.

Returns:

The key code.

class KeyPressedEvent : public Coffee::KeyEvent
#include <KeyEvent.h>

Event for key press.

Public Functions

inline KeyPressedEvent(const KeyCode keycode, bool isRepeat = false)

Constructor for KeyPressedEvent.

Parameters:
  • keycode – The key code associated with the event.

  • isRepeat – Whether the key press is a repeat.

inline bool IsRepeat() const

Check if the key press is a repeat.

Returns:

True if the key press is a repeat, false otherwise.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

class KeyReleasedEvent : public Coffee::KeyEvent
#include <KeyEvent.h>

Event for key release.

Public Functions

inline KeyReleasedEvent(const KeyCode keycode)

Constructor for KeyReleasedEvent.

Parameters:

keycode – The key code associated with the event.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

class KeyTypedEvent : public Coffee::KeyEvent
#include <KeyEvent.h>

Event for key typing.

Public Functions

inline KeyTypedEvent(const KeyCode keycode)

Constructor for KeyTypedEvent.

Parameters:

keycode – The key code associated with the event.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

class Layer

Subclassed by Coffee::ImGuiLayer

Public Functions

inline Layer(const std::string &name = "Layer")

Constructor for the Layer class.

Parameters:

name – The name of the layer, default is “Layer”.

virtual ~Layer() = default

Virtual destructor for the Layer class.

inline virtual void OnAttach()

Called when the layer is attached.

inline virtual void OnDetach()

Called when the layer is detached.

inline virtual void OnUpdate(float dt)

Called every frame to update the layer.

Parameters:

dt – Delta time since the last frame.

inline virtual void OnImGuiRender()

Called to render ImGui elements.

inline virtual void OnEvent(Event &event)

Called when an event occurs.

Parameters:

event – The event that occurred.

inline const std::string &GetName() const

Gets the name of the layer.

Returns:

The name of the layer.

class LayerStack
#include <LayerStack.h>

Manages a stack of layers and overlays.

Public Functions

LayerStack() = default

Default constructor.

~LayerStack()

Destructor.

void PushLayer(Layer *layer)

Adds a layer to the stack.

Parameters:

layer – Pointer to the layer to be added.

void PushOverlay(Layer *overlay)

Adds an overlay to the stack.

Parameters:

overlay – Pointer to the overlay to be added.

void PopLayer(Layer *layer)

Removes a layer from the stack.

Parameters:

layer – Pointer to the layer to be removed.

void PopOverlay(Layer *overlay)

Removes an overlay from the stack.

Parameters:

overlay – Pointer to the overlay to be removed.

inline std::vector<Layer*>::iterator begin()

Returns an iterator to the beginning of the layer stack.

Returns:

Iterator to the beginning of the layer stack.

inline std::vector<Layer*>::iterator end()

Returns an iterator to the end of the layer stack.

Returns:

Iterator to the end of the layer stack.

inline std::vector<Layer*>::reverse_iterator rbegin()

Returns a reverse iterator to the beginning of the layer stack.

Returns:

Reverse iterator to the beginning of the layer stack.

inline std::vector<Layer*>::reverse_iterator rend()

Returns a reverse iterator to the end of the layer stack.

Returns:

Reverse iterator to the end of the layer stack.

inline std::vector<Layer*>::const_iterator begin() const

Returns a constant iterator to the beginning of the layer stack.

Returns:

Constant iterator to the beginning of the layer stack.

inline std::vector<Layer*>::const_iterator end() const

Returns a constant iterator to the end of the layer stack.

Returns:

Constant iterator to the end of the layer stack.

inline std::vector<Layer*>::const_reverse_iterator rbegin() const

Returns a constant reverse iterator to the beginning of the layer stack.

Returns:

Constant reverse iterator to the beginning of the layer stack.

inline std::vector<Layer*>::const_reverse_iterator rend() const

Returns a constant reverse iterator to the end of the layer stack.

Returns:

Constant reverse iterator to the end of the layer stack.

struct LightComponent
#include <Components.h>

Component representing a light.

Public Types

enum Type

Enum representing the type of light.

Values:

enumerator DirectionalLight

Directional light.

enumerator PointLight

Point light.

enumerator SpotLight

Spot light.

Public Functions

template<class Archive>
inline void serialize(Archive &archive)

Serializes the LightComponent.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

Public Members

glm::vec3 Color = {1.0f, 1.0f, 1.0f}

The color of the light.

glm::vec3 Direction = {0.0f, -1.0f, 0.0f}

The direction of the light.

glm::vec3 Position = {0.0f, 0.0f, 0.0f}

The position of the light.

float Range = 5.0f

The range of the light.

float Attenuation = 1.0f

The attenuation of the light.

float Intensity = 1.0f

The intensity of the light.

float Angle = 45.0f

The angle of the light.

int type = static_cast<int>(Type::DirectionalLight)

The type of the light.

class LinuxSystemInfo : public Coffee::SystemInfo

Public Functions

virtual uint32_t GetPhysicalProcessorCountImpl() const override

Gets the number of physical processors.

Returns:

The number of physical processors.

virtual uint64_t GetAvailableMemoryImpl() const override

Gets the amount of available memory in the system.

Returns:

The amount of available memory in the system.

virtual uint64_t GetUsedMemoryImpl() const override

Gets the amount of memory used in the system.

Returns:

The amount of memory used in the system.

virtual uint64_t GetProcessMemoryUsageImpl() const override

Gets the amount of memory used by the process.

Returns:

The amount of memory used by the process.

class Log
#include <Log.h>

The Log class is responsible for initializing and providing access to the core and client loggers.

Public Static Functions

static void Init()

Initializes the logging system.

static inline std::shared_ptr<spdlog::logger> &GetCoreLogger()

Gets the core logger.

Returns:

A shared pointer to the core logger.

static inline std::shared_ptr<spdlog::logger> &GetClientLogger()

Gets the client logger.

Returns:

A shared pointer to the client logger.

class Material
#include <Material.h>

Class representing a material.

Public Functions

Material()

Default constructor for the Material class.

Material(Ref<Shader> shader)

Constructs a Material with the specified shader.

Parameters:

shader – The shader to be used with the material.

Material(std::string &path)

Constructs a Material from a file path.

Note

This constructor is for future use when the material YAML exists.

Parameters:

path – The file path to the material definition.

Material(MaterialTextures &materialTextures)

Constructs a Material with the specified textures.

Parameters:

materialTextures – The textures to be used with the material.

~Material() = default

Default destructor for the Material class.

void Use()

Uses the material by binding its shader and textures.

inline Ref<Shader> GetShader()

Gets the shader associated with the material.

Returns:

A reference to the shader.

struct MaterialComponent
#include <Components.h>

Component representing a material.

Public Functions

template<class Archive>
inline void serialize(Archive &archive)

Serializes the MaterialComponent.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

Public Members

Ref<Material> material

The material reference.

struct MaterialProperties
#include <Material.h>

Structure representing the properties of a material.

Public Members

glm::vec4 color = glm::vec4(1.0f)

The color of the material.

float metallic = 0.0f

The metallic value of the material.

float roughness = 1.0f

The roughness value of the material.

float ao = 1.0f

The ambient occlusion value of the material.

glm::vec3 emissive = glm::vec3(0.0f)

The emissive value of the material.

struct MaterialRenderSettings
struct MaterialTextureFlags

Public Members

bool hasAlbedo = false

Whether the material has an albedo texture.

bool hasNormal = false

Whether the material has a normal map texture.

bool hasMetallic = false

Whether the material has a metallic texture.

bool hasRoughness = false

Whether the material has a roughness texture.

bool hasAO = false

Whether the material has an ambient occlusion texture.

bool hasEmissive = false

Whether the material has an emissive texture.

struct MaterialTextures
#include <Material.h>

Structure representing the textures used in a material.

Public Members

Ref<Texture> albedo

The albedo texture.

Ref<Texture> normal

The normal map texture.

Ref<Texture> metallic

The metallic texture.

Ref<Texture> roughness

The roughness texture.

Ref<Texture> ao

The ambient occlusion texture.

Ref<Texture> emissive

The emissive texture.

class Mesh
#include <Mesh.h>

Class representing a mesh.

Public Functions

Mesh(const std::vector<uint32_t> &indices, const std::vector<Vertex> &vertices)

Constructs a Mesh with the specified indices and vertices.

Parameters:
  • indices – The indices of the mesh.

  • vertices – The vertices of the mesh.

inline const Ref<VertexArray> &GetVertexArray() const

Gets the vertex array of the mesh.

Returns:

A reference to the vertex array.

inline const Ref<VertexBuffer> &GetVertexBuffer() const

Gets the vertex buffer of the mesh.

Returns:

A reference to the vertex buffer.

inline const Ref<IndexBuffer> &GetIndexBuffer() const

Gets the index buffer of the mesh.

Returns:

A reference to the index buffer.

inline void SetName(const std::string &name)

Sets the name of the mesh.

Parameters:

name – The name of the mesh.

inline const std::string &GetName() const

Gets the name of the mesh.

Returns:

The name of the mesh.

inline void SetMaterial(Ref<Material> &material)

Sets the material of the mesh.

Parameters:

material – A reference to the material.

inline void SetAABB(const AABB aabb)

Sets the axis-aligned bounding box (AABB) of the mesh.

Parameters:

aabb – The axis-aligned bounding box to set.

inline const AABB &GetAABB()

Gets the axis-aligned bounding box (AABB) of the mesh.

Returns:

A reference to the AABB.

inline AABB GetAABB(const glm::mat4 &transform)

Gets the transformed axis-aligned bounding box (AABB) of the mesh.

Parameters:

transform – The transformation matrix.

Returns:

The transformed AABB.

inline OBB GetOBB(const glm::mat4 &transform)

Gets the oriented bounding box (OBB) of the mesh.

Parameters:

transform – The transformation matrix.

Returns:

The OBB.

inline const Ref<Material> &GetMaterial() const

Gets the material of the mesh.

Returns:

A reference to the material.

inline const std::vector<Vertex> &GetVertices() const

Gets the vertices of the mesh.

Returns:

A reference to the vector of vertices.

inline const std::vector<uint32_t> &GetIndices() const

Gets the indices of the mesh.

Returns:

A reference to the vector of indices.

template<class Archive>
inline void save(Archive &archive)

Serializes the mesh to an archive.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

template<class Archive>
inline void load(Archive &archive)

Deserializes the mesh from an archive.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to deserialize from.

struct MeshComponent
#include <Components.h>

Component representing a mesh.

Public Functions

inline const Ref<Mesh> &GetMesh() const

Gets the mesh reference.

Returns:

The mesh reference.

template<class Archive>
inline void save(Archive &archive)

Serializes the MeshComponent.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

template<class Archive>
inline void load(Archive &archive)

Deserializes the MeshComponent.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to deserialize from.

Public Members

Ref<Mesh> mesh

The mesh reference.

bool drawAABB = false

Flag to draw the axis-aligned bounding box (AABB).

class Model : public Coffee::Resource
#include <Model.h>

Class representing a 3D model.

Public Functions

inline Model()

Default constructor for the Model class.

Model(const std::filesystem::path &path)

Constructs a Model from a file path.

Parameters:

filePath – The file path to the model.

inline const std::vector<Ref<Mesh>> &GetMeshes() const

Gets the meshes of the model.

Returns:

A reference to the vector of meshes.

inline void AddMesh(const Ref<Mesh> mesh)

Adds a mesh to the model.

Parameters:

mesh – A reference to the mesh to add.

inline std::string &GetName()

Gets the name of the model.

Returns:

A reference to the name of the model.

inline const Model *GetParent() const

Gets the parent model.

Returns:

A pointer to the parent model.

inline const std::vector<Ref<Model>> GetChildren() const

Gets the children models.

Returns:

A reference to the vector of children models.

inline const glm::mat4 GetTransform() const

Gets the transformation matrix of the model.

Returns:

The transformation matrix.

Public Static Functions

static Ref<Model> Load(const std::filesystem::path &path)

Loads a model from the specified file path.

Parameters:

path – The path to the model file.

class MouseButtonEvent : public Coffee::Event
#include <MouseEvent.h>

Base class for mouse button events.

Subclassed by Coffee::MouseButtonPressedEvent, Coffee::MouseButtonReleasedEvent

Public Functions

inline MouseCode GetMouseButton() const

Get the mouse button associated with the event.

Returns:

The mouse button.

class MouseButtonPressedEvent : public Coffee::MouseButtonEvent
#include <MouseEvent.h>

Event for mouse button press.

Public Functions

inline MouseButtonPressedEvent(const MouseCode button)

Constructor for MouseButtonPressedEvent.

Parameters:

button – The mouse button associated with the event.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

class MouseButtonReleasedEvent : public Coffee::MouseButtonEvent
#include <MouseEvent.h>

Event for mouse button release.

Public Functions

inline MouseButtonReleasedEvent(const MouseCode button)

Constructor for MouseButtonReleasedEvent.

Parameters:

button – The mouse button associated with the event.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

class MouseMovedEvent : public Coffee::Event
#include <MouseEvent.h>

Event for mouse movement.

Public Functions

inline MouseMovedEvent(const float x, const float y)

Constructor for MouseMovedEvent.

Parameters:
  • x – The x-coordinate of the mouse.

  • y – The y-coordinate of the mouse.

inline float GetX() const

Get the x-coordinate of the mouse.

Returns:

The x-coordinate.

inline float GetY() const

Get the y-coordinate of the mouse.

Returns:

The y-coordinate.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

class MouseScrolledEvent : public Coffee::Event
#include <MouseEvent.h>

Event for mouse scrolling.

Public Functions

inline MouseScrolledEvent(const float xOffset, const float yOffset)

Constructor for MouseScrolledEvent.

Parameters:
  • xOffset – The scroll offset along the x-axis.

  • yOffset – The scroll offset along the y-axis.

inline float GetXOffset() const

Get the scroll offset along the x-axis.

Returns:

The x-axis scroll offset.

inline float GetYOffset() const

Get the scroll offset along the y-axis.

Returns:

The y-axis scroll offset.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

struct OBB
#include <Mesh.h>

Structure representing an oriented bounding box (OBB).

Public Functions

inline OBB(const std::array<glm::vec3, 8> &corners)

Constructs an OBB with specified corners.

Parameters:

corners – The corners of the OBB.

inline OBB(const glm::mat4 &transform, const AABB &aabb)

Constructs an OBB from a transformation matrix and an AABB.

Parameters:
  • transform – The transformation matrix.

  • aabb – The axis-aligned bounding box.

Public Members

std::array<glm::vec3, 8> corners

The corners of the OBB.

class PrimitiveMesh
#include <PrimitiveMesh.h>

Class representing different types of primitive meshes.

Public Static Functions

static Ref<Mesh> CreateQuad()

Creates a quad mesh.

Returns:

A reference to the created quad mesh.

static Ref<Mesh> CreateCube(const glm::vec3 &size = {1.0f, 1.0f, 1.0f}, int subdivideW = 0, int subdidiveH = 0, int subdivideD = 0)

Creates a cube mesh.

Creates a cube mesh.

Parameters:
  • size – The size of the cube.

  • subdivideW – Number of subdivisions along the width.

  • subdivideH – Number of subdivisions along the height.

  • subdivideD – Number of subdivisions along the depth.

  • size – The size of the cube.

  • subdivideW – Subdivision parameter for width (currently not functional).

  • subdivideH – Subdivision parameter for height (currently not functional).

  • subdivideD – Subdivision parameter for depth (currently not functional).

Returns:

A reference to the created cube mesh.

Returns:

Ref<Mesh> A reference to the created cube mesh.

static Ref<Mesh> CreateSphere(float radius = 0.5f, float height = 1.0f, int radialSegments = 64, int rings = 32, bool isHemiSphere = false)

Creates a sphere mesh.

Parameters:
  • radius – The radius of the sphere.

  • height – The height of the sphere.

  • radialSegments – Number of radial segments.

  • rings – Number of rings.

  • isHemiSphere – Whether the sphere is a hemisphere.

Returns:

A reference to the created sphere mesh.

static Ref<Mesh> CreatePlane(const glm::vec2 &size = {1.0f, 1.0f}, const glm::vec3 &normal = {0.0f, 1.0f, 0.0f})

Creates a plane mesh.

Parameters:
  • size – The size of the plane.

  • normal – The normal vector of the plane.

Returns:

A reference to the created plane mesh.

static Ref<Mesh> CreateCylinder(float topRadius = 0.5f, float bottomRadius = 0.5f, float height = 1.0f, int radialSegments = 64, int rings = 1, bool capTop = true, bool capBottom = true)

Creates a cylinder mesh.

Parameters:
  • topRadius – The radius of the top of the cylinder.

  • bottomRadius – The radius of the bottom of the cylinder.

  • height – The height of the cylinder.

  • radialSegments – Number of radial segments.

  • rings – Number of rings.

  • capTop – Whether to cap the top of the cylinder.

  • capBottom – Whether to cap the bottom of the cylinder.

Returns:

A reference to the created cylinder mesh.

static Ref<Mesh> CreateCone(float radius = 0.5f, float height = 1.0f, int radialSegments = 64, int rings = 1, bool cap = true)

Creates a cone mesh.

Parameters:
  • radius – The radius of the base of the cone.

  • height – The height of the cone.

  • radialSegments – Number of radial segments.

  • rings – Number of rings.

  • cap – Whether to cap the base of the cone.

Returns:

A reference to the created cone mesh.

static Ref<Mesh> CreateTorus(float innerRadius = 0.5f, float outerRadius = 1.0f, int rings = 64, int ringSegments = 32)

Creates a torus mesh.

Parameters:
  • innerRadius – The inner radius of the torus.

  • outerRadius – The outer radius of the torus.

  • rings – Number of rings.

  • ringSegments – Number of ring segments.

Returns:

A reference to the created torus mesh.

static Ref<Mesh> CreateCapsule(float radius = 0.5f, float height = 2.0f, int radialSegments = 64, int rings = 8)

Creates a capsule mesh.

Parameters:
  • radius – The radius of the capsule.

  • height – The height of the capsule.

  • radialSegments – Number of radial segments.

  • rings – Number of rings.

Returns:

A reference to the created capsule mesh.

class Project
#include <Project.h>

The Project class is responsible for managing project data such as name, directory, and start scene path.

Public Functions

template<class Archive>
inline void serialize(Archive &archive)

Serializes the project data.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

Public Static Functions

static Ref<Project> New(const std::filesystem::path &path)

Creates a new project.

Returns:

A reference to the newly created project.

static Ref<Project> Load(const std::filesystem::path &path)

Loads a project from the specified path.

Parameters:

path – The path to the project file.

Returns:

A reference to the loaded project.

static void SaveActive()

Saves the active project to the specified path.

Parameters:

path – The path to save the project file.

static inline Ref<Project> GetActive()

Gets the active project.

Returns:

A reference to the active project.

static inline const std::filesystem::path &GetProjectDirectory()

Gets the directory of the active project.

Returns:

The path to the project directory.

static inline const std::string &GetProjectName()

Gets the name of the active project.

Returns:

The name of the project.

static inline std::filesystem::path GetCacheDirectory()

Retrieves the cache directory path of the active project.

This static method returns a constant reference to the cache directory path associated with the currently active project.

Returns:

const std::filesystem::path& Reference to the cache directory path.

class Renderer
#include <Renderer.h>

Class representing the 3D renderer.

Public Static Functions

static void Init()

Initializes the renderer.

static void Shutdown()

Shuts down the renderer.

static void BeginScene(EditorCamera &camera)

Begins a new scene with the specified editor camera.

Parameters:

camera – The editor camera.

static void BeginScene(Camera &camera, const glm::mat4 &transform)

Begins a new scene with the specified camera and transform.

Parameters:
  • camera – The camera.

  • transform – The transform matrix.

static void EndScene()

Ends the current scene.

static void BeginOverlay(EditorCamera &camera)

Begins an overlay with the specified editor camera.

Parameters:

camera – The editor camera.

static void EndOverlay()

Ends the current overlay.

static void Submit(const Ref<Shader> &shader, const Ref<VertexArray> &vertexArray, const glm::mat4 &transform = glm::mat4(1.0f), uint32_t entityID = 4294967295)

Submits a draw call with the specified shader, vertex array, and transform.

Parameters:
  • shader – The shader.

  • vertexArray – The vertex array.

  • transform – The transform matrix.

static void Submit(const Ref<Material> &material, const Ref<Mesh> &mesh, const glm::mat4 &transform = glm::mat4(1.0f), uint32_t entityID = 4294967295)

Submits a draw call with the specified material, mesh, and transform.

Parameters:
  • material – The material.

  • mesh – The mesh.

  • transform – The transform matrix.

static void Submit(const LightComponent &light)

Submits a light component.

Parameters:

light – The light component.

static void OnResize(uint32_t width, uint32_t height)

Resizes the renderer to the specified width and height.

Parameters:
  • width – The new width.

  • height – The new height.

static inline const Ref<Texture> &GetRenderTexture()

Gets the render texture.

Returns:

A reference to the render texture.

static inline const Ref<Texture> &GetEntityIDTexture()

Retrieves the texture associated with the entity ID.

This static method returns a reference to the texture that is used to identify entities within the renderer. The texture is stored as a static member of the class.

Returns:

A constant reference to the entity ID texture.

static inline const RendererData &GetData()

Gets the renderer data.

Returns:

A reference to the renderer data.

static inline const RendererStats &GetStats()

Gets the renderer statistics.

Returns:

A reference to the renderer statistics.

static inline RenderSettings &GetRenderSettings()

Gets the render settings.

Returns:

A reference to the render settings.

class RendererAPI
#include <RendererAPI.h>

Class representing the Renderer API.

Public Static Functions

static void Init()

Initializes the Renderer API.

static void SetClearColor(const glm::vec4 &color)

Sets the clear color for the renderer.

Parameters:

color – The clear color as a glm::vec4.

static void Clear()

Clears the current buffer.

static void SetDepthMask(bool enabled)

Enables or disables the depth mask.

Parameters:

enabled – True to enable the depth mask, false to disable it.

static void DrawIndexed(const Ref<VertexArray> &vertexArray)

Draws the indexed vertices from the specified vertex array.

Parameters:

vertexArray – The vertex array containing the vertices to draw.

static void DrawLines(const Ref<VertexArray> &vertexArray, uint32_t vertexCount, float lineWidth = 1.0f)

Draws lines from the specified vertex array.

Parameters:
  • vertexArray – The vertex array containing the vertices to draw.

  • vertexCount – The number of vertices to draw.

  • lineWidth – The width of the lines.

static Scope<RendererAPI> Create()

Creates a new Renderer API instance.

Returns:

A scope pointer to the created Renderer API instance.

struct RendererData
#include <Renderer.h>

Structure containing renderer data.

Public Members

CameraData cameraData

Camera data.

RenderData renderData

Render data.

Ref<UniformBuffer> CameraUniformBuffer

Uniform buffer for camera data.

Ref<UniformBuffer> RenderDataUniformBuffer

Uniform buffer for render data.

Ref<Texture> RenderTexture

Render texture.

struct CameraData
#include <Renderer.h>

Structure containing camera data.

Public Members

glm::mat4 projection

The projection matrix.

glm::mat4 view

The view matrix.

glm::vec3 position

The position of the camera.

struct RenderData
#include <Renderer.h>

Structure containing render data.

Public Members

LightComponent lights[32]

Array of light components.

int lightCount = 0

Number of lights.

struct RendererStats
#include <Renderer.h>

Structure containing renderer statistics.

Public Members

uint32_t DrawCalls = 0

Number of draw calls.

uint32_t VertexCount = 0

Number of vertices.

uint32_t IndexCount = 0

Number of indices.

struct RenderSettings
#include <Renderer.h>

Structure containing render settings.

Public Members

bool PostProcessing = true

Enable or disable post-processing.

bool SSAO = false

Enable or disable SSAO.

bool Bloom = false

Enable or disable bloom.

bool FXAA = false

Enable or disable FXAA.

float Exposure = 1.0f

Exposure value.

class Resource
#include <Resource.h>

Base class for different types of resources in the CoffeeEngine.

Subclassed by Coffee::Model, Coffee::Shader, Coffee::Texture

Public Functions

inline Resource(ResourceType type = ResourceType::Unknown)

Constructor that initializes the resource with a type.

Parameters:

type – The type of the resource.

virtual ~Resource() = default

Virtual destructor.

inline const std::string &GetName() const

Gets the name of the resource.

Returns:

The name of the resource.

inline const std::filesystem::path &GetPath()

Gets the file path of the resource.

Returns:

The file path of the resource.

inline ResourceType GetType() const

Gets the type of the resource.

Returns:

The type of the resource.

class ResourceImporter
#include <ResourceImporter.h>

Handles the import of resources such as textures.

Public Functions

Ref<Texture> ImportTexture(const std::filesystem::path &path, bool srgb, bool cache)

Imports a texture from a given file path.

Parameters:
  • path – The file path of the texture to import.

  • srgb – Whether the texture should be imported in sRGB format.

  • cache – Whether the texture should be cached.

Returns:

A reference to the imported texture.

class ResourceLoader
#include <ResourceLoader.h>

Loads resources such as textures and models for the CoffeeEngine.

Public Static Functions

static void LoadDirectory(const std::filesystem::path &directory)

Loads all resources from a directory.

Parameters:

directory – The directory to load resources from.

static void LoadFile(const std::filesystem::path &path)

Loads a single resource file.

Parameters:

path – The file path of the resource to load.

static Ref<Texture> LoadTexture(const std::filesystem::path &path, bool srgb = true, bool cache = true)

Loads a texture from a file.

Parameters:
  • path – The file path of the texture to load.

  • srgb – Whether the texture should be loaded in sRGB format.

  • cache – Whether the texture should be cached.

Returns:

A reference to the loaded texture.

static Ref<Model> LoadModel(const std::filesystem::path &path, bool cache = true)

Loads a model from a file.

Parameters:
  • path – The file path of the model to load.

  • cache – Whether the model should be cached.

Returns:

A reference to the loaded model.

class ResourceRegistry
#include <ResourceRegistry.h>

Manages the registration and retrieval of resources.

Public Static Functions

static inline void Add(const std::string &name, Ref<Resource> resource)

Adds a resource to the registry.

Parameters:
  • name – The name of the resource.

  • resource – A reference to the resource to add.

template<typename T>
static inline Ref<T> Get(const std::string &name)

Retrieves a resource from the registry.

Template Parameters:

T – The type of the resource.

Parameters:

name – The name of the resource.

Returns:

A reference to the resource, or nullptr if not found.

static inline bool Exists(const std::string &name)

Checks if a resource exists in the registry.

Parameters:

name – The name of the resource.

Returns:

True if the resource exists, false otherwise.

static inline void Clear()

Clears all resources from the registry.

static inline const std::unordered_map<std::string, Ref<Resource>> &GetResourceRegistry()

Gets the entire resource registry.

Returns:

A constant reference to the resource registry.

class ResourceSaver
#include <ResourceSaver.h>

Handles saving resources to disk and cache.

Public Static Functions

static void Save(const std::filesystem::path &path, const Ref<Resource> &resource)

Saves a resource to a specified path on disk.

Parameters:
  • path – The file path where the resource will be saved.

  • resource – A reference to the resource to save.

static void SaveToCache(const Ref<Resource> &resource)

Saves a resource to the project cache.

Parameters:

resource – A reference to the resource to save to cache.

class Scene
#include <Scene.h>

Class representing a scene.

Public Functions

Scene()

Constructor for Scene.

~Scene() = default

Default destructor.

Entity CreateEntity(const std::string &name = std::string())

Create an entity in the scene.

Parameters:

name – The name of the entity.

Returns:

The created entity.

void DestroyEntity(Entity entity)

Destroy an entity in the scene.

Parameters:

entity – The entity to destroy.

void OnInit()

Initialize the scene.

void OnUpdateEditor(EditorCamera &camera, float dt)

Update the scene in editor mode.

Parameters:
  • camera – The editor camera.

  • dt – The delta time.

void OnUpdateRuntime(float dt)

Update the scene in runtime mode.

Parameters:

dt – The delta time.

void OnEvent(Event &e)

Handle an event in the scene.

Parameters:

e – The event.

void OnExit()

Exit the scene.

Public Static Functions

static Ref<Scene> Load(const std::filesystem::path &path)

Load a scene from a file.

Parameters:

path – The path to the file.

Returns:

The loaded scene.

static void Save(const std::filesystem::path &path, Ref<Scene> scene)

Save a scene to a file.

Parameters:
  • path – The path to the file.

  • scene – The scene to save.

class SceneCamera : public Coffee::Camera
#include <SceneCamera.h>

Camera class for the scene.

Public Functions

SceneCamera()

Constructor for SceneCamera.

~SceneCamera() = default

Default destructor.

class SceneTree
#include <SceneTree.h>

Class for managing the scene tree.

Public Functions

SceneTree(Scene *scene)

Constructor for SceneTree.

Parameters:

scene – The scene context.

~SceneTree() = default

Default destructor.

void Update()

Update the scene tree.

void UpdateTransform(entt::entity entity)

Update the transform of an entity.

Parameters:

entity – The entity to update.

class Shader : public Coffee::Resource
#include <Shader.h>

Class representing a shader program.

Public Functions

Shader(const std::string &vertexPath, const std::string &fragmentPath)

Constructs a Shader with the specified vertex and fragment shader paths.

Parameters:
  • vertexPath – The file path to the vertex shader.

  • fragmentPath – The file path to the fragment shader.

virtual ~Shader()

Destructor for the Shader class.

void Bind()

Binds the shader program for use.

void Unbind()

Unbinds the shader program.

void setBool(const std::string &name, bool value) const

Sets a boolean uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • value – The boolean value to set.

void setInt(const std::string &name, int value) const

Sets an integer uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • value – The integer value to set.

void setFloat(const std::string &name, float value) const

Sets a float uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • value – The float value to set.

void setVec2(const std::string &name, const glm::vec2 &value) const

Sets a vec2 uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • value – The vec2 value to set.

void setVec3(const std::string &name, const glm::vec3 &value) const

Sets a vec3 uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • value – The vec3 value to set.

void setVec4(const std::string &name, const glm::vec4 &value) const

Sets a vec4 uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • value – The vec4 value to set.

void setMat2(const std::string &name, const glm::mat2 &mat) const

Sets a mat2 uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • mat – The mat2 value to set.

void setMat3(const std::string &name, const glm::mat3 &mat) const

Sets a mat3 uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • mat – The mat3 value to set.

void setMat4(const std::string &name, const glm::mat4 &mat) const

Sets a mat4 uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • mat – The mat4 value to set.

void checkCompileErrors(GLuint shader, std::string type)

Checks for compile errors in the shader.

Parameters:
  • shader – The shader ID.

  • type – The type of the shader.

Public Static Functions

static Ref<Shader> Create(const std::string &vertexPath, const std::string &fragmentPath)

Creates a shader from the specified vertex and fragment shader paths.

Parameters:
  • vertexPath – The file path to the vertex shader.

  • fragmentPath – The file path to the fragment shader.

Returns:

A reference to the created shader.

class Stopwatch
#include <Stopwatch.h>

A class to measure elapsed time.

The Stopwatch class provides functionality to start, stop, reset, and retrieve the elapsed time. It supports both regular and high-precision timing.

Public Functions

Stopwatch()

Constructs a new Stopwatch object.

void Start()

Starts the stopwatch.

If the stopwatch is already running, this method has no effect.

void Stop()

Stops the stopwatch.

If the stopwatch is not running, this method has no effect.

void Reset()

Resets the stopwatch.

This method stops the stopwatch and resets the elapsed time to zero.

float GetElapsedTime() const

Gets the elapsed time in seconds.

Returns:

The elapsed time in seconds.

double GetPreciseElapsedTime() const

Gets the precise elapsed time in seconds.

This method uses SDL_GetPerformanceCounter for higher precision.

Returns:

The precise elapsed time in seconds.

class SystemInfo

Subclassed by Coffee::LinuxSystemInfo, Coffee::WindowsSystemInfo

Public Functions

virtual uint32_t GetPhysicalProcessorCountImpl() const = 0

Gets the number of physical processors.

Returns:

The number of physical processors.

virtual uint64_t GetAvailableMemoryImpl() const = 0

Gets the amount of available memory in the system.

Returns:

The amount of available memory in the system.

virtual uint64_t GetUsedMemoryImpl() const = 0

Gets the amount of memory used in the system.

Returns:

The amount of memory used in the system.

virtual uint64_t GetProcessMemoryUsageImpl() const = 0

Gets the amount of memory used by the process.

Returns:

The amount of memory used by the process.

Public Static Functions

static uint32_t GetLogicalProcessorCount()

Gets the number of logical processors.

static uint32_t GetPhysicalProcessorCount()

Gets the number of physical processors.

static uint64_t GetTotalMemory()

Gets the total memory in the system.

static uint64_t GetAvailableMemory()

Gets the available memory in the system.

static uint64_t GetUsedMemory()

Gets the used memory in the system.

static uint64_t GetProcessMemoryUsage()

Gets the memory used by the process.

struct TagComponent
#include <Components.h>

Component representing a tag.

Public Functions

template<class Archive>
inline void serialize(Archive &archive)

Serializes the TagComponent.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

Public Members

std::string Tag

The tag string.

class Texture : public Coffee::Resource
#include <Texture.h>

Class representing a texture.

Public Functions

Texture(const TextureProperties &properties)

Constructs a Texture with the specified properties.

Parameters:

properties – The properties of the texture.

Texture(uint32_t width, uint32_t height, ImageFormat imageFormat)

Constructs a Texture with the specified width, height, and image format.

Parameters:
  • width – The width of the texture.

  • height – The height of the texture.

  • imageFormat – The format of the image.

Texture(const std::filesystem::path &path, bool srgb = true)

Constructs a Texture from a file path.

Parameters:
  • path – The file path to the texture.

  • srgb – Whether the texture is in sRGB format.

~Texture()

Destructor for the Texture class.

void Bind(uint32_t slot)

Binds the texture to the specified slot.

Parameters:

slot – The slot to bind the texture to.

void Resize(uint32_t width, uint32_t height)

Resizes the texture to the specified width and height.

Parameters:
  • width – The new width of the texture.

  • height – The new height of the texture.

inline std::pair<uint32_t, uint32_t> GetSize()

Gets the size of the texture.

Returns:

A pair containing the width and height of the texture.

inline uint32_t GetWidth()

Gets the width of the texture.

Returns:

The width of the texture.

inline uint32_t GetHeight()

Gets the height of the texture.

Returns:

The height of the texture.

inline uint32_t GetID()

Gets the ID of the texture.

Returns:

The ID of the texture.

inline ImageFormat GetImageFormat()

Gets the image format of the texture.

Returns:

The image format of the texture.

Public Static Functions

static Ref<Texture> Load(const std::filesystem::path &path, bool srgb = true)

Loads a texture from a file path.

Parameters:
  • path – The file path to the texture.

  • srgb – Whether the texture is in sRGB format.

Returns:

A reference to the loaded texture.

static Ref<Texture> Create(uint32_t width, uint32_t height, ImageFormat format)

Creates a texture with the specified width, height, and format.

Parameters:
  • width – The width of the texture.

  • height – The height of the texture.

  • format – The format of the texture.

Returns:

A reference to the created texture.

struct TextureProperties
#include <Texture.h>

Structure representing properties of a texture.

Public Members

ImageFormat Format

The format of the image.

uint32_t Height

The width and height of the texture.

bool GenerateMipmaps = true

Whether to generate mipmaps.

bool srgb = true

Whether the texture is in sRGB format.

class Timer
#include <Timer.h>

A class that represents a timer with various functionalities.

Public Functions

inline Timer()

Default constructor.

Timer(double waitTime, bool autoStart, bool oneShot, TimerCallback callback)

Parameterized constructor.

Parameters:
  • waitTime – The time to wait before the timer triggers.

  • autoStart – Whether the timer should start automatically.

  • oneShot – Whether the timer should trigger only once.

  • callback – The callback function to be called when the timer triggers.

void Start(double waitTime)

Starts the timer with a specified wait time.

Parameters:

waitTime – The time to wait before the timer triggers.

void Stop()

Stops the timer.

void setWaitTime(double waitTime)

Sets the wait time for the timer.

Parameters:

waitTime – The time to wait before the timer triggers.

inline double getWaitTime() const

Gets the wait time of the timer.

Returns:

The time to wait before the timer triggers.

inline void setOneShot(bool oneShot)

Sets whether the timer should trigger only once.

Parameters:

oneShot – Whether the timer should trigger only once.

inline bool isOneShot() const

Checks if the timer is set to trigger only once.

Returns:

True if the timer is set to trigger only once, false otherwise.

inline void setAutoStart(bool autoStart)

Sets whether the timer should start automatically.

Parameters:

autoStart – Whether the timer should start automatically.

inline bool isAutoStart() const

Checks if the timer is set to start automatically.

Returns:

True if the timer is set to start automatically, false otherwise.

void setPaused(bool paused)

Sets whether the timer is paused.

Parameters:

paused – Whether the timer is paused.

inline bool isPaused() const

Checks if the timer is paused.

Returns:

True if the timer is paused, false otherwise.

void isStopped()

Checks if the timer is stopped.

inline double GetTimeLeft() const

Gets the remaining time before the timer triggers.

Returns:

The remaining time before the timer triggers.

inline void SetCallback(TimerCallback callback)

Sets the callback function to be called when the timer triggers.

Parameters:

callback – The callback function.

inline TimerCallback GetCallback() const

Gets the callback function to be called when the timer triggers.

Returns:

The callback function.

struct TransformComponent
#include <Components.h>

Component representing a transform.

Public Functions

inline glm::mat4 GetLocalTransform() const

Gets the local transformation matrix.

Returns:

The local transformation matrix.

inline void SetLocalTransform(const glm::mat4 &transform)

Sets the local transformation matrix.

Parameters:

transform – The transformation matrix to set.

inline const glm::mat4 &GetWorldTransform() const

Gets the world transformation matrix.

Returns:

The world transformation matrix.

inline void SetWorldTransform(const glm::mat4 &transform)

Sets the world transformation matrix.

Parameters:

transform – The transformation matrix to set.

template<class Archive>
inline void serialize(Archive &archive)

Serializes the TransformComponent.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

Public Members

glm::vec3 Position = {0.0f, 0.0f, 0.0f}

The position vector.

glm::vec3 Rotation = {0.0f, 0.0f, 0.0f}

The rotation vector.

glm::vec3 Scale = {1.0f, 1.0f, 1.0f}

The scale vector.

class UniformBuffer
#include <UniformBuffer.h>

Class representing a uniform buffer.

Public Functions

UniformBuffer(uint32_t size, uint32_t binding)

Constructs a UniformBuffer with the specified size and binding.

Parameters:
  • size – The size of the buffer.

  • binding – The binding point of the buffer.

virtual ~UniformBuffer()

Destructor for the UniformBuffer class.

void SetData(const void *data, uint32_t size, uint32_t offset = 0)

Sets the data of the uniform buffer.

Parameters:
  • data – A pointer to the data to set.

  • size – The size of the data.

  • offset – The offset in the buffer to set the data.

Public Static Functions

static Ref<UniformBuffer> Create(uint32_t size, uint32_t binding)

Creates a uniform buffer with the specified size and binding.

Parameters:
  • size – The size of the buffer.

  • binding – The binding point of the buffer.

Returns:

A reference to the created uniform buffer.

struct Vertex
#include <Mesh.h>

Structure representing a vertex in a mesh.

Public Members

glm::vec3 Position = glm::vec3(0.0f)

The position of the vertex.

glm::vec2 TexCoords = glm::vec2(0.0f)

The texture coordinates of the vertex.

glm::vec3 Normals = glm::vec3(0.0f)

The normal vector of the vertex.

glm::vec3 Tangent = glm::vec3(0.0f)

The tangent vector of the vertex.

glm::vec3 Bitangent = glm::vec3(0.0f)

The bitangent vector of the vertex.

class VertexArray
#include <VertexArray.h>

Class representing a vertex array.

Public Functions

VertexArray()

Constructs a VertexArray.

virtual ~VertexArray()

Destructor for the VertexArray class.

void Bind()

Binds the vertex array.

void Unbind()

Unbinds the vertex array.

void AddVertexBuffer(const Ref<VertexBuffer> &vertexBuffer)

Adds a vertex buffer to the vertex array.

Parameters:

vertexBuffer – A reference to the vertex buffer to add.

void SetIndexBuffer(const Ref<IndexBuffer> &indexBuffer)

Sets the index buffer for the vertex array.

Parameters:

indexBuffer – A reference to the index buffer to set.

inline const std::vector<Ref<VertexBuffer>> &GetVertexBuffers() const

Gets the vertex buffers of the vertex array.

Returns:

A constant reference to the vector of vertex buffers.

inline const Ref<IndexBuffer> &GetIndexBuffer() const

Gets the index buffer of the vertex array.

Returns:

A constant reference to the index buffer.

Public Static Functions

static Ref<VertexArray> Create()

Creates a vertex array.

Returns:

A reference to the created vertex array.

class VertexBuffer
#include <Buffer.h>

Class representing a vertex buffer.

Public Functions

VertexBuffer(uint32_t size)

Constructs a VertexBuffer with the specified size.

Parameters:

size – The size of the buffer.

VertexBuffer(float *vertices, uint32_t size)

Constructs a VertexBuffer with the specified vertices and size.

Parameters:
  • vertices – The vertex data.

  • size – The size of the buffer.

virtual ~VertexBuffer()

Destroys the VertexBuffer.

void Bind()

Binds the vertex buffer.

void Unbind()

Unbinds the vertex buffer.

void SetData(void *data, uint32_t size)

Sets the data of the vertex buffer.

Parameters:
  • data – The data to set.

  • size – The size of the data.

inline const BufferLayout &GetLayout() const

Returns the layout of the vertex buffer.

Returns:

The buffer layout.

inline void SetLayout(const BufferLayout &layout)

Sets the layout of the vertex buffer.

Parameters:

layout – The buffer layout.

Public Static Functions

static Ref<VertexBuffer> Create(uint32_t size)

Creates a vertex buffer with the specified size.

Parameters:

size – The size of the buffer.

Returns:

A reference to the created vertex buffer.

static Ref<VertexBuffer> Create(float *vertices, uint32_t size)

Creates a vertex buffer with the specified vertices and size.

Parameters:
  • vertices – The vertex data.

  • size – The size of the buffer.

Returns:

A reference to the created vertex buffer.

class Window
#include <Window.h>

The Window class is responsible for managing the window and its properties.

Public Functions

Window(const WindowProps &props)

Constructs a Window object with the specified properties.

Parameters:

props – The properties of the window.

virtual ~Window()

Destroys the Window object.

void OnUpdate()

Updates the window.

inline unsigned int GetWidth() const

Gets the width of the window.

Returns:

The width of the window.

inline unsigned int GetHeight() const

Gets the height of the window.

Returns:

The height of the window.

void SetVSync(bool enabled)

Enables or disables VSync.

Parameters:

enabled – True to enable VSync, false to disable.

bool IsVSync() const

Checks if VSync is enabled.

Returns:

True if VSync is enabled, false otherwise.

void SetTitle(const std::string &title)

Sets the title of the window.

Parameters:

title – The new title of the window.

inline const std::string &GetTitle() const

Gets the title of the window.

Returns:

The title of the window.

void SetIcon(const std::string &path)

Sets the icon of the window.

Parameters:

path – The path to the icon file.

inline virtual void *GetNativeWindow() const

Gets the native window handle.

Returns:

A pointer to the native window.

Public Static Functions

static inline Scope<Window> Create(const WindowProps &props = WindowProps())

Creates a window with the specified properties.

Parameters:

props – The properties of the window.

Returns:

A scoped pointer to the created window.

class WindowCloseEvent : public Coffee::Event
#include <ApplicationEvent.h>

Event for window close.

struct WindowProps
#include <Window.h>

Structure to hold window properties such as title, width, and height.

Public Functions

inline WindowProps(const std::string &title = "Coffee Engine", uint32_t width = 1600, uint32_t height = 900)

Constructs WindowProps with default or specified values.

Parameters:
  • title – The title of the window.

  • width – The width of the window.

  • height – The height of the window.

Public Members

std::string Title

The title of the window.

uint32_t Width

The width of the window.

uint32_t Height

The height of the window.

class WindowResizeEvent : public Coffee::Event
#include <ApplicationEvent.h>

Event for window resize.

Public Functions

inline unsigned int GetWidth() const

Get the width of the window.

Returns:

The width of the window.

inline unsigned int GetHeight() const

Get the height of the window.

Returns:

The height of the window.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

class WindowsSystemInfo : public Coffee::SystemInfo

Public Functions

virtual uint32_t GetPhysicalProcessorCountImpl() const override

Gets the number of physical processors.

Returns:

The number of physical processors.

virtual uint64_t GetAvailableMemoryImpl() const override

Gets the amount of available memory in the system.

Returns:

The amount of available memory in the system.

virtual uint64_t GetUsedMemoryImpl() const override

Gets the amount of memory used in the system.

Returns:

The amount of memory used in the system.

virtual uint64_t GetProcessMemoryUsageImpl() const override

Gets the amount of memory used by the process.

Returns:

The amount of memory used by the process.

namespace Key

Enums

Values:

enumerator UNKNOWN
enumerator A
enumerator B
enumerator C
enumerator D
enumerator E
enumerator F
enumerator G
enumerator H
enumerator I
enumerator J
enumerator K
enumerator L
enumerator M
enumerator N
enumerator O
enumerator P
enumerator Q
enumerator R
enumerator S
enumerator T
enumerator U
enumerator V
enumerator W
enumerator X
enumerator Y
enumerator Z
enumerator D1
enumerator D2
enumerator D3
enumerator D4
enumerator D5
enumerator D6
enumerator D7
enumerator D8
enumerator D9
enumerator D0
enumerator RETURN
enumerator ESCAPE
enumerator BACKSPACE
enumerator TAB
enumerator SPACE
enumerator MINUS
enumerator EQUALS
enumerator LEFTBRACKET
enumerator RIGHTBRACKET
enumerator BACKSLASH

Located at the lower left of the return key on ISO keyboards and at the right end of the QWERTY row on ANSI keyboards. Produces REVERSE SOLIDUS (backslash) and VERTICAL LINE in a US layout, REVERSE SOLIDUS and VERTICAL LINE in a UK Mac layout, NUMBER SIGN and TILDE in a UK Windows layout, DOLLAR SIGN and POUND SIGN in a Swiss German layout, NUMBER SIGN and APOSTROPHE in a German layout, GRAVE ACCENT and POUND SIGN in a French Mac layout, and ASTERISK and MICRO SIGN in a French Windows layout.

enumerator NONUSHASH

ISO USB keyboards actually use this code instead of 49 for the same key, but all OSes I’ve seen treat the two codes identically. So, as an implementor, unless your keyboard generates both of those codes and your OS treats them differently, you should generate BACKSLASH instead of this code. As a user, you should not rely on this code because SDL will never generate it with most (all?) keyboards.

enumerator SEMICOLON
enumerator APOSTROPHE
enumerator GRAVE

Located in the top left corner (on both ANSI and ISO keyboards). Produces GRAVE ACCENT and TILDE in a US Windows layout and in US and UK Mac layouts on ANSI keyboards, GRAVE ACCENT and NOT SIGN in a UK Windows layout, SECTION SIGN and PLUS-MINUS SIGN in US and UK Mac layouts on ISO keyboards, SECTION SIGN and DEGREE SIGN in a Swiss German layout (Mac: only on ISO keyboards), CIRCUMFLEX ACCENT and DEGREE SIGN in a German layout (Mac: only on ISO keyboards), SUPERSCRIPT TWO and TILDE in a French Windows layout, COMMERCIAL AT and NUMBER SIGN in a French Mac layout on ISO keyboards, and LESS-THAN SIGN and GREATER-THAN SIGN in a Swiss German, German, or French Mac layout on ANSI keyboards.

enumerator COMMA
enumerator PERIOD
enumerator SLASH
enumerator CAPSLOCK
enumerator F1
enumerator F2
enumerator F3
enumerator F4
enumerator F5
enumerator F6
enumerator F7
enumerator F8
enumerator F9
enumerator F10
enumerator F11
enumerator F12
enumerator PRINTSCREEN
enumerator SCROLLLOCK
enumerator PAUSE
enumerator INSERT

insert on PC, help on some Mac keyboards (but does send code 73, not 117)

enumerator HOME
enumerator PAGEUP
enumerator DELETE
enumerator END
enumerator PAGEDOWN
enumerator RIGHT
enumerator LEFT
enumerator DOWN
enumerator UP
enumerator NUMLOCKCLEAR

num lock on PC, clear on Mac keyboards

enumerator KP_DIVIDE
enumerator KP_MULTIPLY
enumerator KP_MINUS
enumerator KP_PLUS
enumerator KP_ENTER
enumerator KP_1
enumerator KP_2
enumerator KP_3
enumerator KP_4
enumerator KP_5
enumerator KP_6
enumerator KP_7
enumerator KP_8
enumerator KP_9
enumerator KP_0
enumerator KP_PERIOD
enumerator NONUSBACKSLASH

This is the additional key that ISO keyboards have over ANSI ones, located between left shift and Y. Produces GRAVE ACCENT and TILDE in a US or UK Mac layout, REVERSE SOLIDUS (backslash) and VERTICAL LINE in a US or UK Windows layout, and LESS-THAN SIGN and GREATER-THAN SIGN in a Swiss German, German, or French layout.

enumerator APPLICATION

windows contextual menu, compose

enumerator POWER

The USB document says this is a status flag, not a physical key - but some Mac keyboards do have a power key.

enumerator KP_EQUALS
enumerator F13
enumerator F14
enumerator F15
enumerator F16
enumerator F17
enumerator F18
enumerator F19
enumerator F20
enumerator F21
enumerator F22
enumerator F23
enumerator F24
enumerator EXECUTE
enumerator HELP

AL Integrated Help Center

enumerator MENU

Menu (show menu)

enumerator SELECT
enumerator STOP

AC Stop

enumerator AGAIN

AC Redo/Repeat

enumerator UNDO

AC Undo

enumerator CUT

AC Cut

enumerator COPY

AC Copy

enumerator PASTE

AC Paste

enumerator FIND

AC Find

enumerator MUTE
enumerator VOLUMEUP
enumerator VOLUMEDOWN
enumerator KP_COMMA
enumerator KP_EQUALSAS400
enumerator INTERNATIONAL1

used on Asian keyboards, see footnotes in USB doc

enumerator INTERNATIONAL2
enumerator INTERNATIONAL3

Yen

enumerator INTERNATIONAL4
enumerator INTERNATIONAL5
enumerator INTERNATIONAL6
enumerator INTERNATIONAL7
enumerator INTERNATIONAL8
enumerator INTERNATIONAL9
enumerator LANG1

Hangul/English toggle

enumerator LANG2

Hanja conversion

enumerator LANG3

Katakana

enumerator LANG4

Hiragana

enumerator LANG5

Zenkaku/Hankaku

enumerator LANG6

reserved

enumerator LANG7

reserved

enumerator LANG8

reserved

enumerator LANG9

reserved

enumerator ALTERASE

Erase-Eaze

enumerator SYSREQ
enumerator CANCEL

AC Cancel

enumerator CLEAR
enumerator PRIOR
enumerator RETURN2
enumerator SEPARATOR
enumerator OUT
enumerator OPER
enumerator CLEARAGAIN
enumerator CRSEL
enumerator EXSEL
enumerator KP_00
enumerator KP_000
enumerator THOUSANDSSEPARATOR
enumerator DECIMALSEPARATOR
enumerator CURRENCYUNIT
enumerator CURRENCYSUBUNIT
enumerator KP_LEFTPAREN
enumerator KP_RIGHTPAREN
enumerator KP_LEFTBRACE
enumerator KP_RIGHTBRACE
enumerator KP_TAB
enumerator KP_BACKSPACE
enumerator KP_A
enumerator KP_B
enumerator KP_C
enumerator KP_D
enumerator KP_E
enumerator KP_F
enumerator KP_XOR
enumerator KP_POWER
enumerator KP_PERCENT
enumerator KP_LESS
enumerator KP_GREATER
enumerator KP_AMPERSAND
enumerator KP_DBLAMPERSAND
enumerator KP_VERTICALBAR
enumerator KP_DBLVERTICALBAR
enumerator KP_COLON
enumerator KP_HASH
enumerator KP_SPACE
enumerator KP_AT
enumerator KP_EXCLAM
enumerator KP_MEMSTORE
enumerator KP_MEMRECALL
enumerator KP_MEMCLEAR
enumerator KP_MEMADD
enumerator KP_MEMSUBTRACT
enumerator KP_MEMMULTIPLY
enumerator KP_MEMDIVIDE
enumerator KP_PLUSMINUS
enumerator KP_CLEAR
enumerator KP_CLEARENTRY
enumerator KP_BINARY
enumerator KP_OCTAL
enumerator KP_DECIMAL
enumerator KP_HEXADECIMAL
enumerator LCTRL
enumerator LSHIFT
enumerator LALT

alt, option

enumerator LGUI

windows, command (apple), meta

enumerator RCTRL
enumerator RSHIFT
enumerator RALT

alt gr, option

enumerator RGUI

windows, command (apple), meta

enumerator MODE

I’m not sure if this is really not covered by any of the above, but since there’s a special SDL_KMOD_MODE for it I’m adding it here

enumerator SLEEP

Sleep

enumerator WAKE

Wake

enumerator CHANNEL_INCREMENT

Channel Increment

enumerator CHANNEL_DECREMENT

Channel Decrement

enumerator MEDIA_PLAY

Play

enumerator MEDIA_PAUSE

Pause

enumerator MEDIA_RECORD

Record

enumerator MEDIA_FAST_FORWARD

Fast Forward

enumerator MEDIA_REWIND

Rewind

enumerator MEDIA_NEXT_TRACK

Next Track

enumerator MEDIA_PREVIOUS_TRACK

Previous Track

enumerator MEDIA_STOP

Stop

enumerator MEDIA_EJECT

Eject

enumerator MEDIA_PLAY_PAUSE

Play / Pause

enumerator MEDIA_SELECT
enumerator AC_NEW

AC New

enumerator AC_OPEN

AC Open

enumerator AC_CLOSE

AC Close

enumerator AC_EXIT

AC Exit

enumerator AC_SAVE

AC Save

enumerator AC_PRINT

AC Print

enumerator AC_PROPERTIES

AC Properties

enumerator AC_SEARCH

AC Search

enumerator AC_HOME

AC Home

enumerator AC_BACK

AC Back

enumerator AC_FORWARD

AC Forward

enumerator AC_STOP

AC Stop

enumerator AC_REFRESH

AC Refresh

enumerator AC_BOOKMARKS

AC Bookmarks

enumerator SOFTLEFT

Usually situated below the display on phones and used as a multi-function feature key for selecting a software defined function shown on the bottom left of the display.

enumerator SOFTRIGHT

Usually situated below the display on phones and used as a multi-function feature key for selecting a software defined function shown on the bottom right of the display.

enumerator CALL

Used for accepting phone calls.

enumerator ENDCALL

Used for rejecting phone calls.

enumerator RESERVED

400-500 reserved for dynamic keycodes

enumerator COUNT

not a key, just marks the number of scancodes for array bounds

namespace Mouse

Enums

Values:

enumerator BUTTON_LEFT

Left mouse button.

enumerator BUTTON_MIDDLE

Middle mouse button.

enumerator BUTTON_RIGHT

Right mouse button.

enumerator BUTTON_X1

Extra mouse button 1.

enumerator BUTTON_X2

Extra mouse button 2.

namespace Key

Enums

Values:

enumerator UNKNOWN
enumerator A
enumerator B
enumerator C
enumerator D
enumerator E
enumerator F
enumerator G
enumerator H
enumerator I
enumerator J
enumerator K
enumerator L
enumerator M
enumerator N
enumerator O
enumerator P
enumerator Q
enumerator R
enumerator S
enumerator T
enumerator U
enumerator V
enumerator W
enumerator X
enumerator Y
enumerator Z
enumerator D1
enumerator D2
enumerator D3
enumerator D4
enumerator D5
enumerator D6
enumerator D7
enumerator D8
enumerator D9
enumerator D0
enumerator RETURN
enumerator ESCAPE
enumerator BACKSPACE
enumerator TAB
enumerator SPACE
enumerator MINUS
enumerator EQUALS
enumerator LEFTBRACKET
enumerator RIGHTBRACKET
enumerator BACKSLASH

Located at the lower left of the return key on ISO keyboards and at the right end of the QWERTY row on ANSI keyboards. Produces REVERSE SOLIDUS (backslash) and VERTICAL LINE in a US layout, REVERSE SOLIDUS and VERTICAL LINE in a UK Mac layout, NUMBER SIGN and TILDE in a UK Windows layout, DOLLAR SIGN and POUND SIGN in a Swiss German layout, NUMBER SIGN and APOSTROPHE in a German layout, GRAVE ACCENT and POUND SIGN in a French Mac layout, and ASTERISK and MICRO SIGN in a French Windows layout.

enumerator NONUSHASH

ISO USB keyboards actually use this code instead of 49 for the same key, but all OSes I’ve seen treat the two codes identically. So, as an implementor, unless your keyboard generates both of those codes and your OS treats them differently, you should generate BACKSLASH instead of this code. As a user, you should not rely on this code because SDL will never generate it with most (all?) keyboards.

enumerator SEMICOLON
enumerator APOSTROPHE
enumerator GRAVE

Located in the top left corner (on both ANSI and ISO keyboards). Produces GRAVE ACCENT and TILDE in a US Windows layout and in US and UK Mac layouts on ANSI keyboards, GRAVE ACCENT and NOT SIGN in a UK Windows layout, SECTION SIGN and PLUS-MINUS SIGN in US and UK Mac layouts on ISO keyboards, SECTION SIGN and DEGREE SIGN in a Swiss German layout (Mac: only on ISO keyboards), CIRCUMFLEX ACCENT and DEGREE SIGN in a German layout (Mac: only on ISO keyboards), SUPERSCRIPT TWO and TILDE in a French Windows layout, COMMERCIAL AT and NUMBER SIGN in a French Mac layout on ISO keyboards, and LESS-THAN SIGN and GREATER-THAN SIGN in a Swiss German, German, or French Mac layout on ANSI keyboards.

enumerator COMMA
enumerator PERIOD
enumerator SLASH
enumerator CAPSLOCK
enumerator F1
enumerator F2
enumerator F3
enumerator F4
enumerator F5
enumerator F6
enumerator F7
enumerator F8
enumerator F9
enumerator F10
enumerator F11
enumerator F12
enumerator PRINTSCREEN
enumerator SCROLLLOCK
enumerator PAUSE
enumerator INSERT

insert on PC, help on some Mac keyboards (but does send code 73, not 117)

enumerator HOME
enumerator PAGEUP
enumerator DELETE
enumerator END
enumerator PAGEDOWN
enumerator RIGHT
enumerator LEFT
enumerator DOWN
enumerator UP
enumerator NUMLOCKCLEAR

num lock on PC, clear on Mac keyboards

enumerator KP_DIVIDE
enumerator KP_MULTIPLY
enumerator KP_MINUS
enumerator KP_PLUS
enumerator KP_ENTER
enumerator KP_1
enumerator KP_2
enumerator KP_3
enumerator KP_4
enumerator KP_5
enumerator KP_6
enumerator KP_7
enumerator KP_8
enumerator KP_9
enumerator KP_0
enumerator KP_PERIOD
enumerator NONUSBACKSLASH

This is the additional key that ISO keyboards have over ANSI ones, located between left shift and Y. Produces GRAVE ACCENT and TILDE in a US or UK Mac layout, REVERSE SOLIDUS (backslash) and VERTICAL LINE in a US or UK Windows layout, and LESS-THAN SIGN and GREATER-THAN SIGN in a Swiss German, German, or French layout.

enumerator APPLICATION

windows contextual menu, compose

enumerator POWER

The USB document says this is a status flag, not a physical key - but some Mac keyboards do have a power key.

enumerator KP_EQUALS
enumerator F13
enumerator F14
enumerator F15
enumerator F16
enumerator F17
enumerator F18
enumerator F19
enumerator F20
enumerator F21
enumerator F22
enumerator F23
enumerator F24
enumerator EXECUTE
enumerator HELP

AL Integrated Help Center

enumerator MENU

Menu (show menu)

enumerator SELECT
enumerator STOP

AC Stop

enumerator AGAIN

AC Redo/Repeat

enumerator UNDO

AC Undo

enumerator CUT

AC Cut

enumerator COPY

AC Copy

enumerator PASTE

AC Paste

enumerator FIND

AC Find

enumerator MUTE
enumerator VOLUMEUP
enumerator VOLUMEDOWN
enumerator KP_COMMA
enumerator KP_EQUALSAS400
enumerator INTERNATIONAL1

used on Asian keyboards, see footnotes in USB doc

enumerator INTERNATIONAL2
enumerator INTERNATIONAL3

Yen

enumerator INTERNATIONAL4
enumerator INTERNATIONAL5
enumerator INTERNATIONAL6
enumerator INTERNATIONAL7
enumerator INTERNATIONAL8
enumerator INTERNATIONAL9
enumerator LANG1

Hangul/English toggle

enumerator LANG2

Hanja conversion

enumerator LANG3

Katakana

enumerator LANG4

Hiragana

enumerator LANG5

Zenkaku/Hankaku

enumerator LANG6

reserved

enumerator LANG7

reserved

enumerator LANG8

reserved

enumerator LANG9

reserved

enumerator ALTERASE

Erase-Eaze

enumerator SYSREQ
enumerator CANCEL

AC Cancel

enumerator CLEAR
enumerator PRIOR
enumerator RETURN2
enumerator SEPARATOR
enumerator OUT
enumerator OPER
enumerator CLEARAGAIN
enumerator CRSEL
enumerator EXSEL
enumerator KP_00
enumerator KP_000
enumerator THOUSANDSSEPARATOR
enumerator DECIMALSEPARATOR
enumerator CURRENCYUNIT
enumerator CURRENCYSUBUNIT
enumerator KP_LEFTPAREN
enumerator KP_RIGHTPAREN
enumerator KP_LEFTBRACE
enumerator KP_RIGHTBRACE
enumerator KP_TAB
enumerator KP_BACKSPACE
enumerator KP_A
enumerator KP_B
enumerator KP_C
enumerator KP_D
enumerator KP_E
enumerator KP_F
enumerator KP_XOR
enumerator KP_POWER
enumerator KP_PERCENT
enumerator KP_LESS
enumerator KP_GREATER
enumerator KP_AMPERSAND
enumerator KP_DBLAMPERSAND
enumerator KP_VERTICALBAR
enumerator KP_DBLVERTICALBAR
enumerator KP_COLON
enumerator KP_HASH
enumerator KP_SPACE
enumerator KP_AT
enumerator KP_EXCLAM
enumerator KP_MEMSTORE
enumerator KP_MEMRECALL
enumerator KP_MEMCLEAR
enumerator KP_MEMADD
enumerator KP_MEMSUBTRACT
enumerator KP_MEMMULTIPLY
enumerator KP_MEMDIVIDE
enumerator KP_PLUSMINUS
enumerator KP_CLEAR
enumerator KP_CLEARENTRY
enumerator KP_BINARY
enumerator KP_OCTAL
enumerator KP_DECIMAL
enumerator KP_HEXADECIMAL
enumerator LCTRL
enumerator LSHIFT
enumerator LALT

alt, option

enumerator LGUI

windows, command (apple), meta

enumerator RCTRL
enumerator RSHIFT
enumerator RALT

alt gr, option

enumerator RGUI

windows, command (apple), meta

enumerator MODE

I’m not sure if this is really not covered by any of the above, but since there’s a special SDL_KMOD_MODE for it I’m adding it here

enumerator SLEEP

Sleep

enumerator WAKE

Wake

enumerator CHANNEL_INCREMENT

Channel Increment

enumerator CHANNEL_DECREMENT

Channel Decrement

enumerator MEDIA_PLAY

Play

enumerator MEDIA_PAUSE

Pause

enumerator MEDIA_RECORD

Record

enumerator MEDIA_FAST_FORWARD

Fast Forward

enumerator MEDIA_REWIND

Rewind

enumerator MEDIA_NEXT_TRACK

Next Track

enumerator MEDIA_PREVIOUS_TRACK

Previous Track

enumerator MEDIA_STOP

Stop

enumerator MEDIA_EJECT

Eject

enumerator MEDIA_PLAY_PAUSE

Play / Pause

enumerator MEDIA_SELECT
enumerator AC_NEW

AC New

enumerator AC_OPEN

AC Open

enumerator AC_CLOSE

AC Close

enumerator AC_EXIT

AC Exit

enumerator AC_SAVE

AC Save

enumerator AC_PRINT

AC Print

enumerator AC_PROPERTIES

AC Properties

enumerator AC_SEARCH

AC Search

enumerator AC_HOME

AC Home

enumerator AC_BACK

AC Back

enumerator AC_FORWARD

AC Forward

enumerator AC_STOP

AC Stop

enumerator AC_REFRESH

AC Refresh

enumerator AC_BOOKMARKS

AC Bookmarks

enumerator SOFTLEFT

Usually situated below the display on phones and used as a multi-function feature key for selecting a software defined function shown on the bottom left of the display.

enumerator SOFTRIGHT

Usually situated below the display on phones and used as a multi-function feature key for selecting a software defined function shown on the bottom right of the display.

enumerator CALL

Used for accepting phone calls.

enumerator ENDCALL

Used for rejecting phone calls.

enumerator RESERVED

400-500 reserved for dynamic keycodes

enumerator COUNT

not a key, just marks the number of scancodes for array bounds

Events

group events

Defines

EVENT_CLASS_TYPE(type)

Macro to define the type of an event.

EVENT_CLASS_CATEGORY(category)

Macro to define the category of an event.

Enums

enum class EventType

Enum representing different types of events.

Values:

enumerator None
enumerator WindowClose
enumerator WindowResize
enumerator WindowFocus
enumerator WindowLostFocus
enumerator WindowMoved
enumerator FileDrop
enumerator AppTick
enumerator AppUpdate
enumerator AppRender
enumerator KeyPressed
enumerator KeyReleased
enumerator KeyTyped
enumerator MouseButtonPressed
enumerator MouseButtonReleased
enumerator MouseMoved
enumerator MouseScrolled
enum EventCategory

Enum representing different event categories.

Values:

enumerator None
enumerator EventCategoryApplication
enumerator EventCategoryInput
enumerator EventCategoryKeyboard
enumerator EventCategoryMouse
enumerator EventCategoryMouseButton

Functions

inline std::ostream &operator<<(std::ostream &os, const Event &e)

Overload of the << operator for Event.

Parameters:
  • os – The output stream.

  • e – The event.

Returns:

The output stream.

class WindowResizeEvent : public Coffee::Event
#include <ApplicationEvent.h>

Event for window resize.

Public Functions

inline unsigned int GetWidth() const

Get the width of the window.

Returns:

The width of the window.

inline unsigned int GetHeight() const

Get the height of the window.

Returns:

The height of the window.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

class WindowCloseEvent : public Coffee::Event
#include <ApplicationEvent.h>

Event for window close.

class FileDropEvent : public Coffee::Event
#include <ApplicationEvent.h>

Event for Dropping a file.

Public Functions

inline uint64_t GetTimestamp() const

Get the timestamp of the event.

Returns:

The timestamp of the event.

inline uint32_t GetWindowID() const

Get the window ID of the event.

Returns:

The window ID of the event.

inline float GetX() const

Get the x position of the event.

Returns:

The x position of the event.

inline float GetY() const

Get the y position of the event.

Returns:

The y position of the event.

inline const std::string &GetSource() const

Get the source of the event.

Returns:

The source of the event.

inline const std::string &GetFile() const

Get the file of the event.

Returns:

The file of the event.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

class AppTickEvent : public Coffee::Event
#include <ApplicationEvent.h>

Event for application tick.

class AppUpdateEvent : public Coffee::Event
#include <ApplicationEvent.h>

Event for application update.

class AppRenderEvent : public Coffee::Event
#include <ApplicationEvent.h>

Event for application render.

class Event
#include <Event.h>

Base class for all events.

Subclassed by Coffee::AppRenderEvent, Coffee::AppTickEvent, Coffee::AppUpdateEvent, Coffee::FileDropEvent, Coffee::KeyEvent, Coffee::MouseButtonEvent, Coffee::MouseMovedEvent, Coffee::MouseScrolledEvent, Coffee::WindowCloseEvent, Coffee::WindowResizeEvent

Public Functions

virtual EventType GetEventType() const = 0

Get the type of the event.

Returns:

The event type.

virtual const char *GetName() const = 0

Get the name of the event.

Returns:

The event name.

virtual int GetCategoryFlags() const = 0

Get the category flags of the event.

Returns:

The category flags.

inline virtual std::string ToString() const

Convert the event to a string representation.

Returns:

A string representation of the event.

inline bool IsInCategory(EventCategory category)

Check if the event is in a specific category.

Parameters:

category – The category to check.

Returns:

True if the event is in the category, false otherwise.

class EventDispatcher
#include <Event.h>

Event dispatcher to handle events.

Public Functions

template<typename T, typename F>
inline bool Dispatch(const F &func)

Dispatches the event if it matches the type.

Template Parameters:
  • T – The event type.

  • F – The function type.

Parameters:

func – The function to call if the event matches the type.

Returns:

True if the event was dispatched, false otherwise.

class KeyEvent : public Coffee::Event
#include <KeyEvent.h>

Base class for key events.

Subclassed by Coffee::KeyPressedEvent, Coffee::KeyReleasedEvent, Coffee::KeyTypedEvent

Public Functions

inline KeyCode GetKeyCode() const

Get the key code associated with the event.

Returns:

The key code.

class KeyPressedEvent : public Coffee::KeyEvent
#include <KeyEvent.h>

Event for key press.

Public Functions

inline KeyPressedEvent(const KeyCode keycode, bool isRepeat = false)

Constructor for KeyPressedEvent.

Parameters:
  • keycode – The key code associated with the event.

  • isRepeat – Whether the key press is a repeat.

inline bool IsRepeat() const

Check if the key press is a repeat.

Returns:

True if the key press is a repeat, false otherwise.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

class KeyReleasedEvent : public Coffee::KeyEvent
#include <KeyEvent.h>

Event for key release.

Public Functions

inline KeyReleasedEvent(const KeyCode keycode)

Constructor for KeyReleasedEvent.

Parameters:

keycode – The key code associated with the event.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

class KeyTypedEvent : public Coffee::KeyEvent
#include <KeyEvent.h>

Event for key typing.

Public Functions

inline KeyTypedEvent(const KeyCode keycode)

Constructor for KeyTypedEvent.

Parameters:

keycode – The key code associated with the event.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

class MouseMovedEvent : public Coffee::Event
#include <MouseEvent.h>

Event for mouse movement.

Public Functions

inline MouseMovedEvent(const float x, const float y)

Constructor for MouseMovedEvent.

Parameters:
  • x – The x-coordinate of the mouse.

  • y – The y-coordinate of the mouse.

inline float GetX() const

Get the x-coordinate of the mouse.

Returns:

The x-coordinate.

inline float GetY() const

Get the y-coordinate of the mouse.

Returns:

The y-coordinate.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

class MouseScrolledEvent : public Coffee::Event
#include <MouseEvent.h>

Event for mouse scrolling.

Public Functions

inline MouseScrolledEvent(const float xOffset, const float yOffset)

Constructor for MouseScrolledEvent.

Parameters:
  • xOffset – The scroll offset along the x-axis.

  • yOffset – The scroll offset along the y-axis.

inline float GetXOffset() const

Get the scroll offset along the x-axis.

Returns:

The x-axis scroll offset.

inline float GetYOffset() const

Get the scroll offset along the y-axis.

Returns:

The y-axis scroll offset.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

class MouseButtonEvent : public Coffee::Event
#include <MouseEvent.h>

Base class for mouse button events.

Subclassed by Coffee::MouseButtonPressedEvent, Coffee::MouseButtonReleasedEvent

Public Functions

inline MouseCode GetMouseButton() const

Get the mouse button associated with the event.

Returns:

The mouse button.

class MouseButtonPressedEvent : public Coffee::MouseButtonEvent
#include <MouseEvent.h>

Event for mouse button press.

Public Functions

inline MouseButtonPressedEvent(const MouseCode button)

Constructor for MouseButtonPressedEvent.

Parameters:

button – The mouse button associated with the event.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

class MouseButtonReleasedEvent : public Coffee::MouseButtonEvent
#include <MouseEvent.h>

Event for mouse button release.

Public Functions

inline MouseButtonReleasedEvent(const MouseCode button)

Constructor for MouseButtonReleasedEvent.

Parameters:

button – The mouse button associated with the event.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

IO

group io

IO components of the CoffeeEngine.

Functions

CEREAL_REGISTER_TYPE(Coffee::Resource)
namespace Coffee

Typedefs

template<typename T>
using Scope = std::unique_ptr<T>
template<typename T>
using Ref = std::shared_ptr<T>
using MouseCode = uint16_t

Enums

enum class ResourceType

Enumeration of different types of resources.

Values:

enumerator Unknown

Unknown resource type.

enumerator Texture

Texture resource type.

enumerator Model

Model resource type.

enumerator Shader

Shader resource type.

enum class ResourceFormat

Enumeration of resource formats.

Values:

enumerator Binary

Binary format.

enumerator JSON

JSON format.

enum class PrimitiveType

Enum class representing different types of primitive meshes.

Values:

enumerator Quad

A quad mesh.

enumerator Cube

A cube mesh.

enumerator Sphere

A sphere mesh.

enumerator Plane

A plane mesh.

enumerator Cylinder

A cylinder mesh.

enumerator Cone

A cone mesh.

enumerator Torus

A torus mesh.

enumerator Capsule

A capsule mesh.

enumerator None

No mesh.

Functions

template<typename T, typename ...Args>
Scope<T> CreateScope(Args&&... args)
template<typename T, typename ...Args>
Ref<T> CreateRef(Args&&... args)
ResourceFormat GetResourceSaveFormatFromType(ResourceType type)
glm::mat4 aiMatrix4x4ToGLMMat4(const aiMatrix4x4 &aiMat)
void OpenGLMessageCallback(unsigned source, unsigned type, unsigned id, unsigned severity, int length, const char *message, const void *userParam)
GLenum ImageFormatToOpenGLInternalFormat(ImageFormat format)
GLenum ImageFormatToOpenGLFormat(ImageFormat format)
static GLenum ShaderDataTypeToOpenGLBaseType(ShaderDataType type)

Variables

SDL_TimerCallback timerCallback = [](void* param, uint32_t interval, uint32_t elapsed) -> uint32_t{Timer* timer = static_cast<Timer*>(param);if(timer->GetCallback()){timer->GetCallback()();}if(timer->isOneShot()){timer->Stop();return 0;}if(timer->isAutoStart()){timer->Start(timer->getWaitTime());}return 0;}
static uint8_t s_SDLWindowCount = 0
static Ref<Project> s_ActiveProject
static const uint32_t s_MaxFramebufferSize = 8192
static bool s_viewportResized = false
static uint32_t s_viewportWidth = 0
static uint32_t s_viewportHeight = 0
static Ref<Material> missingMaterial
struct AABB
#include <Mesh.h>

Structure representing an axis-aligned bounding box (AABB).

Public Functions

inline AABB(const glm::vec3 &min, const glm::vec3 &max)

Constructs an AABB with specified minimum and maximum points.

Parameters:
  • min – The minimum point of the AABB.

  • max – The maximum point of the AABB.

Public Members

glm::vec3 min = glm::vec3(0.0f)

The minimum point of the AABB.

glm::vec3 max = glm::vec3(0.0f)

The maximum point of the AABB.

class Application
#include <Application.h>

The Application class is responsible for managing the main application loop, handling events, and managing layers and overlays.

Public Types

using EventCallbackFn = std::function<void(Event&)>

Type definition for event callback function.

Public Functions

Application()

Constructs the Application object.

virtual ~Application()

Destroys the Application object.

void Run()

Starts the main application loop.

void OnEvent(Event &e)

Handles incoming events.

Parameters:

e – The event to handle.

void PushLayer(Layer *layer)

Pushes a layer onto the layer stack.

Parameters:

layer – The layer to push.

void PushOverlay(Layer *layer)

Pushes an overlay onto the layer stack.

Parameters:

layer – The overlay to push.

inline Window &GetWindow()

Gets the main application window.

Returns:

A reference to the main application window.

inline void SetEventCallback(const EventCallbackFn &callback)

Sets the event callback function.

Parameters:

callback – The event callback function.

void Close()

Closes the application.

inline ImGuiLayer *GetImGuiLayer()

Gets the ImGui layer.

Returns:

A pointer to the ImGui layer.

Public Static Functions

static inline Application &Get()

Gets the singleton instance of the Application.

Returns:

A reference to the singleton instance.

class AppRenderEvent : public Coffee::Event
#include <ApplicationEvent.h>

Event for application render.

class AppTickEvent : public Coffee::Event
#include <ApplicationEvent.h>

Event for application tick.

class AppUpdateEvent : public Coffee::Event
#include <ApplicationEvent.h>

Event for application update.

struct BufferAttribute
#include <Buffer.h>

Structure representing a buffer attribute.

Public Functions

BufferAttribute() = default

Default constructor for BufferAttribute.

inline BufferAttribute(ShaderDataType type, const std::string &name, bool normalized = false)

Constructs a BufferAttribute with the specified parameters.

Parameters:
  • type – The type of the attribute.

  • name – The name of the attribute.

  • normalized – Whether the attribute is normalized.

inline uint32_t GetComponentCount() const

Returns the number of components in the attribute.

Returns:

The number of components.

Public Members

std::string Name

The name of the attribute.

ShaderDataType Type

The type of the attribute.

uint32_t Size

The size of the attribute.

size_t Offset

The offset of the attribute.

bool Normalized

Whether the attribute is normalized.

class BufferLayout
#include <Buffer.h>

Class representing a buffer layout.

Public Functions

inline BufferLayout()

Default constructor for BufferLayout.

inline BufferLayout(std::initializer_list<BufferAttribute> elements)

Constructs a BufferLayout with the specified attributes.

Parameters:

elements – The list of buffer attributes.

inline uint32_t GetStride() const

Returns the stride of the buffer layout.

Returns:

The stride in bytes.

inline const std::vector<BufferAttribute> &GetElements() const

Returns the list of buffer attributes.

Returns:

The list of buffer attributes.

inline std::vector<BufferAttribute>::iterator begin()

Returns an iterator to the beginning of the buffer attributes.

Returns:

An iterator to the beginning.

inline std::vector<BufferAttribute>::iterator end()

Returns an iterator to the end of the buffer attributes.

Returns:

An iterator to the end.

inline std::vector<BufferAttribute>::const_iterator begin() const

Returns a constant iterator to the beginning of the buffer attributes.

Returns:

A constant iterator to the beginning.

inline std::vector<BufferAttribute>::const_iterator end() const

Returns a constant iterator to the end of the buffer attributes.

Returns:

A constant iterator to the end.

class CacheManager
#include <CacheManager.h>

Manages cache-related operations for the CoffeeEngine.

Public Static Functions

static inline void SetCachePath(const std::filesystem::path &path)

Sets the cache path.

Parameters:

path – The path to set as the cache directory.

static inline const std::filesystem::path &GetCachePath()

Gets the current cache path.

Returns:

The current cache path.

static inline void CreateCacheDirectory()

Creates the cache directory.

static inline void ClearCache()

Clears the cache by removing all files in the cache directory.

static inline std::filesystem::path GetCachedFilePath(const std::string &filename)

Gets the file path for a cached file.

Parameters:

filename – The name of the file to be cached.

Returns:

The full path to the cached file.

class Camera
#include <Camera.h>

The Camera class is responsible for managing the camera’s projection matrix.

Subclassed by Coffee::EditorCamera, Coffee::SceneCamera

Public Functions

Camera() = default

Default constructor for the Camera class.

inline Camera(const glm::mat4 &projection)

Constructs a Camera object with the specified projection matrix.

Parameters:

projection – The projection matrix.

virtual ~Camera() = default

Virtual destructor for the Camera class.

inline const glm::mat4 &GetProjection() const

Gets the projection matrix of the camera.

Returns:

The projection matrix.

inline void SetViewportSize(float width, float height)

Sets the size of the viewport and updates the projection matrix.

Parameters:
  • width – The width of the viewport.

  • height – The height of the viewport.

struct CameraComponent
#include <Components.h>

Component representing a camera.

Public Functions

template<class Archive>
inline void serialize(Archive &archive)

Serializes the CameraComponent.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

Public Members

SceneCamera Camera

The scene camera.

class DebugRenderer
#include <DebugRenderer.h>

Class responsible for rendering debug lines.

Public Static Functions

static void Init()

Initializes the DebugRenderer.

static void Shutdown()

Shuts down the DebugRenderer.

static void DrawLine(const glm::vec3 &start, const glm::vec3 &end, glm::vec4 color = glm::vec4(1.0f), float lineWidth = 1.0f)

Draws a line between two points.

Parameters:
  • start – The starting point of the line.

  • end – The ending point of the line.

  • color – The color of the line. Default is white.

  • lineWidth – The width of the line. Default is 1.0f.

struct DebugVertex
#include <DebugRenderer.h>

Structure representing a vertex in a line.

Public Members

glm::vec3 Position

The position of the vertex.

glm::vec4 Color

The color of the vertex.

class EditorCamera : public Coffee::Camera
#include <EditorCamera.h>

The EditorCamera class is responsible for managing the editor camera’s view and projection matrices.

Public Types

enum class CameraState

Enum class representing the state of the camera.

Values:

enumerator NONE

No camera state.

enumerator ORBIT

Camera is in orbit mode.

enumerator FLY

Camera is in fly mode.

Public Functions

EditorCamera() = default

Default constructor for the EditorCamera class.

EditorCamera(float fov, ProjectionType projection = ProjectionType::PERSPECTIVE, float aspectRatio = 1.778, float nearClip = 0.1f, float farClip = 1000.0f)

Constructs an EditorCamera object with the specified parameters.

Parameters:
  • fov – The field of view for the perspective projection.

  • projection – The type of projection (perspective or orthographic).

  • aspectRatio – The aspect ratio of the viewport.

  • nearClip – The near clipping plane distance.

  • farClip – The far clipping plane distance.

void OnUpdate(float dt)

Updates the camera’s view matrix.

void OnEvent(Event &event)

Handles events for the camera.

Parameters:

event – The event to handle.

inline void SetFocusPoint(glm::vec3 focusPoint)

Sets the focal point of the camera.

Parameters:

focusPoint – The focal point.

inline const glm::mat4 GetViewMatrix() const

Gets the view matrix of the camera.

Returns:

The view matrix.

glm::vec3 GetUpDirection() const

Gets the up direction of the camera.

Returns:

The up direction.

glm::vec3 GetRightDirection() const

Gets the right direction of the camera.

Returns:

The right direction.

glm::vec3 GetForwardDirection() const

Gets the forward direction of the camera.

Returns:

The forward direction.

inline const glm::vec3 &GetPosition() const

Gets the position of the camera.

Returns:

The position.

glm::quat GetOrientation() const

Gets the orientation of the camera.

Returns:

The orientation.

inline const CameraState &GetState() const

Gets the current state of the camera.

Returns:

The current state of the camera.

class Entity
#include <Entity.h>

Class representing an entity in the scene.

Public Functions

Entity() = default

Default constructor for Entity.

Entity(entt::entity handle, Scene *scene)

Constructor for Entity with handle and scene.

Parameters:
  • handle – The entity handle.

  • scene – The scene the entity belongs to.

Entity(const Entity &other) = default

Copy constructor for Entity.

Parameters:

other – The other entity to copy from.

template<typename T, typename ...Args>
inline T &AddComponent(Args&&... args)

Add a component to the entity.

Template Parameters:
  • T – The component type.

  • Args – The component constructor arguments.

Parameters:

args – The component constructor arguments.

Returns:

Reference to the added component.

template<typename T>
inline T &GetComponent()

Get a component from the entity.

Template Parameters:

T – The component type.

Returns:

Reference to the component.

template<typename T>
inline bool HasComponent()

Check if the entity has a component.

Template Parameters:

T – The component type.

Returns:

True if the entity has the component, false otherwise.

template<typename T>
inline void RemoveComponent()

Remove a component from the entity.

Template Parameters:

T – The component type.

inline operator bool() const

Check if the entity is valid.

Returns:

True if the entity is valid, false otherwise.

inline operator entt::entity() const

Convert the entity to its handle.

Returns:

The entity handle.

inline operator uint32_t() const

Convert the entity to its handle as a uint32_t.

Returns:

The entity handle as a uint32_t.

inline bool operator==(const Entity &other) const

Equality operator.

Parameters:

other – The other entity to compare with.

Returns:

True if the entities are equal, false otherwise.

inline bool operator!=(const Entity &other) const

Inequality operator.

Parameters:

other – The other entity to compare with.

Returns:

True if the entities are not equal, false otherwise.

inline void SetParent(Entity entity)

Set the parent of the entity.

Parameters:

entity – The parent entity.

class Event
#include <Event.h>

Base class for all events.

Subclassed by Coffee::AppRenderEvent, Coffee::AppTickEvent, Coffee::AppUpdateEvent, Coffee::FileDropEvent, Coffee::KeyEvent, Coffee::MouseButtonEvent, Coffee::MouseMovedEvent, Coffee::MouseScrolledEvent, Coffee::WindowCloseEvent, Coffee::WindowResizeEvent

Public Functions

virtual EventType GetEventType() const = 0

Get the type of the event.

Returns:

The event type.

virtual const char *GetName() const = 0

Get the name of the event.

Returns:

The event name.

virtual int GetCategoryFlags() const = 0

Get the category flags of the event.

Returns:

The category flags.

inline virtual std::string ToString() const

Convert the event to a string representation.

Returns:

A string representation of the event.

inline bool IsInCategory(EventCategory category)

Check if the event is in a specific category.

Parameters:

category – The category to check.

Returns:

True if the event is in the category, false otherwise.

class EventDispatcher
#include <Event.h>

Event dispatcher to handle events.

Public Functions

template<typename T, typename F>
inline bool Dispatch(const F &func)

Dispatches the event if it matches the type.

Template Parameters:
  • T – The event type.

  • F – The function type.

Parameters:

func – The function to call if the event matches the type.

Returns:

True if the event was dispatched, false otherwise.

class FileDialog
#include <FileDialog.h>

Class for handling file dialogs.

Public Static Functions

static const std::filesystem::path OpenFile(const FileDialogArgs &args = {})

Opens a file dialog to select a file.

Parameters:

args – Arguments for the file dialog.

Returns:

The selected file path.

static const std::filesystem::path SaveFile(const FileDialogArgs &args = {})

Opens a file dialog to save a file.

Parameters:

args – Arguments for the file dialog.

Returns:

The selected file path.

struct FileDialogArgs
#include <FileDialog.h>

Arguments for the file dialog.

Public Members

std::vector<Filter> Filters = {}

List of filters.

std::string DefaultPath = ""

Default path for the file dialog.

std::string DefaultName = ""

Default name for the file dialog.

struct Filter
#include <FileDialog.h>

Filter for file types.

Public Members

const char *Name

Name of the filter.

const char *Extension

Extension of the filter.

class FileDropEvent : public Coffee::Event
#include <ApplicationEvent.h>

Event for Dropping a file.

Public Functions

inline uint64_t GetTimestamp() const

Get the timestamp of the event.

Returns:

The timestamp of the event.

inline uint32_t GetWindowID() const

Get the window ID of the event.

Returns:

The window ID of the event.

inline float GetX() const

Get the x position of the event.

Returns:

The x position of the event.

inline float GetY() const

Get the y position of the event.

Returns:

The y position of the event.

inline const std::string &GetSource() const

Get the source of the event.

Returns:

The source of the event.

inline const std::string &GetFile() const

Get the file of the event.

Returns:

The file of the event.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

class Framebuffer
#include <Framebuffer.h>

Class representing a framebuffer.

Public Functions

Framebuffer(uint32_t width, uint32_t height, std::initializer_list<ImageFormat> attachments)

Constructs a Framebuffer with the specified width, height, and attachments.

Parameters:
  • width – The width of the framebuffer.

  • height – The height of the framebuffer.

  • attachments – The list of image formats for the attachments.

~Framebuffer()

Destroys the Framebuffer.

void Invalidate()

Invalidates the framebuffer, forcing it to be recreated.

void Bind()

Binds the framebuffer.

void UnBind()

Unbinds the framebuffer.

void SetDrawBuffers(std::initializer_list<Ref<Texture>> colorAttachments)

Sets the draw buffers for the framebuffer.

Warning

This function is not finished, does not work, and is slow. Do not use it 🫡.

Parameters:

colorAttachments – The list of color attachments.

void SetDrawBuffers(std::initializer_list<uint32_t> colorAttachments)

Sets the draw buffers for the framebuffer.

Parameters:

colorAttachments – The list of color attachment indices.

void Resize(uint32_t width, uint32_t height)

Resizes the framebuffer.

Parameters:
  • width – The new width of the framebuffer.

  • height – The new height of the framebuffer.

inline const uint32_t GetWidth() const

Gets the width of the framebuffer.

Returns:

The width of the framebuffer.

inline const uint32_t GetHeight() const

Gets the height of the framebuffer.

Returns:

The height of the framebuffer.

void AttachColorTexture(Ref<Texture> &texture)

Attaches a color texture to the framebuffer.

Parameters:

texture – The color texture to attach.

void AttachDepthTexture(Ref<Texture> &texture)

Attaches a depth texture to the framebuffer.

Parameters:

texture – The depth texture to attach.

inline const Ref<Texture> &GetColorTexture(uint32_t index = 0) const

Gets the color texture at the specified index.

Parameters:

index – The index of the color texture.

Returns:

A reference to the color texture.

inline const Ref<Texture> &GetDepthTexture() const

Gets the depth texture.

Returns:

A reference to the depth texture.

Public Static Functions

static Ref<Framebuffer> Create(uint32_t width, uint32_t height, std::initializer_list<ImageFormat> attachments)

Creates a framebuffer with the specified width, height, and attachments.

Parameters:
  • width – The width of the framebuffer.

  • height – The height of the framebuffer.

  • attachments – The list of image formats for the attachments.

Returns:

A reference to the created framebuffer.

class GraphicsContext
#include <GraphicsContext.h>

Class representing the graphics context.

Public Functions

GraphicsContext(SDL_Window *windowHandle)

Constructs a GraphicsContext with the specified window handle.

Parameters:

windowHandle – The handle to the SDL window.

virtual ~GraphicsContext()

Virtual destructor for the GraphicsContext class.

void Init()

Initializes the graphics context.

void SwapBuffers()

Swaps the front and back buffers.

Public Static Functions

static Scope<GraphicsContext> Create(SDL_Window *window)

Creates a graphics context for the specified window.

Parameters:

window – The handle to the SDL window.

Returns:

A scope pointer to the created graphics context.

struct HierarchyComponent
#include <SceneTree.h>

Component for managing entity hierarchy.

Public Functions

HierarchyComponent(entt::entity parent)

Constructor with parent entity.

Parameters:

parent – The parent entity.

HierarchyComponent()

Default constructor.

template<class Archive>
inline void serialize(Archive &archive)

Serialize the component.

Template Parameters:

Archive – The archive type.

Parameters:

archive – The archive.

Public Static Functions

static void OnConstruct(entt::registry &registry, entt::entity entity)

Called when the component is constructed.

Parameters:
  • registry – The entity registry.

  • entity – The entity.

static void OnDestroy(entt::registry &registry, entt::entity entity)

Called when the component is destroyed.

Parameters:
  • registry – The entity registry.

  • entity – The entity.

static void OnUpdate(entt::registry &registry, entt::entity entity)

Called when the component is updated.

Parameters:
  • registry – The entity registry.

  • entity – The entity.

static void Reparent(entt::registry &registry, entt::entity entity, entt::entity parent)

Reparent the entity to a new parent.

Parameters:
  • registry – The entity registry.

  • entity – The entity to reparent.

  • parent – The new parent entity.

class ImGuiLayer : public Coffee::Layer
#include <ImGuiLayer.h>

The ImGuiLayer class is responsible for managing the ImGui layer in the application.

Public Functions

ImGuiLayer()

Constructs the ImGuiLayer object.

~ImGuiLayer()

Destroys the ImGuiLayer object.

virtual void OnAttach() override

Attaches the ImGui layer to the application.

virtual void OnDetach() override

Detaches the ImGui layer from the application.

virtual void OnEvent(Event &e) override

Handles events for the ImGui layer.

Parameters:

e – The event to handle.

void Begin()

Begins a new ImGui frame.

void End()

Ends the current ImGui frame.

virtual void OnImGuiRender() override

Renders ImGui elements.

inline void BlockEvents(bool block)

Blocks or unblocks events from being handled by the ImGui layer.

Parameters:

block – True to block events, false to unblock.

void SetTeaColorStyle()

Sets the Coffee color style for ImGui.

void SetGodotColorStyle()

Sets the Godot color style for ImGui.

void SetCoffeeColorStyle()

Sets the Coffee color style for ImGui.

class IndexBuffer
#include <Buffer.h>

Class representing an index buffer.

Public Functions

IndexBuffer(uint32_t *indices, uint32_t count)

Constructs an IndexBuffer with the specified indices and count.

Parameters:
  • indices – The index data.

  • count – The number of indices.

virtual ~IndexBuffer()

Destroys the IndexBuffer.

void Bind()

Binds the index buffer.

void Unbind()

Unbinds the index buffer.

inline uint32_t GetCount() const

Returns the number of indices in the buffer.

Returns:

The number of indices.

Public Static Functions

static Ref<IndexBuffer> Create(uint32_t *indices, uint32_t count)

Creates an index buffer with the specified indices and count.

Parameters:
  • indices – The index data.

  • count – The number of indices.

Returns:

A reference to the created index buffer.

class Input

Public Static Functions

static bool IsKeyPressed(const KeyCode key)

Checks if a specific key is currently being pressed.

Parameters:

key – The key code of the key to check.

Returns:

True if the key is currently being pressed, false otherwise.

static bool IsMouseButtonPressed(const MouseCode button)

Checks if a mouse button is currently pressed.

Parameters:

button – The mouse button to check.

Returns:

True if the mouse button is pressed, false otherwise.

static glm::vec2 GetMousePosition()

Retrieves the current position of the mouse.

Returns:

The current position of the mouse as a 2D vector.

static float GetMouseX()

Retrieves the current x-coordinate of the mouse cursor.

Returns:

The x-coordinate of the mouse cursor.

static float GetMouseY()

Retrieves the current y-coordinate of the mouse cursor.

Returns:

The y-coordinate of the mouse cursor.

class KeyEvent : public Coffee::Event
#include <KeyEvent.h>

Base class for key events.

Subclassed by Coffee::KeyPressedEvent, Coffee::KeyReleasedEvent, Coffee::KeyTypedEvent

Public Functions

inline KeyCode GetKeyCode() const

Get the key code associated with the event.

Returns:

The key code.

class KeyPressedEvent : public Coffee::KeyEvent
#include <KeyEvent.h>

Event for key press.

Public Functions

inline KeyPressedEvent(const KeyCode keycode, bool isRepeat = false)

Constructor for KeyPressedEvent.

Parameters:
  • keycode – The key code associated with the event.

  • isRepeat – Whether the key press is a repeat.

inline bool IsRepeat() const

Check if the key press is a repeat.

Returns:

True if the key press is a repeat, false otherwise.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

class KeyReleasedEvent : public Coffee::KeyEvent
#include <KeyEvent.h>

Event for key release.

Public Functions

inline KeyReleasedEvent(const KeyCode keycode)

Constructor for KeyReleasedEvent.

Parameters:

keycode – The key code associated with the event.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

class KeyTypedEvent : public Coffee::KeyEvent
#include <KeyEvent.h>

Event for key typing.

Public Functions

inline KeyTypedEvent(const KeyCode keycode)

Constructor for KeyTypedEvent.

Parameters:

keycode – The key code associated with the event.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

class Layer

Subclassed by Coffee::ImGuiLayer

Public Functions

inline Layer(const std::string &name = "Layer")

Constructor for the Layer class.

Parameters:

name – The name of the layer, default is “Layer”.

virtual ~Layer() = default

Virtual destructor for the Layer class.

inline virtual void OnAttach()

Called when the layer is attached.

inline virtual void OnDetach()

Called when the layer is detached.

inline virtual void OnUpdate(float dt)

Called every frame to update the layer.

Parameters:

dt – Delta time since the last frame.

inline virtual void OnImGuiRender()

Called to render ImGui elements.

inline virtual void OnEvent(Event &event)

Called when an event occurs.

Parameters:

event – The event that occurred.

inline const std::string &GetName() const

Gets the name of the layer.

Returns:

The name of the layer.

class LayerStack
#include <LayerStack.h>

Manages a stack of layers and overlays.

Public Functions

LayerStack() = default

Default constructor.

~LayerStack()

Destructor.

void PushLayer(Layer *layer)

Adds a layer to the stack.

Parameters:

layer – Pointer to the layer to be added.

void PushOverlay(Layer *overlay)

Adds an overlay to the stack.

Parameters:

overlay – Pointer to the overlay to be added.

void PopLayer(Layer *layer)

Removes a layer from the stack.

Parameters:

layer – Pointer to the layer to be removed.

void PopOverlay(Layer *overlay)

Removes an overlay from the stack.

Parameters:

overlay – Pointer to the overlay to be removed.

inline std::vector<Layer*>::iterator begin()

Returns an iterator to the beginning of the layer stack.

Returns:

Iterator to the beginning of the layer stack.

inline std::vector<Layer*>::iterator end()

Returns an iterator to the end of the layer stack.

Returns:

Iterator to the end of the layer stack.

inline std::vector<Layer*>::reverse_iterator rbegin()

Returns a reverse iterator to the beginning of the layer stack.

Returns:

Reverse iterator to the beginning of the layer stack.

inline std::vector<Layer*>::reverse_iterator rend()

Returns a reverse iterator to the end of the layer stack.

Returns:

Reverse iterator to the end of the layer stack.

inline std::vector<Layer*>::const_iterator begin() const

Returns a constant iterator to the beginning of the layer stack.

Returns:

Constant iterator to the beginning of the layer stack.

inline std::vector<Layer*>::const_iterator end() const

Returns a constant iterator to the end of the layer stack.

Returns:

Constant iterator to the end of the layer stack.

inline std::vector<Layer*>::const_reverse_iterator rbegin() const

Returns a constant reverse iterator to the beginning of the layer stack.

Returns:

Constant reverse iterator to the beginning of the layer stack.

inline std::vector<Layer*>::const_reverse_iterator rend() const

Returns a constant reverse iterator to the end of the layer stack.

Returns:

Constant reverse iterator to the end of the layer stack.

struct LightComponent
#include <Components.h>

Component representing a light.

Public Types

enum Type

Enum representing the type of light.

Values:

enumerator DirectionalLight

Directional light.

enumerator PointLight

Point light.

enumerator SpotLight

Spot light.

Public Functions

template<class Archive>
inline void serialize(Archive &archive)

Serializes the LightComponent.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

Public Members

glm::vec3 Color = {1.0f, 1.0f, 1.0f}

The color of the light.

glm::vec3 Direction = {0.0f, -1.0f, 0.0f}

The direction of the light.

glm::vec3 Position = {0.0f, 0.0f, 0.0f}

The position of the light.

float Range = 5.0f

The range of the light.

float Attenuation = 1.0f

The attenuation of the light.

float Intensity = 1.0f

The intensity of the light.

float Angle = 45.0f

The angle of the light.

int type = static_cast<int>(Type::DirectionalLight)

The type of the light.

class LinuxSystemInfo : public Coffee::SystemInfo

Public Functions

virtual uint32_t GetPhysicalProcessorCountImpl() const override

Gets the number of physical processors.

Returns:

The number of physical processors.

virtual uint64_t GetAvailableMemoryImpl() const override

Gets the amount of available memory in the system.

Returns:

The amount of available memory in the system.

virtual uint64_t GetUsedMemoryImpl() const override

Gets the amount of memory used in the system.

Returns:

The amount of memory used in the system.

virtual uint64_t GetProcessMemoryUsageImpl() const override

Gets the amount of memory used by the process.

Returns:

The amount of memory used by the process.

class Log
#include <Log.h>

The Log class is responsible for initializing and providing access to the core and client loggers.

Public Static Functions

static void Init()

Initializes the logging system.

static inline std::shared_ptr<spdlog::logger> &GetCoreLogger()

Gets the core logger.

Returns:

A shared pointer to the core logger.

static inline std::shared_ptr<spdlog::logger> &GetClientLogger()

Gets the client logger.

Returns:

A shared pointer to the client logger.

class Material
#include <Material.h>

Class representing a material.

Public Functions

Material()

Default constructor for the Material class.

Material(Ref<Shader> shader)

Constructs a Material with the specified shader.

Parameters:

shader – The shader to be used with the material.

Material(std::string &path)

Constructs a Material from a file path.

Note

This constructor is for future use when the material YAML exists.

Parameters:

path – The file path to the material definition.

Material(MaterialTextures &materialTextures)

Constructs a Material with the specified textures.

Parameters:

materialTextures – The textures to be used with the material.

~Material() = default

Default destructor for the Material class.

void Use()

Uses the material by binding its shader and textures.

inline Ref<Shader> GetShader()

Gets the shader associated with the material.

Returns:

A reference to the shader.

struct MaterialComponent
#include <Components.h>

Component representing a material.

Public Functions

template<class Archive>
inline void serialize(Archive &archive)

Serializes the MaterialComponent.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

Public Members

Ref<Material> material

The material reference.

struct MaterialProperties
#include <Material.h>

Structure representing the properties of a material.

Public Members

glm::vec4 color = glm::vec4(1.0f)

The color of the material.

float metallic = 0.0f

The metallic value of the material.

float roughness = 1.0f

The roughness value of the material.

float ao = 1.0f

The ambient occlusion value of the material.

glm::vec3 emissive = glm::vec3(0.0f)

The emissive value of the material.

struct MaterialRenderSettings
struct MaterialTextureFlags

Public Members

bool hasAlbedo = false

Whether the material has an albedo texture.

bool hasNormal = false

Whether the material has a normal map texture.

bool hasMetallic = false

Whether the material has a metallic texture.

bool hasRoughness = false

Whether the material has a roughness texture.

bool hasAO = false

Whether the material has an ambient occlusion texture.

bool hasEmissive = false

Whether the material has an emissive texture.

struct MaterialTextures
#include <Material.h>

Structure representing the textures used in a material.

Public Members

Ref<Texture> albedo

The albedo texture.

Ref<Texture> normal

The normal map texture.

Ref<Texture> metallic

The metallic texture.

Ref<Texture> roughness

The roughness texture.

Ref<Texture> ao

The ambient occlusion texture.

Ref<Texture> emissive

The emissive texture.

class Mesh
#include <Mesh.h>

Class representing a mesh.

Public Functions

Mesh(const std::vector<uint32_t> &indices, const std::vector<Vertex> &vertices)

Constructs a Mesh with the specified indices and vertices.

Parameters:
  • indices – The indices of the mesh.

  • vertices – The vertices of the mesh.

inline const Ref<VertexArray> &GetVertexArray() const

Gets the vertex array of the mesh.

Returns:

A reference to the vertex array.

inline const Ref<VertexBuffer> &GetVertexBuffer() const

Gets the vertex buffer of the mesh.

Returns:

A reference to the vertex buffer.

inline const Ref<IndexBuffer> &GetIndexBuffer() const

Gets the index buffer of the mesh.

Returns:

A reference to the index buffer.

inline void SetName(const std::string &name)

Sets the name of the mesh.

Parameters:

name – The name of the mesh.

inline const std::string &GetName() const

Gets the name of the mesh.

Returns:

The name of the mesh.

inline void SetMaterial(Ref<Material> &material)

Sets the material of the mesh.

Parameters:

material – A reference to the material.

inline void SetAABB(const AABB aabb)

Sets the axis-aligned bounding box (AABB) of the mesh.

Parameters:

aabb – The axis-aligned bounding box to set.

inline const AABB &GetAABB()

Gets the axis-aligned bounding box (AABB) of the mesh.

Returns:

A reference to the AABB.

inline AABB GetAABB(const glm::mat4 &transform)

Gets the transformed axis-aligned bounding box (AABB) of the mesh.

Parameters:

transform – The transformation matrix.

Returns:

The transformed AABB.

inline OBB GetOBB(const glm::mat4 &transform)

Gets the oriented bounding box (OBB) of the mesh.

Parameters:

transform – The transformation matrix.

Returns:

The OBB.

inline const Ref<Material> &GetMaterial() const

Gets the material of the mesh.

Returns:

A reference to the material.

inline const std::vector<Vertex> &GetVertices() const

Gets the vertices of the mesh.

Returns:

A reference to the vector of vertices.

inline const std::vector<uint32_t> &GetIndices() const

Gets the indices of the mesh.

Returns:

A reference to the vector of indices.

template<class Archive>
inline void save(Archive &archive)

Serializes the mesh to an archive.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

template<class Archive>
inline void load(Archive &archive)

Deserializes the mesh from an archive.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to deserialize from.

struct MeshComponent
#include <Components.h>

Component representing a mesh.

Public Functions

inline const Ref<Mesh> &GetMesh() const

Gets the mesh reference.

Returns:

The mesh reference.

template<class Archive>
inline void save(Archive &archive)

Serializes the MeshComponent.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

template<class Archive>
inline void load(Archive &archive)

Deserializes the MeshComponent.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to deserialize from.

Public Members

Ref<Mesh> mesh

The mesh reference.

bool drawAABB = false

Flag to draw the axis-aligned bounding box (AABB).

class Model : public Coffee::Resource
#include <Model.h>

Class representing a 3D model.

Public Functions

inline Model()

Default constructor for the Model class.

Model(const std::filesystem::path &path)

Constructs a Model from a file path.

Parameters:

filePath – The file path to the model.

inline const std::vector<Ref<Mesh>> &GetMeshes() const

Gets the meshes of the model.

Returns:

A reference to the vector of meshes.

inline void AddMesh(const Ref<Mesh> mesh)

Adds a mesh to the model.

Parameters:

mesh – A reference to the mesh to add.

inline std::string &GetName()

Gets the name of the model.

Returns:

A reference to the name of the model.

inline const Model *GetParent() const

Gets the parent model.

Returns:

A pointer to the parent model.

inline const std::vector<Ref<Model>> GetChildren() const

Gets the children models.

Returns:

A reference to the vector of children models.

inline const glm::mat4 GetTransform() const

Gets the transformation matrix of the model.

Returns:

The transformation matrix.

Public Static Functions

static Ref<Model> Load(const std::filesystem::path &path)

Loads a model from the specified file path.

Parameters:

path – The path to the model file.

class MouseButtonEvent : public Coffee::Event
#include <MouseEvent.h>

Base class for mouse button events.

Subclassed by Coffee::MouseButtonPressedEvent, Coffee::MouseButtonReleasedEvent

Public Functions

inline MouseCode GetMouseButton() const

Get the mouse button associated with the event.

Returns:

The mouse button.

class MouseButtonPressedEvent : public Coffee::MouseButtonEvent
#include <MouseEvent.h>

Event for mouse button press.

Public Functions

inline MouseButtonPressedEvent(const MouseCode button)

Constructor for MouseButtonPressedEvent.

Parameters:

button – The mouse button associated with the event.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

class MouseButtonReleasedEvent : public Coffee::MouseButtonEvent
#include <MouseEvent.h>

Event for mouse button release.

Public Functions

inline MouseButtonReleasedEvent(const MouseCode button)

Constructor for MouseButtonReleasedEvent.

Parameters:

button – The mouse button associated with the event.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

class MouseMovedEvent : public Coffee::Event
#include <MouseEvent.h>

Event for mouse movement.

Public Functions

inline MouseMovedEvent(const float x, const float y)

Constructor for MouseMovedEvent.

Parameters:
  • x – The x-coordinate of the mouse.

  • y – The y-coordinate of the mouse.

inline float GetX() const

Get the x-coordinate of the mouse.

Returns:

The x-coordinate.

inline float GetY() const

Get the y-coordinate of the mouse.

Returns:

The y-coordinate.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

class MouseScrolledEvent : public Coffee::Event
#include <MouseEvent.h>

Event for mouse scrolling.

Public Functions

inline MouseScrolledEvent(const float xOffset, const float yOffset)

Constructor for MouseScrolledEvent.

Parameters:
  • xOffset – The scroll offset along the x-axis.

  • yOffset – The scroll offset along the y-axis.

inline float GetXOffset() const

Get the scroll offset along the x-axis.

Returns:

The x-axis scroll offset.

inline float GetYOffset() const

Get the scroll offset along the y-axis.

Returns:

The y-axis scroll offset.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

struct OBB
#include <Mesh.h>

Structure representing an oriented bounding box (OBB).

Public Functions

inline OBB(const std::array<glm::vec3, 8> &corners)

Constructs an OBB with specified corners.

Parameters:

corners – The corners of the OBB.

inline OBB(const glm::mat4 &transform, const AABB &aabb)

Constructs an OBB from a transformation matrix and an AABB.

Parameters:
  • transform – The transformation matrix.

  • aabb – The axis-aligned bounding box.

Public Members

std::array<glm::vec3, 8> corners

The corners of the OBB.

class PrimitiveMesh
#include <PrimitiveMesh.h>

Class representing different types of primitive meshes.

Public Static Functions

static Ref<Mesh> CreateQuad()

Creates a quad mesh.

Returns:

A reference to the created quad mesh.

static Ref<Mesh> CreateCube(const glm::vec3 &size = {1.0f, 1.0f, 1.0f}, int subdivideW = 0, int subdidiveH = 0, int subdivideD = 0)

Creates a cube mesh.

Creates a cube mesh.

Parameters:
  • size – The size of the cube.

  • subdivideW – Number of subdivisions along the width.

  • subdivideH – Number of subdivisions along the height.

  • subdivideD – Number of subdivisions along the depth.

  • size – The size of the cube.

  • subdivideW – Subdivision parameter for width (currently not functional).

  • subdivideH – Subdivision parameter for height (currently not functional).

  • subdivideD – Subdivision parameter for depth (currently not functional).

Returns:

A reference to the created cube mesh.

Returns:

Ref<Mesh> A reference to the created cube mesh.

static Ref<Mesh> CreateSphere(float radius = 0.5f, float height = 1.0f, int radialSegments = 64, int rings = 32, bool isHemiSphere = false)

Creates a sphere mesh.

Parameters:
  • radius – The radius of the sphere.

  • height – The height of the sphere.

  • radialSegments – Number of radial segments.

  • rings – Number of rings.

  • isHemiSphere – Whether the sphere is a hemisphere.

Returns:

A reference to the created sphere mesh.

static Ref<Mesh> CreatePlane(const glm::vec2 &size = {1.0f, 1.0f}, const glm::vec3 &normal = {0.0f, 1.0f, 0.0f})

Creates a plane mesh.

Parameters:
  • size – The size of the plane.

  • normal – The normal vector of the plane.

Returns:

A reference to the created plane mesh.

static Ref<Mesh> CreateCylinder(float topRadius = 0.5f, float bottomRadius = 0.5f, float height = 1.0f, int radialSegments = 64, int rings = 1, bool capTop = true, bool capBottom = true)

Creates a cylinder mesh.

Parameters:
  • topRadius – The radius of the top of the cylinder.

  • bottomRadius – The radius of the bottom of the cylinder.

  • height – The height of the cylinder.

  • radialSegments – Number of radial segments.

  • rings – Number of rings.

  • capTop – Whether to cap the top of the cylinder.

  • capBottom – Whether to cap the bottom of the cylinder.

Returns:

A reference to the created cylinder mesh.

static Ref<Mesh> CreateCone(float radius = 0.5f, float height = 1.0f, int radialSegments = 64, int rings = 1, bool cap = true)

Creates a cone mesh.

Parameters:
  • radius – The radius of the base of the cone.

  • height – The height of the cone.

  • radialSegments – Number of radial segments.

  • rings – Number of rings.

  • cap – Whether to cap the base of the cone.

Returns:

A reference to the created cone mesh.

static Ref<Mesh> CreateTorus(float innerRadius = 0.5f, float outerRadius = 1.0f, int rings = 64, int ringSegments = 32)

Creates a torus mesh.

Parameters:
  • innerRadius – The inner radius of the torus.

  • outerRadius – The outer radius of the torus.

  • rings – Number of rings.

  • ringSegments – Number of ring segments.

Returns:

A reference to the created torus mesh.

static Ref<Mesh> CreateCapsule(float radius = 0.5f, float height = 2.0f, int radialSegments = 64, int rings = 8)

Creates a capsule mesh.

Parameters:
  • radius – The radius of the capsule.

  • height – The height of the capsule.

  • radialSegments – Number of radial segments.

  • rings – Number of rings.

Returns:

A reference to the created capsule mesh.

class Project
#include <Project.h>

The Project class is responsible for managing project data such as name, directory, and start scene path.

Public Functions

template<class Archive>
inline void serialize(Archive &archive)

Serializes the project data.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

Public Static Functions

static Ref<Project> New(const std::filesystem::path &path)

Creates a new project.

Returns:

A reference to the newly created project.

static Ref<Project> Load(const std::filesystem::path &path)

Loads a project from the specified path.

Parameters:

path – The path to the project file.

Returns:

A reference to the loaded project.

static void SaveActive()

Saves the active project to the specified path.

Parameters:

path – The path to save the project file.

static inline Ref<Project> GetActive()

Gets the active project.

Returns:

A reference to the active project.

static inline const std::filesystem::path &GetProjectDirectory()

Gets the directory of the active project.

Returns:

The path to the project directory.

static inline const std::string &GetProjectName()

Gets the name of the active project.

Returns:

The name of the project.

static inline std::filesystem::path GetCacheDirectory()

Retrieves the cache directory path of the active project.

This static method returns a constant reference to the cache directory path associated with the currently active project.

Returns:

const std::filesystem::path& Reference to the cache directory path.

class Renderer
#include <Renderer.h>

Class representing the 3D renderer.

Public Static Functions

static void Init()

Initializes the renderer.

static void Shutdown()

Shuts down the renderer.

static void BeginScene(EditorCamera &camera)

Begins a new scene with the specified editor camera.

Parameters:

camera – The editor camera.

static void BeginScene(Camera &camera, const glm::mat4 &transform)

Begins a new scene with the specified camera and transform.

Parameters:
  • camera – The camera.

  • transform – The transform matrix.

static void EndScene()

Ends the current scene.

static void BeginOverlay(EditorCamera &camera)

Begins an overlay with the specified editor camera.

Parameters:

camera – The editor camera.

static void EndOverlay()

Ends the current overlay.

static void Submit(const Ref<Shader> &shader, const Ref<VertexArray> &vertexArray, const glm::mat4 &transform = glm::mat4(1.0f), uint32_t entityID = 4294967295)

Submits a draw call with the specified shader, vertex array, and transform.

Parameters:
  • shader – The shader.

  • vertexArray – The vertex array.

  • transform – The transform matrix.

static void Submit(const Ref<Material> &material, const Ref<Mesh> &mesh, const glm::mat4 &transform = glm::mat4(1.0f), uint32_t entityID = 4294967295)

Submits a draw call with the specified material, mesh, and transform.

Parameters:
  • material – The material.

  • mesh – The mesh.

  • transform – The transform matrix.

static void Submit(const LightComponent &light)

Submits a light component.

Parameters:

light – The light component.

static void OnResize(uint32_t width, uint32_t height)

Resizes the renderer to the specified width and height.

Parameters:
  • width – The new width.

  • height – The new height.

static inline const Ref<Texture> &GetRenderTexture()

Gets the render texture.

Returns:

A reference to the render texture.

static inline const Ref<Texture> &GetEntityIDTexture()

Retrieves the texture associated with the entity ID.

This static method returns a reference to the texture that is used to identify entities within the renderer. The texture is stored as a static member of the class.

Returns:

A constant reference to the entity ID texture.

static inline const RendererData &GetData()

Gets the renderer data.

Returns:

A reference to the renderer data.

static inline const RendererStats &GetStats()

Gets the renderer statistics.

Returns:

A reference to the renderer statistics.

static inline RenderSettings &GetRenderSettings()

Gets the render settings.

Returns:

A reference to the render settings.

class RendererAPI
#include <RendererAPI.h>

Class representing the Renderer API.

Public Static Functions

static void Init()

Initializes the Renderer API.

static void SetClearColor(const glm::vec4 &color)

Sets the clear color for the renderer.

Parameters:

color – The clear color as a glm::vec4.

static void Clear()

Clears the current buffer.

static void SetDepthMask(bool enabled)

Enables or disables the depth mask.

Parameters:

enabled – True to enable the depth mask, false to disable it.

static void DrawIndexed(const Ref<VertexArray> &vertexArray)

Draws the indexed vertices from the specified vertex array.

Parameters:

vertexArray – The vertex array containing the vertices to draw.

static void DrawLines(const Ref<VertexArray> &vertexArray, uint32_t vertexCount, float lineWidth = 1.0f)

Draws lines from the specified vertex array.

Parameters:
  • vertexArray – The vertex array containing the vertices to draw.

  • vertexCount – The number of vertices to draw.

  • lineWidth – The width of the lines.

static Scope<RendererAPI> Create()

Creates a new Renderer API instance.

Returns:

A scope pointer to the created Renderer API instance.

struct RendererData
#include <Renderer.h>

Structure containing renderer data.

Public Members

CameraData cameraData

Camera data.

RenderData renderData

Render data.

Ref<UniformBuffer> CameraUniformBuffer

Uniform buffer for camera data.

Ref<UniformBuffer> RenderDataUniformBuffer

Uniform buffer for render data.

Ref<Texture> RenderTexture

Render texture.

struct CameraData
#include <Renderer.h>

Structure containing camera data.

Public Members

glm::mat4 projection

The projection matrix.

glm::mat4 view

The view matrix.

glm::vec3 position

The position of the camera.

struct RenderData
#include <Renderer.h>

Structure containing render data.

Public Members

LightComponent lights[32]

Array of light components.

int lightCount = 0

Number of lights.

struct RendererStats
#include <Renderer.h>

Structure containing renderer statistics.

Public Members

uint32_t DrawCalls = 0

Number of draw calls.

uint32_t VertexCount = 0

Number of vertices.

uint32_t IndexCount = 0

Number of indices.

struct RenderSettings
#include <Renderer.h>

Structure containing render settings.

Public Members

bool PostProcessing = true

Enable or disable post-processing.

bool SSAO = false

Enable or disable SSAO.

bool Bloom = false

Enable or disable bloom.

bool FXAA = false

Enable or disable FXAA.

float Exposure = 1.0f

Exposure value.

class Resource
#include <Resource.h>

Base class for different types of resources in the CoffeeEngine.

Subclassed by Coffee::Model, Coffee::Shader, Coffee::Texture

Public Functions

inline Resource(ResourceType type = ResourceType::Unknown)

Constructor that initializes the resource with a type.

Parameters:

type – The type of the resource.

virtual ~Resource() = default

Virtual destructor.

inline const std::string &GetName() const

Gets the name of the resource.

Returns:

The name of the resource.

inline const std::filesystem::path &GetPath()

Gets the file path of the resource.

Returns:

The file path of the resource.

inline ResourceType GetType() const

Gets the type of the resource.

Returns:

The type of the resource.

class ResourceImporter
#include <ResourceImporter.h>

Handles the import of resources such as textures.

Public Functions

Ref<Texture> ImportTexture(const std::filesystem::path &path, bool srgb, bool cache)

Imports a texture from a given file path.

Parameters:
  • path – The file path of the texture to import.

  • srgb – Whether the texture should be imported in sRGB format.

  • cache – Whether the texture should be cached.

Returns:

A reference to the imported texture.

class ResourceLoader
#include <ResourceLoader.h>

Loads resources such as textures and models for the CoffeeEngine.

Public Static Functions

static void LoadDirectory(const std::filesystem::path &directory)

Loads all resources from a directory.

Parameters:

directory – The directory to load resources from.

static void LoadFile(const std::filesystem::path &path)

Loads a single resource file.

Parameters:

path – The file path of the resource to load.

static Ref<Texture> LoadTexture(const std::filesystem::path &path, bool srgb = true, bool cache = true)

Loads a texture from a file.

Parameters:
  • path – The file path of the texture to load.

  • srgb – Whether the texture should be loaded in sRGB format.

  • cache – Whether the texture should be cached.

Returns:

A reference to the loaded texture.

static Ref<Model> LoadModel(const std::filesystem::path &path, bool cache = true)

Loads a model from a file.

Parameters:
  • path – The file path of the model to load.

  • cache – Whether the model should be cached.

Returns:

A reference to the loaded model.

class ResourceRegistry
#include <ResourceRegistry.h>

Manages the registration and retrieval of resources.

Public Static Functions

static inline void Add(const std::string &name, Ref<Resource> resource)

Adds a resource to the registry.

Parameters:
  • name – The name of the resource.

  • resource – A reference to the resource to add.

template<typename T>
static inline Ref<T> Get(const std::string &name)

Retrieves a resource from the registry.

Template Parameters:

T – The type of the resource.

Parameters:

name – The name of the resource.

Returns:

A reference to the resource, or nullptr if not found.

static inline bool Exists(const std::string &name)

Checks if a resource exists in the registry.

Parameters:

name – The name of the resource.

Returns:

True if the resource exists, false otherwise.

static inline void Clear()

Clears all resources from the registry.

static inline const std::unordered_map<std::string, Ref<Resource>> &GetResourceRegistry()

Gets the entire resource registry.

Returns:

A constant reference to the resource registry.

class ResourceSaver
#include <ResourceSaver.h>

Handles saving resources to disk and cache.

Public Static Functions

static void Save(const std::filesystem::path &path, const Ref<Resource> &resource)

Saves a resource to a specified path on disk.

Parameters:
  • path – The file path where the resource will be saved.

  • resource – A reference to the resource to save.

static void SaveToCache(const Ref<Resource> &resource)

Saves a resource to the project cache.

Parameters:

resource – A reference to the resource to save to cache.

class Scene
#include <Scene.h>

Class representing a scene.

Public Functions

Scene()

Constructor for Scene.

~Scene() = default

Default destructor.

Entity CreateEntity(const std::string &name = std::string())

Create an entity in the scene.

Parameters:

name – The name of the entity.

Returns:

The created entity.

void DestroyEntity(Entity entity)

Destroy an entity in the scene.

Parameters:

entity – The entity to destroy.

void OnInit()

Initialize the scene.

void OnUpdateEditor(EditorCamera &camera, float dt)

Update the scene in editor mode.

Parameters:
  • camera – The editor camera.

  • dt – The delta time.

void OnUpdateRuntime(float dt)

Update the scene in runtime mode.

Parameters:

dt – The delta time.

void OnEvent(Event &e)

Handle an event in the scene.

Parameters:

e – The event.

void OnExit()

Exit the scene.

Public Static Functions

static Ref<Scene> Load(const std::filesystem::path &path)

Load a scene from a file.

Parameters:

path – The path to the file.

Returns:

The loaded scene.

static void Save(const std::filesystem::path &path, Ref<Scene> scene)

Save a scene to a file.

Parameters:
  • path – The path to the file.

  • scene – The scene to save.

class SceneCamera : public Coffee::Camera
#include <SceneCamera.h>

Camera class for the scene.

Public Functions

SceneCamera()

Constructor for SceneCamera.

~SceneCamera() = default

Default destructor.

class SceneTree
#include <SceneTree.h>

Class for managing the scene tree.

Public Functions

SceneTree(Scene *scene)

Constructor for SceneTree.

Parameters:

scene – The scene context.

~SceneTree() = default

Default destructor.

void Update()

Update the scene tree.

void UpdateTransform(entt::entity entity)

Update the transform of an entity.

Parameters:

entity – The entity to update.

class Shader : public Coffee::Resource
#include <Shader.h>

Class representing a shader program.

Public Functions

Shader(const std::string &vertexPath, const std::string &fragmentPath)

Constructs a Shader with the specified vertex and fragment shader paths.

Parameters:
  • vertexPath – The file path to the vertex shader.

  • fragmentPath – The file path to the fragment shader.

virtual ~Shader()

Destructor for the Shader class.

void Bind()

Binds the shader program for use.

void Unbind()

Unbinds the shader program.

void setBool(const std::string &name, bool value) const

Sets a boolean uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • value – The boolean value to set.

void setInt(const std::string &name, int value) const

Sets an integer uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • value – The integer value to set.

void setFloat(const std::string &name, float value) const

Sets a float uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • value – The float value to set.

void setVec2(const std::string &name, const glm::vec2 &value) const

Sets a vec2 uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • value – The vec2 value to set.

void setVec3(const std::string &name, const glm::vec3 &value) const

Sets a vec3 uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • value – The vec3 value to set.

void setVec4(const std::string &name, const glm::vec4 &value) const

Sets a vec4 uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • value – The vec4 value to set.

void setMat2(const std::string &name, const glm::mat2 &mat) const

Sets a mat2 uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • mat – The mat2 value to set.

void setMat3(const std::string &name, const glm::mat3 &mat) const

Sets a mat3 uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • mat – The mat3 value to set.

void setMat4(const std::string &name, const glm::mat4 &mat) const

Sets a mat4 uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • mat – The mat4 value to set.

void checkCompileErrors(GLuint shader, std::string type)

Checks for compile errors in the shader.

Parameters:
  • shader – The shader ID.

  • type – The type of the shader.

Public Static Functions

static Ref<Shader> Create(const std::string &vertexPath, const std::string &fragmentPath)

Creates a shader from the specified vertex and fragment shader paths.

Parameters:
  • vertexPath – The file path to the vertex shader.

  • fragmentPath – The file path to the fragment shader.

Returns:

A reference to the created shader.

class Stopwatch
#include <Stopwatch.h>

A class to measure elapsed time.

The Stopwatch class provides functionality to start, stop, reset, and retrieve the elapsed time. It supports both regular and high-precision timing.

Public Functions

Stopwatch()

Constructs a new Stopwatch object.

void Start()

Starts the stopwatch.

If the stopwatch is already running, this method has no effect.

void Stop()

Stops the stopwatch.

If the stopwatch is not running, this method has no effect.

void Reset()

Resets the stopwatch.

This method stops the stopwatch and resets the elapsed time to zero.

float GetElapsedTime() const

Gets the elapsed time in seconds.

Returns:

The elapsed time in seconds.

double GetPreciseElapsedTime() const

Gets the precise elapsed time in seconds.

This method uses SDL_GetPerformanceCounter for higher precision.

Returns:

The precise elapsed time in seconds.

class SystemInfo

Subclassed by Coffee::LinuxSystemInfo, Coffee::WindowsSystemInfo

Public Functions

virtual uint32_t GetPhysicalProcessorCountImpl() const = 0

Gets the number of physical processors.

Returns:

The number of physical processors.

virtual uint64_t GetAvailableMemoryImpl() const = 0

Gets the amount of available memory in the system.

Returns:

The amount of available memory in the system.

virtual uint64_t GetUsedMemoryImpl() const = 0

Gets the amount of memory used in the system.

Returns:

The amount of memory used in the system.

virtual uint64_t GetProcessMemoryUsageImpl() const = 0

Gets the amount of memory used by the process.

Returns:

The amount of memory used by the process.

Public Static Functions

static uint32_t GetLogicalProcessorCount()

Gets the number of logical processors.

static uint32_t GetPhysicalProcessorCount()

Gets the number of physical processors.

static uint64_t GetTotalMemory()

Gets the total memory in the system.

static uint64_t GetAvailableMemory()

Gets the available memory in the system.

static uint64_t GetUsedMemory()

Gets the used memory in the system.

static uint64_t GetProcessMemoryUsage()

Gets the memory used by the process.

struct TagComponent
#include <Components.h>

Component representing a tag.

Public Functions

template<class Archive>
inline void serialize(Archive &archive)

Serializes the TagComponent.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

Public Members

std::string Tag

The tag string.

class Texture : public Coffee::Resource
#include <Texture.h>

Class representing a texture.

Public Functions

Texture(const TextureProperties &properties)

Constructs a Texture with the specified properties.

Parameters:

properties – The properties of the texture.

Texture(uint32_t width, uint32_t height, ImageFormat imageFormat)

Constructs a Texture with the specified width, height, and image format.

Parameters:
  • width – The width of the texture.

  • height – The height of the texture.

  • imageFormat – The format of the image.

Texture(const std::filesystem::path &path, bool srgb = true)

Constructs a Texture from a file path.

Parameters:
  • path – The file path to the texture.

  • srgb – Whether the texture is in sRGB format.

~Texture()

Destructor for the Texture class.

void Bind(uint32_t slot)

Binds the texture to the specified slot.

Parameters:

slot – The slot to bind the texture to.

void Resize(uint32_t width, uint32_t height)

Resizes the texture to the specified width and height.

Parameters:
  • width – The new width of the texture.

  • height – The new height of the texture.

inline std::pair<uint32_t, uint32_t> GetSize()

Gets the size of the texture.

Returns:

A pair containing the width and height of the texture.

inline uint32_t GetWidth()

Gets the width of the texture.

Returns:

The width of the texture.

inline uint32_t GetHeight()

Gets the height of the texture.

Returns:

The height of the texture.

inline uint32_t GetID()

Gets the ID of the texture.

Returns:

The ID of the texture.

inline ImageFormat GetImageFormat()

Gets the image format of the texture.

Returns:

The image format of the texture.

Public Static Functions

static Ref<Texture> Load(const std::filesystem::path &path, bool srgb = true)

Loads a texture from a file path.

Parameters:
  • path – The file path to the texture.

  • srgb – Whether the texture is in sRGB format.

Returns:

A reference to the loaded texture.

static Ref<Texture> Create(uint32_t width, uint32_t height, ImageFormat format)

Creates a texture with the specified width, height, and format.

Parameters:
  • width – The width of the texture.

  • height – The height of the texture.

  • format – The format of the texture.

Returns:

A reference to the created texture.

struct TextureProperties
#include <Texture.h>

Structure representing properties of a texture.

Public Members

ImageFormat Format

The format of the image.

uint32_t Height

The width and height of the texture.

bool GenerateMipmaps = true

Whether to generate mipmaps.

bool srgb = true

Whether the texture is in sRGB format.

class Timer
#include <Timer.h>

A class that represents a timer with various functionalities.

Public Functions

inline Timer()

Default constructor.

Timer(double waitTime, bool autoStart, bool oneShot, TimerCallback callback)

Parameterized constructor.

Parameters:
  • waitTime – The time to wait before the timer triggers.

  • autoStart – Whether the timer should start automatically.

  • oneShot – Whether the timer should trigger only once.

  • callback – The callback function to be called when the timer triggers.

void Start(double waitTime)

Starts the timer with a specified wait time.

Parameters:

waitTime – The time to wait before the timer triggers.

void Stop()

Stops the timer.

void setWaitTime(double waitTime)

Sets the wait time for the timer.

Parameters:

waitTime – The time to wait before the timer triggers.

inline double getWaitTime() const

Gets the wait time of the timer.

Returns:

The time to wait before the timer triggers.

inline void setOneShot(bool oneShot)

Sets whether the timer should trigger only once.

Parameters:

oneShot – Whether the timer should trigger only once.

inline bool isOneShot() const

Checks if the timer is set to trigger only once.

Returns:

True if the timer is set to trigger only once, false otherwise.

inline void setAutoStart(bool autoStart)

Sets whether the timer should start automatically.

Parameters:

autoStart – Whether the timer should start automatically.

inline bool isAutoStart() const

Checks if the timer is set to start automatically.

Returns:

True if the timer is set to start automatically, false otherwise.

void setPaused(bool paused)

Sets whether the timer is paused.

Parameters:

paused – Whether the timer is paused.

inline bool isPaused() const

Checks if the timer is paused.

Returns:

True if the timer is paused, false otherwise.

void isStopped()

Checks if the timer is stopped.

inline double GetTimeLeft() const

Gets the remaining time before the timer triggers.

Returns:

The remaining time before the timer triggers.

inline void SetCallback(TimerCallback callback)

Sets the callback function to be called when the timer triggers.

Parameters:

callback – The callback function.

inline TimerCallback GetCallback() const

Gets the callback function to be called when the timer triggers.

Returns:

The callback function.

struct TransformComponent
#include <Components.h>

Component representing a transform.

Public Functions

inline glm::mat4 GetLocalTransform() const

Gets the local transformation matrix.

Returns:

The local transformation matrix.

inline void SetLocalTransform(const glm::mat4 &transform)

Sets the local transformation matrix.

Parameters:

transform – The transformation matrix to set.

inline const glm::mat4 &GetWorldTransform() const

Gets the world transformation matrix.

Returns:

The world transformation matrix.

inline void SetWorldTransform(const glm::mat4 &transform)

Sets the world transformation matrix.

Parameters:

transform – The transformation matrix to set.

template<class Archive>
inline void serialize(Archive &archive)

Serializes the TransformComponent.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

Public Members

glm::vec3 Position = {0.0f, 0.0f, 0.0f}

The position vector.

glm::vec3 Rotation = {0.0f, 0.0f, 0.0f}

The rotation vector.

glm::vec3 Scale = {1.0f, 1.0f, 1.0f}

The scale vector.

class UniformBuffer
#include <UniformBuffer.h>

Class representing a uniform buffer.

Public Functions

UniformBuffer(uint32_t size, uint32_t binding)

Constructs a UniformBuffer with the specified size and binding.

Parameters:
  • size – The size of the buffer.

  • binding – The binding point of the buffer.

virtual ~UniformBuffer()

Destructor for the UniformBuffer class.

void SetData(const void *data, uint32_t size, uint32_t offset = 0)

Sets the data of the uniform buffer.

Parameters:
  • data – A pointer to the data to set.

  • size – The size of the data.

  • offset – The offset in the buffer to set the data.

Public Static Functions

static Ref<UniformBuffer> Create(uint32_t size, uint32_t binding)

Creates a uniform buffer with the specified size and binding.

Parameters:
  • size – The size of the buffer.

  • binding – The binding point of the buffer.

Returns:

A reference to the created uniform buffer.

struct Vertex
#include <Mesh.h>

Structure representing a vertex in a mesh.

Public Members

glm::vec3 Position = glm::vec3(0.0f)

The position of the vertex.

glm::vec2 TexCoords = glm::vec2(0.0f)

The texture coordinates of the vertex.

glm::vec3 Normals = glm::vec3(0.0f)

The normal vector of the vertex.

glm::vec3 Tangent = glm::vec3(0.0f)

The tangent vector of the vertex.

glm::vec3 Bitangent = glm::vec3(0.0f)

The bitangent vector of the vertex.

class VertexArray
#include <VertexArray.h>

Class representing a vertex array.

Public Functions

VertexArray()

Constructs a VertexArray.

virtual ~VertexArray()

Destructor for the VertexArray class.

void Bind()

Binds the vertex array.

void Unbind()

Unbinds the vertex array.

void AddVertexBuffer(const Ref<VertexBuffer> &vertexBuffer)

Adds a vertex buffer to the vertex array.

Parameters:

vertexBuffer – A reference to the vertex buffer to add.

void SetIndexBuffer(const Ref<IndexBuffer> &indexBuffer)

Sets the index buffer for the vertex array.

Parameters:

indexBuffer – A reference to the index buffer to set.

inline const std::vector<Ref<VertexBuffer>> &GetVertexBuffers() const

Gets the vertex buffers of the vertex array.

Returns:

A constant reference to the vector of vertex buffers.

inline const Ref<IndexBuffer> &GetIndexBuffer() const

Gets the index buffer of the vertex array.

Returns:

A constant reference to the index buffer.

Public Static Functions

static Ref<VertexArray> Create()

Creates a vertex array.

Returns:

A reference to the created vertex array.

class VertexBuffer
#include <Buffer.h>

Class representing a vertex buffer.

Public Functions

VertexBuffer(uint32_t size)

Constructs a VertexBuffer with the specified size.

Parameters:

size – The size of the buffer.

VertexBuffer(float *vertices, uint32_t size)

Constructs a VertexBuffer with the specified vertices and size.

Parameters:
  • vertices – The vertex data.

  • size – The size of the buffer.

virtual ~VertexBuffer()

Destroys the VertexBuffer.

void Bind()

Binds the vertex buffer.

void Unbind()

Unbinds the vertex buffer.

void SetData(void *data, uint32_t size)

Sets the data of the vertex buffer.

Parameters:
  • data – The data to set.

  • size – The size of the data.

inline const BufferLayout &GetLayout() const

Returns the layout of the vertex buffer.

Returns:

The buffer layout.

inline void SetLayout(const BufferLayout &layout)

Sets the layout of the vertex buffer.

Parameters:

layout – The buffer layout.

Public Static Functions

static Ref<VertexBuffer> Create(uint32_t size)

Creates a vertex buffer with the specified size.

Parameters:

size – The size of the buffer.

Returns:

A reference to the created vertex buffer.

static Ref<VertexBuffer> Create(float *vertices, uint32_t size)

Creates a vertex buffer with the specified vertices and size.

Parameters:
  • vertices – The vertex data.

  • size – The size of the buffer.

Returns:

A reference to the created vertex buffer.

class Window
#include <Window.h>

The Window class is responsible for managing the window and its properties.

Public Functions

Window(const WindowProps &props)

Constructs a Window object with the specified properties.

Parameters:

props – The properties of the window.

virtual ~Window()

Destroys the Window object.

void OnUpdate()

Updates the window.

inline unsigned int GetWidth() const

Gets the width of the window.

Returns:

The width of the window.

inline unsigned int GetHeight() const

Gets the height of the window.

Returns:

The height of the window.

void SetVSync(bool enabled)

Enables or disables VSync.

Parameters:

enabled – True to enable VSync, false to disable.

bool IsVSync() const

Checks if VSync is enabled.

Returns:

True if VSync is enabled, false otherwise.

void SetTitle(const std::string &title)

Sets the title of the window.

Parameters:

title – The new title of the window.

inline const std::string &GetTitle() const

Gets the title of the window.

Returns:

The title of the window.

void SetIcon(const std::string &path)

Sets the icon of the window.

Parameters:

path – The path to the icon file.

inline virtual void *GetNativeWindow() const

Gets the native window handle.

Returns:

A pointer to the native window.

Public Static Functions

static inline Scope<Window> Create(const WindowProps &props = WindowProps())

Creates a window with the specified properties.

Parameters:

props – The properties of the window.

Returns:

A scoped pointer to the created window.

class WindowCloseEvent : public Coffee::Event
#include <ApplicationEvent.h>

Event for window close.

struct WindowProps
#include <Window.h>

Structure to hold window properties such as title, width, and height.

Public Functions

inline WindowProps(const std::string &title = "Coffee Engine", uint32_t width = 1600, uint32_t height = 900)

Constructs WindowProps with default or specified values.

Parameters:
  • title – The title of the window.

  • width – The width of the window.

  • height – The height of the window.

Public Members

std::string Title

The title of the window.

uint32_t Width

The width of the window.

uint32_t Height

The height of the window.

class WindowResizeEvent : public Coffee::Event
#include <ApplicationEvent.h>

Event for window resize.

Public Functions

inline unsigned int GetWidth() const

Get the width of the window.

Returns:

The width of the window.

inline unsigned int GetHeight() const

Get the height of the window.

Returns:

The height of the window.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

class WindowsSystemInfo : public Coffee::SystemInfo

Public Functions

virtual uint32_t GetPhysicalProcessorCountImpl() const override

Gets the number of physical processors.

Returns:

The number of physical processors.

virtual uint64_t GetAvailableMemoryImpl() const override

Gets the amount of available memory in the system.

Returns:

The amount of available memory in the system.

virtual uint64_t GetUsedMemoryImpl() const override

Gets the amount of memory used in the system.

Returns:

The amount of memory used in the system.

virtual uint64_t GetProcessMemoryUsageImpl() const override

Gets the amount of memory used by the process.

Returns:

The amount of memory used by the process.

namespace Key

Enums

Values:

enumerator UNKNOWN
enumerator A
enumerator B
enumerator C
enumerator D
enumerator E
enumerator F
enumerator G
enumerator H
enumerator I
enumerator J
enumerator K
enumerator L
enumerator M
enumerator N
enumerator O
enumerator P
enumerator Q
enumerator R
enumerator S
enumerator T
enumerator U
enumerator V
enumerator W
enumerator X
enumerator Y
enumerator Z
enumerator D1
enumerator D2
enumerator D3
enumerator D4
enumerator D5
enumerator D6
enumerator D7
enumerator D8
enumerator D9
enumerator D0
enumerator RETURN
enumerator ESCAPE
enumerator BACKSPACE
enumerator TAB
enumerator SPACE
enumerator MINUS
enumerator EQUALS
enumerator LEFTBRACKET
enumerator RIGHTBRACKET
enumerator BACKSLASH

Located at the lower left of the return key on ISO keyboards and at the right end of the QWERTY row on ANSI keyboards. Produces REVERSE SOLIDUS (backslash) and VERTICAL LINE in a US layout, REVERSE SOLIDUS and VERTICAL LINE in a UK Mac layout, NUMBER SIGN and TILDE in a UK Windows layout, DOLLAR SIGN and POUND SIGN in a Swiss German layout, NUMBER SIGN and APOSTROPHE in a German layout, GRAVE ACCENT and POUND SIGN in a French Mac layout, and ASTERISK and MICRO SIGN in a French Windows layout.

enumerator NONUSHASH

ISO USB keyboards actually use this code instead of 49 for the same key, but all OSes I’ve seen treat the two codes identically. So, as an implementor, unless your keyboard generates both of those codes and your OS treats them differently, you should generate BACKSLASH instead of this code. As a user, you should not rely on this code because SDL will never generate it with most (all?) keyboards.

enumerator SEMICOLON
enumerator APOSTROPHE
enumerator GRAVE

Located in the top left corner (on both ANSI and ISO keyboards). Produces GRAVE ACCENT and TILDE in a US Windows layout and in US and UK Mac layouts on ANSI keyboards, GRAVE ACCENT and NOT SIGN in a UK Windows layout, SECTION SIGN and PLUS-MINUS SIGN in US and UK Mac layouts on ISO keyboards, SECTION SIGN and DEGREE SIGN in a Swiss German layout (Mac: only on ISO keyboards), CIRCUMFLEX ACCENT and DEGREE SIGN in a German layout (Mac: only on ISO keyboards), SUPERSCRIPT TWO and TILDE in a French Windows layout, COMMERCIAL AT and NUMBER SIGN in a French Mac layout on ISO keyboards, and LESS-THAN SIGN and GREATER-THAN SIGN in a Swiss German, German, or French Mac layout on ANSI keyboards.

enumerator COMMA
enumerator PERIOD
enumerator SLASH
enumerator CAPSLOCK
enumerator F1
enumerator F2
enumerator F3
enumerator F4
enumerator F5
enumerator F6
enumerator F7
enumerator F8
enumerator F9
enumerator F10
enumerator F11
enumerator F12
enumerator PRINTSCREEN
enumerator SCROLLLOCK
enumerator PAUSE
enumerator INSERT

insert on PC, help on some Mac keyboards (but does send code 73, not 117)

enumerator HOME
enumerator PAGEUP
enumerator DELETE
enumerator END
enumerator PAGEDOWN
enumerator RIGHT
enumerator LEFT
enumerator DOWN
enumerator UP
enumerator NUMLOCKCLEAR

num lock on PC, clear on Mac keyboards

enumerator KP_DIVIDE
enumerator KP_MULTIPLY
enumerator KP_MINUS
enumerator KP_PLUS
enumerator KP_ENTER
enumerator KP_1
enumerator KP_2
enumerator KP_3
enumerator KP_4
enumerator KP_5
enumerator KP_6
enumerator KP_7
enumerator KP_8
enumerator KP_9
enumerator KP_0
enumerator KP_PERIOD
enumerator NONUSBACKSLASH

This is the additional key that ISO keyboards have over ANSI ones, located between left shift and Y. Produces GRAVE ACCENT and TILDE in a US or UK Mac layout, REVERSE SOLIDUS (backslash) and VERTICAL LINE in a US or UK Windows layout, and LESS-THAN SIGN and GREATER-THAN SIGN in a Swiss German, German, or French layout.

enumerator APPLICATION

windows contextual menu, compose

enumerator POWER

The USB document says this is a status flag, not a physical key - but some Mac keyboards do have a power key.

enumerator KP_EQUALS
enumerator F13
enumerator F14
enumerator F15
enumerator F16
enumerator F17
enumerator F18
enumerator F19
enumerator F20
enumerator F21
enumerator F22
enumerator F23
enumerator F24
enumerator EXECUTE
enumerator HELP

AL Integrated Help Center

enumerator MENU

Menu (show menu)

enumerator SELECT
enumerator STOP

AC Stop

enumerator AGAIN

AC Redo/Repeat

enumerator UNDO

AC Undo

enumerator CUT

AC Cut

enumerator COPY

AC Copy

enumerator PASTE

AC Paste

enumerator FIND

AC Find

enumerator MUTE
enumerator VOLUMEUP
enumerator VOLUMEDOWN
enumerator KP_COMMA
enumerator KP_EQUALSAS400
enumerator INTERNATIONAL1

used on Asian keyboards, see footnotes in USB doc

enumerator INTERNATIONAL2
enumerator INTERNATIONAL3

Yen

enumerator INTERNATIONAL4
enumerator INTERNATIONAL5
enumerator INTERNATIONAL6
enumerator INTERNATIONAL7
enumerator INTERNATIONAL8
enumerator INTERNATIONAL9
enumerator LANG1

Hangul/English toggle

enumerator LANG2

Hanja conversion

enumerator LANG3

Katakana

enumerator LANG4

Hiragana

enumerator LANG5

Zenkaku/Hankaku

enumerator LANG6

reserved

enumerator LANG7

reserved

enumerator LANG8

reserved

enumerator LANG9

reserved

enumerator ALTERASE

Erase-Eaze

enumerator SYSREQ
enumerator CANCEL

AC Cancel

enumerator CLEAR
enumerator PRIOR
enumerator RETURN2
enumerator SEPARATOR
enumerator OUT
enumerator OPER
enumerator CLEARAGAIN
enumerator CRSEL
enumerator EXSEL
enumerator KP_00
enumerator KP_000
enumerator THOUSANDSSEPARATOR
enumerator DECIMALSEPARATOR
enumerator CURRENCYUNIT
enumerator CURRENCYSUBUNIT
enumerator KP_LEFTPAREN
enumerator KP_RIGHTPAREN
enumerator KP_LEFTBRACE
enumerator KP_RIGHTBRACE
enumerator KP_TAB
enumerator KP_BACKSPACE
enumerator KP_A
enumerator KP_B
enumerator KP_C
enumerator KP_D
enumerator KP_E
enumerator KP_F
enumerator KP_XOR
enumerator KP_POWER
enumerator KP_PERCENT
enumerator KP_LESS
enumerator KP_GREATER
enumerator KP_AMPERSAND
enumerator KP_DBLAMPERSAND
enumerator KP_VERTICALBAR
enumerator KP_DBLVERTICALBAR
enumerator KP_COLON
enumerator KP_HASH
enumerator KP_SPACE
enumerator KP_AT
enumerator KP_EXCLAM
enumerator KP_MEMSTORE
enumerator KP_MEMRECALL
enumerator KP_MEMCLEAR
enumerator KP_MEMADD
enumerator KP_MEMSUBTRACT
enumerator KP_MEMMULTIPLY
enumerator KP_MEMDIVIDE
enumerator KP_PLUSMINUS
enumerator KP_CLEAR
enumerator KP_CLEARENTRY
enumerator KP_BINARY
enumerator KP_OCTAL
enumerator KP_DECIMAL
enumerator KP_HEXADECIMAL
enumerator LCTRL
enumerator LSHIFT
enumerator LALT

alt, option

enumerator LGUI

windows, command (apple), meta

enumerator RCTRL
enumerator RSHIFT
enumerator RALT

alt gr, option

enumerator RGUI

windows, command (apple), meta

enumerator MODE

I’m not sure if this is really not covered by any of the above, but since there’s a special SDL_KMOD_MODE for it I’m adding it here

enumerator SLEEP

Sleep

enumerator WAKE

Wake

enumerator CHANNEL_INCREMENT

Channel Increment

enumerator CHANNEL_DECREMENT

Channel Decrement

enumerator MEDIA_PLAY

Play

enumerator MEDIA_PAUSE

Pause

enumerator MEDIA_RECORD

Record

enumerator MEDIA_FAST_FORWARD

Fast Forward

enumerator MEDIA_REWIND

Rewind

enumerator MEDIA_NEXT_TRACK

Next Track

enumerator MEDIA_PREVIOUS_TRACK

Previous Track

enumerator MEDIA_STOP

Stop

enumerator MEDIA_EJECT

Eject

enumerator MEDIA_PLAY_PAUSE

Play / Pause

enumerator MEDIA_SELECT
enumerator AC_NEW

AC New

enumerator AC_OPEN

AC Open

enumerator AC_CLOSE

AC Close

enumerator AC_EXIT

AC Exit

enumerator AC_SAVE

AC Save

enumerator AC_PRINT

AC Print

enumerator AC_PROPERTIES

AC Properties

enumerator AC_SEARCH

AC Search

enumerator AC_HOME

AC Home

enumerator AC_BACK

AC Back

enumerator AC_FORWARD

AC Forward

enumerator AC_STOP

AC Stop

enumerator AC_REFRESH

AC Refresh

enumerator AC_BOOKMARKS

AC Bookmarks

enumerator SOFTLEFT

Usually situated below the display on phones and used as a multi-function feature key for selecting a software defined function shown on the bottom left of the display.

enumerator SOFTRIGHT

Usually situated below the display on phones and used as a multi-function feature key for selecting a software defined function shown on the bottom right of the display.

enumerator CALL

Used for accepting phone calls.

enumerator ENDCALL

Used for rejecting phone calls.

enumerator RESERVED

400-500 reserved for dynamic keycodes

enumerator COUNT

not a key, just marks the number of scancodes for array bounds

namespace Mouse

Enums

Values:

enumerator BUTTON_LEFT

Left mouse button.

enumerator BUTTON_MIDDLE

Middle mouse button.

enumerator BUTTON_RIGHT

Right mouse button.

enumerator BUTTON_X1

Extra mouse button 1.

enumerator BUTTON_X2

Extra mouse button 2.

namespace cereal

Functions

template<class Archive>
void save(Archive &archive, const std::filesystem::path &path)

Serializes a std::filesystem::path object.

Template Parameters:

Archive – The type of the archive.

Parameters:
  • archive – The archive to save the path to.

  • path – The filesystem path to be serialized.

template<class Archive>
void load(Archive &archive, std::filesystem::path &path)

Deserializes a std::filesystem::path object.

Template Parameters:

Archive – The type of the archive.

Parameters:
  • archive – The archive to load the path from.

  • path – The filesystem path to be deserialized.

template<class Archive>
void serialize(Archive &archive, glm::vec2 &vec)

Serializes a glm::vec2 object.

Template Parameters:

Archive – The type of the archive.

Parameters:
  • archive – The archive to serialize to.

  • vec – The glm::vec2 object to serialize.

template<class Archive>
void serialize(Archive &archive, glm::vec3 &vec)

Serializes a glm::vec3 object.

Template Parameters:

Archive – The type of the archive.

Parameters:
  • archive – The archive to serialize to.

  • vec – The glm::vec3 object to serialize.

template<class Archive>
void serialize(Archive &archive, glm::vec4 &vec)

Serializes a glm::vec4 object.

Template Parameters:

Archive – The type of the archive.

Parameters:
  • archive – The archive to serialize to.

  • vec – The glm::vec4 object to serialize.

template<class Archive>
void serialize(Archive &archive, glm::quat &quat)

Serializes a glm::quat object.

Template Parameters:

Archive – The type of the archive.

Parameters:
  • archive – The archive to serialize to.

  • quat – The glm::quat object to serialize.

ImGui

group imgui

ImGui components of the CoffeeEngine.

class ImGuiLayer : public Coffee::Layer
#include <ImGuiLayer.h>

The ImGuiLayer class is responsible for managing the ImGui layer in the application.

Public Functions

ImGuiLayer()

Constructs the ImGuiLayer object.

~ImGuiLayer()

Destroys the ImGuiLayer object.

virtual void OnAttach() override

Attaches the ImGui layer to the application.

virtual void OnDetach() override

Detaches the ImGui layer from the application.

virtual void OnEvent(Event &e) override

Handles events for the ImGui layer.

Parameters:

e – The event to handle.

void Begin()

Begins a new ImGui frame.

void End()

Ends the current ImGui frame.

virtual void OnImGuiRender() override

Renders ImGui elements.

inline void BlockEvents(bool block)

Blocks or unblocks events from being handled by the ImGui layer.

Parameters:

block – True to block events, false to unblock.

void SetTeaColorStyle()

Sets the Coffee color style for ImGui.

void SetGodotColorStyle()

Sets the Godot color style for ImGui.

void SetCoffeeColorStyle()

Sets the Coffee color style for ImGui.

Project

group project

Project management components of the CoffeeEngine.

class Project
#include <Project.h>

The Project class is responsible for managing project data such as name, directory, and start scene path.

Public Functions

template<class Archive>
inline void serialize(Archive &archive)

Serializes the project data.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

Public Static Functions

static Ref<Project> New(const std::filesystem::path &path)

Creates a new project.

Returns:

A reference to the newly created project.

static Ref<Project> Load(const std::filesystem::path &path)

Loads a project from the specified path.

Parameters:

path – The path to the project file.

Returns:

A reference to the loaded project.

static void SaveActive()

Saves the active project to the specified path.

Parameters:

path – The path to save the project file.

static inline Ref<Project> GetActive()

Gets the active project.

Returns:

A reference to the active project.

static inline const std::filesystem::path &GetProjectDirectory()

Gets the directory of the active project.

Returns:

The path to the project directory.

static inline const std::string &GetProjectName()

Gets the name of the active project.

Returns:

The name of the project.

static inline std::filesystem::path GetCacheDirectory()

Retrieves the cache directory path of the active project.

This static method returns a constant reference to the cache directory path associated with the currently active project.

Returns:

const std::filesystem::path& Reference to the cache directory path.

Renderer

group renderer

Renderer components of the CoffeeEngine.

Enums

enum class ShaderDataType

Enum class representing different shader data types.

Values:

enumerator None
enumerator Bool
enumerator Int
enumerator Float
enumerator Vec2
enumerator Vec3
enumerator Vec4
enumerator Mat2
enumerator Mat3
enumerator Mat4
enum class ImageFormat

Enum class representing different image formats.

Values:

enumerator R8

8-bit Red channel.

enumerator RG8

8-bit Red and Green channels.

enumerator RGB8

8-bit Red, Green, and Blue channels.

enumerator SRGB8

8-bit sRGB Red, Green, and Blue channels.

enumerator RGBA8

8-bit Red, Green, Blue, and Alpha channels.

enumerator SRGBA8

8-bit sRGB Red, Green, Blue, and Alpha channels.

enumerator RGBA32F

32-bit floating point Red, Green, Blue, and Alpha channels.

enumerator DEPTH24STENCIL8

24-bit Depth and 8-bit Stencil channels.

Functions

static uint32_t ShaderDataTypeSize(ShaderDataType type)

Returns the size of the specified ShaderDataType.

Parameters:

type – The ShaderDataType.

Returns:

The size of the ShaderDataType in bytes.

struct BufferAttribute
#include <Buffer.h>

Structure representing a buffer attribute.

Public Functions

BufferAttribute() = default

Default constructor for BufferAttribute.

inline BufferAttribute(ShaderDataType type, const std::string &name, bool normalized = false)

Constructs a BufferAttribute with the specified parameters.

Parameters:
  • type – The type of the attribute.

  • name – The name of the attribute.

  • normalized – Whether the attribute is normalized.

inline uint32_t GetComponentCount() const

Returns the number of components in the attribute.

Returns:

The number of components.

Public Members

std::string Name

The name of the attribute.

ShaderDataType Type

The type of the attribute.

uint32_t Size

The size of the attribute.

size_t Offset

The offset of the attribute.

bool Normalized

Whether the attribute is normalized.

class BufferLayout
#include <Buffer.h>

Class representing a buffer layout.

Public Functions

inline BufferLayout()

Default constructor for BufferLayout.

inline BufferLayout(std::initializer_list<BufferAttribute> elements)

Constructs a BufferLayout with the specified attributes.

Parameters:

elements – The list of buffer attributes.

inline uint32_t GetStride() const

Returns the stride of the buffer layout.

Returns:

The stride in bytes.

inline const std::vector<BufferAttribute> &GetElements() const

Returns the list of buffer attributes.

Returns:

The list of buffer attributes.

inline std::vector<BufferAttribute>::iterator begin()

Returns an iterator to the beginning of the buffer attributes.

Returns:

An iterator to the beginning.

inline std::vector<BufferAttribute>::iterator end()

Returns an iterator to the end of the buffer attributes.

Returns:

An iterator to the end.

inline std::vector<BufferAttribute>::const_iterator begin() const

Returns a constant iterator to the beginning of the buffer attributes.

Returns:

A constant iterator to the beginning.

inline std::vector<BufferAttribute>::const_iterator end() const

Returns a constant iterator to the end of the buffer attributes.

Returns:

A constant iterator to the end.

class VertexBuffer
#include <Buffer.h>

Class representing a vertex buffer.

Public Functions

VertexBuffer(uint32_t size)

Constructs a VertexBuffer with the specified size.

Parameters:

size – The size of the buffer.

VertexBuffer(float *vertices, uint32_t size)

Constructs a VertexBuffer with the specified vertices and size.

Parameters:
  • vertices – The vertex data.

  • size – The size of the buffer.

virtual ~VertexBuffer()

Destroys the VertexBuffer.

void Bind()

Binds the vertex buffer.

void Unbind()

Unbinds the vertex buffer.

void SetData(void *data, uint32_t size)

Sets the data of the vertex buffer.

Parameters:
  • data – The data to set.

  • size – The size of the data.

inline const BufferLayout &GetLayout() const

Returns the layout of the vertex buffer.

Returns:

The buffer layout.

inline void SetLayout(const BufferLayout &layout)

Sets the layout of the vertex buffer.

Parameters:

layout – The buffer layout.

Public Static Functions

static Ref<VertexBuffer> Create(uint32_t size)

Creates a vertex buffer with the specified size.

Parameters:

size – The size of the buffer.

Returns:

A reference to the created vertex buffer.

static Ref<VertexBuffer> Create(float *vertices, uint32_t size)

Creates a vertex buffer with the specified vertices and size.

Parameters:
  • vertices – The vertex data.

  • size – The size of the buffer.

Returns:

A reference to the created vertex buffer.

class IndexBuffer
#include <Buffer.h>

Class representing an index buffer.

Public Functions

IndexBuffer(uint32_t *indices, uint32_t count)

Constructs an IndexBuffer with the specified indices and count.

Parameters:
  • indices – The index data.

  • count – The number of indices.

virtual ~IndexBuffer()

Destroys the IndexBuffer.

void Bind()

Binds the index buffer.

void Unbind()

Unbinds the index buffer.

inline uint32_t GetCount() const

Returns the number of indices in the buffer.

Returns:

The number of indices.

Public Static Functions

static Ref<IndexBuffer> Create(uint32_t *indices, uint32_t count)

Creates an index buffer with the specified indices and count.

Parameters:
  • indices – The index data.

  • count – The number of indices.

Returns:

A reference to the created index buffer.

class Camera
#include <Camera.h>

The Camera class is responsible for managing the camera’s projection matrix.

Subclassed by Coffee::EditorCamera, Coffee::SceneCamera

Public Functions

Camera() = default

Default constructor for the Camera class.

inline Camera(const glm::mat4 &projection)

Constructs a Camera object with the specified projection matrix.

Parameters:

projection – The projection matrix.

virtual ~Camera() = default

Virtual destructor for the Camera class.

inline const glm::mat4 &GetProjection() const

Gets the projection matrix of the camera.

Returns:

The projection matrix.

inline void SetViewportSize(float width, float height)

Sets the size of the viewport and updates the projection matrix.

Parameters:
  • width – The width of the viewport.

  • height – The height of the viewport.

struct DebugVertex
#include <DebugRenderer.h>

Structure representing a vertex in a line.

Public Members

glm::vec3 Position

The position of the vertex.

glm::vec4 Color

The color of the vertex.

class DebugRenderer
#include <DebugRenderer.h>

Class responsible for rendering debug lines.

Public Static Functions

static void Init()

Initializes the DebugRenderer.

static void Shutdown()

Shuts down the DebugRenderer.

static void DrawLine(const glm::vec3 &start, const glm::vec3 &end, glm::vec4 color = glm::vec4(1.0f), float lineWidth = 1.0f)

Draws a line between two points.

Parameters:
  • start – The starting point of the line.

  • end – The ending point of the line.

  • color – The color of the line. Default is white.

  • lineWidth – The width of the line. Default is 1.0f.

class EditorCamera : public Coffee::Camera
#include <EditorCamera.h>

The EditorCamera class is responsible for managing the editor camera’s view and projection matrices.

Public Types

enum class CameraState

Enum class representing the state of the camera.

Values:

enumerator NONE

No camera state.

enumerator ORBIT

Camera is in orbit mode.

enumerator FLY

Camera is in fly mode.

Public Functions

EditorCamera() = default

Default constructor for the EditorCamera class.

EditorCamera(float fov, ProjectionType projection = ProjectionType::PERSPECTIVE, float aspectRatio = 1.778, float nearClip = 0.1f, float farClip = 1000.0f)

Constructs an EditorCamera object with the specified parameters.

Parameters:
  • fov – The field of view for the perspective projection.

  • projection – The type of projection (perspective or orthographic).

  • aspectRatio – The aspect ratio of the viewport.

  • nearClip – The near clipping plane distance.

  • farClip – The far clipping plane distance.

void OnUpdate(float dt)

Updates the camera’s view matrix.

void OnEvent(Event &event)

Handles events for the camera.

Parameters:

event – The event to handle.

inline void SetFocusPoint(glm::vec3 focusPoint)

Sets the focal point of the camera.

Parameters:

focusPoint – The focal point.

inline const glm::mat4 GetViewMatrix() const

Gets the view matrix of the camera.

Returns:

The view matrix.

glm::vec3 GetUpDirection() const

Gets the up direction of the camera.

Returns:

The up direction.

glm::vec3 GetRightDirection() const

Gets the right direction of the camera.

Returns:

The right direction.

glm::vec3 GetForwardDirection() const

Gets the forward direction of the camera.

Returns:

The forward direction.

inline const glm::vec3 &GetPosition() const

Gets the position of the camera.

Returns:

The position.

glm::quat GetOrientation() const

Gets the orientation of the camera.

Returns:

The orientation.

inline const CameraState &GetState() const

Gets the current state of the camera.

Returns:

The current state of the camera.

class Framebuffer
#include <Framebuffer.h>

Class representing a framebuffer.

Public Functions

Framebuffer(uint32_t width, uint32_t height, std::initializer_list<ImageFormat> attachments)

Constructs a Framebuffer with the specified width, height, and attachments.

Parameters:
  • width – The width of the framebuffer.

  • height – The height of the framebuffer.

  • attachments – The list of image formats for the attachments.

~Framebuffer()

Destroys the Framebuffer.

void Invalidate()

Invalidates the framebuffer, forcing it to be recreated.

void Bind()

Binds the framebuffer.

void UnBind()

Unbinds the framebuffer.

void SetDrawBuffers(std::initializer_list<Ref<Texture>> colorAttachments)

Sets the draw buffers for the framebuffer.

Warning

This function is not finished, does not work, and is slow. Do not use it 🫡.

Parameters:

colorAttachments – The list of color attachments.

void SetDrawBuffers(std::initializer_list<uint32_t> colorAttachments)

Sets the draw buffers for the framebuffer.

Parameters:

colorAttachments – The list of color attachment indices.

void Resize(uint32_t width, uint32_t height)

Resizes the framebuffer.

Parameters:
  • width – The new width of the framebuffer.

  • height – The new height of the framebuffer.

inline const uint32_t GetWidth() const

Gets the width of the framebuffer.

Returns:

The width of the framebuffer.

inline const uint32_t GetHeight() const

Gets the height of the framebuffer.

Returns:

The height of the framebuffer.

void AttachColorTexture(Ref<Texture> &texture)

Attaches a color texture to the framebuffer.

Parameters:

texture – The color texture to attach.

void AttachDepthTexture(Ref<Texture> &texture)

Attaches a depth texture to the framebuffer.

Parameters:

texture – The depth texture to attach.

inline const Ref<Texture> &GetColorTexture(uint32_t index = 0) const

Gets the color texture at the specified index.

Parameters:

index – The index of the color texture.

Returns:

A reference to the color texture.

inline const Ref<Texture> &GetDepthTexture() const

Gets the depth texture.

Returns:

A reference to the depth texture.

Public Static Functions

static Ref<Framebuffer> Create(uint32_t width, uint32_t height, std::initializer_list<ImageFormat> attachments)

Creates a framebuffer with the specified width, height, and attachments.

Parameters:
  • width – The width of the framebuffer.

  • height – The height of the framebuffer.

  • attachments – The list of image formats for the attachments.

Returns:

A reference to the created framebuffer.

class GraphicsContext
#include <GraphicsContext.h>

Class representing the graphics context.

Public Functions

GraphicsContext(SDL_Window *windowHandle)

Constructs a GraphicsContext with the specified window handle.

Parameters:

windowHandle – The handle to the SDL window.

virtual ~GraphicsContext()

Virtual destructor for the GraphicsContext class.

void Init()

Initializes the graphics context.

void SwapBuffers()

Swaps the front and back buffers.

Public Static Functions

static Scope<GraphicsContext> Create(SDL_Window *window)

Creates a graphics context for the specified window.

Parameters:

window – The handle to the SDL window.

Returns:

A scope pointer to the created graphics context.

struct MaterialRenderSettings
struct MaterialProperties
#include <Material.h>

Structure representing the properties of a material.

Public Members

glm::vec4 color = glm::vec4(1.0f)

The color of the material.

float metallic = 0.0f

The metallic value of the material.

float roughness = 1.0f

The roughness value of the material.

float ao = 1.0f

The ambient occlusion value of the material.

glm::vec3 emissive = glm::vec3(0.0f)

The emissive value of the material.

struct MaterialTextures
#include <Material.h>

Structure representing the textures used in a material.

Public Members

Ref<Texture> albedo

The albedo texture.

Ref<Texture> normal

The normal map texture.

Ref<Texture> metallic

The metallic texture.

Ref<Texture> roughness

The roughness texture.

Ref<Texture> ao

The ambient occlusion texture.

Ref<Texture> emissive

The emissive texture.

struct MaterialTextureFlags

Public Members

bool hasAlbedo = false

Whether the material has an albedo texture.

bool hasNormal = false

Whether the material has a normal map texture.

bool hasMetallic = false

Whether the material has a metallic texture.

bool hasRoughness = false

Whether the material has a roughness texture.

bool hasAO = false

Whether the material has an ambient occlusion texture.

bool hasEmissive = false

Whether the material has an emissive texture.

class Material
#include <Material.h>

Class representing a material.

Public Functions

Material()

Default constructor for the Material class.

Material(Ref<Shader> shader)

Constructs a Material with the specified shader.

Parameters:

shader – The shader to be used with the material.

Material(std::string &path)

Constructs a Material from a file path.

Note

This constructor is for future use when the material YAML exists.

Parameters:

path – The file path to the material definition.

Material(MaterialTextures &materialTextures)

Constructs a Material with the specified textures.

Parameters:

materialTextures – The textures to be used with the material.

~Material() = default

Default destructor for the Material class.

void Use()

Uses the material by binding its shader and textures.

inline Ref<Shader> GetShader()

Gets the shader associated with the material.

Returns:

A reference to the shader.

struct Vertex
#include <Mesh.h>

Structure representing a vertex in a mesh.

Public Members

glm::vec3 Position = glm::vec3(0.0f)

The position of the vertex.

glm::vec2 TexCoords = glm::vec2(0.0f)

The texture coordinates of the vertex.

glm::vec3 Normals = glm::vec3(0.0f)

The normal vector of the vertex.

glm::vec3 Tangent = glm::vec3(0.0f)

The tangent vector of the vertex.

glm::vec3 Bitangent = glm::vec3(0.0f)

The bitangent vector of the vertex.

struct AABB
#include <Mesh.h>

Structure representing an axis-aligned bounding box (AABB).

Public Functions

inline AABB(const glm::vec3 &min, const glm::vec3 &max)

Constructs an AABB with specified minimum and maximum points.

Parameters:
  • min – The minimum point of the AABB.

  • max – The maximum point of the AABB.

Public Members

glm::vec3 min = glm::vec3(0.0f)

The minimum point of the AABB.

glm::vec3 max = glm::vec3(0.0f)

The maximum point of the AABB.

struct OBB
#include <Mesh.h>

Structure representing an oriented bounding box (OBB).

Public Functions

inline OBB(const std::array<glm::vec3, 8> &corners)

Constructs an OBB with specified corners.

Parameters:

corners – The corners of the OBB.

inline OBB(const glm::mat4 &transform, const AABB &aabb)

Constructs an OBB from a transformation matrix and an AABB.

Parameters:
  • transform – The transformation matrix.

  • aabb – The axis-aligned bounding box.

Public Members

std::array<glm::vec3, 8> corners

The corners of the OBB.

class Mesh
#include <Mesh.h>

Class representing a mesh.

Public Functions

Mesh(const std::vector<uint32_t> &indices, const std::vector<Vertex> &vertices)

Constructs a Mesh with the specified indices and vertices.

Parameters:
  • indices – The indices of the mesh.

  • vertices – The vertices of the mesh.

inline const Ref<VertexArray> &GetVertexArray() const

Gets the vertex array of the mesh.

Returns:

A reference to the vertex array.

inline const Ref<VertexBuffer> &GetVertexBuffer() const

Gets the vertex buffer of the mesh.

Returns:

A reference to the vertex buffer.

inline const Ref<IndexBuffer> &GetIndexBuffer() const

Gets the index buffer of the mesh.

Returns:

A reference to the index buffer.

inline void SetName(const std::string &name)

Sets the name of the mesh.

Parameters:

name – The name of the mesh.

inline const std::string &GetName() const

Gets the name of the mesh.

Returns:

The name of the mesh.

inline void SetMaterial(Ref<Material> &material)

Sets the material of the mesh.

Parameters:

material – A reference to the material.

inline void SetAABB(const AABB aabb)

Sets the axis-aligned bounding box (AABB) of the mesh.

Parameters:

aabb – The axis-aligned bounding box to set.

inline const AABB &GetAABB()

Gets the axis-aligned bounding box (AABB) of the mesh.

Returns:

A reference to the AABB.

inline AABB GetAABB(const glm::mat4 &transform)

Gets the transformed axis-aligned bounding box (AABB) of the mesh.

Parameters:

transform – The transformation matrix.

Returns:

The transformed AABB.

inline OBB GetOBB(const glm::mat4 &transform)

Gets the oriented bounding box (OBB) of the mesh.

Parameters:

transform – The transformation matrix.

Returns:

The OBB.

inline const Ref<Material> &GetMaterial() const

Gets the material of the mesh.

Returns:

A reference to the material.

inline const std::vector<Vertex> &GetVertices() const

Gets the vertices of the mesh.

Returns:

A reference to the vector of vertices.

inline const std::vector<uint32_t> &GetIndices() const

Gets the indices of the mesh.

Returns:

A reference to the vector of indices.

template<class Archive>
inline void save(Archive &archive)

Serializes the mesh to an archive.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

template<class Archive>
inline void load(Archive &archive)

Deserializes the mesh from an archive.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to deserialize from.

class Model : public Coffee::Resource
#include <Model.h>

Class representing a 3D model.

Public Functions

inline Model()

Default constructor for the Model class.

Model(const std::filesystem::path &path)

Constructs a Model from a file path.

Parameters:

filePath – The file path to the model.

inline const std::vector<Ref<Mesh>> &GetMeshes() const

Gets the meshes of the model.

Returns:

A reference to the vector of meshes.

inline void AddMesh(const Ref<Mesh> mesh)

Adds a mesh to the model.

Parameters:

mesh – A reference to the mesh to add.

inline std::string &GetName()

Gets the name of the model.

Returns:

A reference to the name of the model.

inline const Model *GetParent() const

Gets the parent model.

Returns:

A pointer to the parent model.

inline const std::vector<Ref<Model>> GetChildren() const

Gets the children models.

Returns:

A reference to the vector of children models.

inline const glm::mat4 GetTransform() const

Gets the transformation matrix of the model.

Returns:

The transformation matrix.

Public Static Functions

static Ref<Model> Load(const std::filesystem::path &path)

Loads a model from the specified file path.

Parameters:

path – The path to the model file.

struct RendererData
#include <Renderer.h>

Structure containing renderer data.

Public Members

CameraData cameraData

Camera data.

RenderData renderData

Render data.

Ref<UniformBuffer> CameraUniformBuffer

Uniform buffer for camera data.

Ref<UniformBuffer> RenderDataUniformBuffer

Uniform buffer for render data.

Ref<Texture> RenderTexture

Render texture.

struct CameraData
#include <Renderer.h>

Structure containing camera data.

Public Members

glm::mat4 projection

The projection matrix.

glm::mat4 view

The view matrix.

glm::vec3 position

The position of the camera.

struct RenderData
#include <Renderer.h>

Structure containing render data.

Public Members

LightComponent lights[32]

Array of light components.

int lightCount = 0

Number of lights.

struct RendererStats
#include <Renderer.h>

Structure containing renderer statistics.

Public Members

uint32_t DrawCalls = 0

Number of draw calls.

uint32_t VertexCount = 0

Number of vertices.

uint32_t IndexCount = 0

Number of indices.

struct RenderSettings
#include <Renderer.h>

Structure containing render settings.

Public Members

bool PostProcessing = true

Enable or disable post-processing.

bool SSAO = false

Enable or disable SSAO.

bool Bloom = false

Enable or disable bloom.

bool FXAA = false

Enable or disable FXAA.

float Exposure = 1.0f

Exposure value.

class Renderer
#include <Renderer.h>

Class representing the 3D renderer.

Public Static Functions

static void Init()

Initializes the renderer.

static void Shutdown()

Shuts down the renderer.

static void BeginScene(EditorCamera &camera)

Begins a new scene with the specified editor camera.

Parameters:

camera – The editor camera.

static void BeginScene(Camera &camera, const glm::mat4 &transform)

Begins a new scene with the specified camera and transform.

Parameters:
  • camera – The camera.

  • transform – The transform matrix.

static void EndScene()

Ends the current scene.

static void BeginOverlay(EditorCamera &camera)

Begins an overlay with the specified editor camera.

Parameters:

camera – The editor camera.

static void EndOverlay()

Ends the current overlay.

static void Submit(const Ref<Shader> &shader, const Ref<VertexArray> &vertexArray, const glm::mat4 &transform = glm::mat4(1.0f), uint32_t entityID = 4294967295)

Submits a draw call with the specified shader, vertex array, and transform.

Parameters:
  • shader – The shader.

  • vertexArray – The vertex array.

  • transform – The transform matrix.

static void Submit(const Ref<Material> &material, const Ref<Mesh> &mesh, const glm::mat4 &transform = glm::mat4(1.0f), uint32_t entityID = 4294967295)

Submits a draw call with the specified material, mesh, and transform.

Parameters:
  • material – The material.

  • mesh – The mesh.

  • transform – The transform matrix.

static void Submit(const LightComponent &light)

Submits a light component.

Parameters:

light – The light component.

static void OnResize(uint32_t width, uint32_t height)

Resizes the renderer to the specified width and height.

Parameters:
  • width – The new width.

  • height – The new height.

static inline const Ref<Texture> &GetRenderTexture()

Gets the render texture.

Returns:

A reference to the render texture.

static inline const Ref<Texture> &GetEntityIDTexture()

Retrieves the texture associated with the entity ID.

This static method returns a reference to the texture that is used to identify entities within the renderer. The texture is stored as a static member of the class.

Returns:

A constant reference to the entity ID texture.

static inline const RendererData &GetData()

Gets the renderer data.

Returns:

A reference to the renderer data.

static inline const RendererStats &GetStats()

Gets the renderer statistics.

Returns:

A reference to the renderer statistics.

static inline RenderSettings &GetRenderSettings()

Gets the render settings.

Returns:

A reference to the render settings.

class RendererAPI
#include <RendererAPI.h>

Class representing the Renderer API.

Public Static Functions

static void Init()

Initializes the Renderer API.

static void SetClearColor(const glm::vec4 &color)

Sets the clear color for the renderer.

Parameters:

color – The clear color as a glm::vec4.

static void Clear()

Clears the current buffer.

static void SetDepthMask(bool enabled)

Enables or disables the depth mask.

Parameters:

enabled – True to enable the depth mask, false to disable it.

static void DrawIndexed(const Ref<VertexArray> &vertexArray)

Draws the indexed vertices from the specified vertex array.

Parameters:

vertexArray – The vertex array containing the vertices to draw.

static void DrawLines(const Ref<VertexArray> &vertexArray, uint32_t vertexCount, float lineWidth = 1.0f)

Draws lines from the specified vertex array.

Parameters:
  • vertexArray – The vertex array containing the vertices to draw.

  • vertexCount – The number of vertices to draw.

  • lineWidth – The width of the lines.

static Scope<RendererAPI> Create()

Creates a new Renderer API instance.

Returns:

A scope pointer to the created Renderer API instance.

class Shader : public Coffee::Resource
#include <Shader.h>

Class representing a shader program.

Public Functions

Shader(const std::string &vertexPath, const std::string &fragmentPath)

Constructs a Shader with the specified vertex and fragment shader paths.

Parameters:
  • vertexPath – The file path to the vertex shader.

  • fragmentPath – The file path to the fragment shader.

virtual ~Shader()

Destructor for the Shader class.

void Bind()

Binds the shader program for use.

void Unbind()

Unbinds the shader program.

void setBool(const std::string &name, bool value) const

Sets a boolean uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • value – The boolean value to set.

void setInt(const std::string &name, int value) const

Sets an integer uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • value – The integer value to set.

void setFloat(const std::string &name, float value) const

Sets a float uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • value – The float value to set.

void setVec2(const std::string &name, const glm::vec2 &value) const

Sets a vec2 uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • value – The vec2 value to set.

void setVec3(const std::string &name, const glm::vec3 &value) const

Sets a vec3 uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • value – The vec3 value to set.

void setVec4(const std::string &name, const glm::vec4 &value) const

Sets a vec4 uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • value – The vec4 value to set.

void setMat2(const std::string &name, const glm::mat2 &mat) const

Sets a mat2 uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • mat – The mat2 value to set.

void setMat3(const std::string &name, const glm::mat3 &mat) const

Sets a mat3 uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • mat – The mat3 value to set.

void setMat4(const std::string &name, const glm::mat4 &mat) const

Sets a mat4 uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • mat – The mat4 value to set.

void checkCompileErrors(GLuint shader, std::string type)

Checks for compile errors in the shader.

Parameters:
  • shader – The shader ID.

  • type – The type of the shader.

Public Static Functions

static Ref<Shader> Create(const std::string &vertexPath, const std::string &fragmentPath)

Creates a shader from the specified vertex and fragment shader paths.

Parameters:
  • vertexPath – The file path to the vertex shader.

  • fragmentPath – The file path to the fragment shader.

Returns:

A reference to the created shader.

struct TextureProperties
#include <Texture.h>

Structure representing properties of a texture.

Public Members

ImageFormat Format

The format of the image.

uint32_t Height

The width and height of the texture.

bool GenerateMipmaps = true

Whether to generate mipmaps.

bool srgb = true

Whether the texture is in sRGB format.

class Texture : public Coffee::Resource
#include <Texture.h>

Class representing a texture.

Public Functions

Texture(const TextureProperties &properties)

Constructs a Texture with the specified properties.

Parameters:

properties – The properties of the texture.

Texture(uint32_t width, uint32_t height, ImageFormat imageFormat)

Constructs a Texture with the specified width, height, and image format.

Parameters:
  • width – The width of the texture.

  • height – The height of the texture.

  • imageFormat – The format of the image.

Texture(const std::filesystem::path &path, bool srgb = true)

Constructs a Texture from a file path.

Parameters:
  • path – The file path to the texture.

  • srgb – Whether the texture is in sRGB format.

~Texture()

Destructor for the Texture class.

void Bind(uint32_t slot)

Binds the texture to the specified slot.

Parameters:

slot – The slot to bind the texture to.

void Resize(uint32_t width, uint32_t height)

Resizes the texture to the specified width and height.

Parameters:
  • width – The new width of the texture.

  • height – The new height of the texture.

inline std::pair<uint32_t, uint32_t> GetSize()

Gets the size of the texture.

Returns:

A pair containing the width and height of the texture.

inline uint32_t GetWidth()

Gets the width of the texture.

Returns:

The width of the texture.

inline uint32_t GetHeight()

Gets the height of the texture.

Returns:

The height of the texture.

inline uint32_t GetID()

Gets the ID of the texture.

Returns:

The ID of the texture.

inline ImageFormat GetImageFormat()

Gets the image format of the texture.

Returns:

The image format of the texture.

Public Static Functions

static Ref<Texture> Load(const std::filesystem::path &path, bool srgb = true)

Loads a texture from a file path.

Parameters:
  • path – The file path to the texture.

  • srgb – Whether the texture is in sRGB format.

Returns:

A reference to the loaded texture.

static Ref<Texture> Create(uint32_t width, uint32_t height, ImageFormat format)

Creates a texture with the specified width, height, and format.

Parameters:
  • width – The width of the texture.

  • height – The height of the texture.

  • format – The format of the texture.

Returns:

A reference to the created texture.

class UniformBuffer
#include <UniformBuffer.h>

Class representing a uniform buffer.

Public Functions

UniformBuffer(uint32_t size, uint32_t binding)

Constructs a UniformBuffer with the specified size and binding.

Parameters:
  • size – The size of the buffer.

  • binding – The binding point of the buffer.

virtual ~UniformBuffer()

Destructor for the UniformBuffer class.

void SetData(const void *data, uint32_t size, uint32_t offset = 0)

Sets the data of the uniform buffer.

Parameters:
  • data – A pointer to the data to set.

  • size – The size of the data.

  • offset – The offset in the buffer to set the data.

Public Static Functions

static Ref<UniformBuffer> Create(uint32_t size, uint32_t binding)

Creates a uniform buffer with the specified size and binding.

Parameters:
  • size – The size of the buffer.

  • binding – The binding point of the buffer.

Returns:

A reference to the created uniform buffer.

class VertexArray
#include <VertexArray.h>

Class representing a vertex array.

Public Functions

VertexArray()

Constructs a VertexArray.

virtual ~VertexArray()

Destructor for the VertexArray class.

void Bind()

Binds the vertex array.

void Unbind()

Unbinds the vertex array.

void AddVertexBuffer(const Ref<VertexBuffer> &vertexBuffer)

Adds a vertex buffer to the vertex array.

Parameters:

vertexBuffer – A reference to the vertex buffer to add.

void SetIndexBuffer(const Ref<IndexBuffer> &indexBuffer)

Sets the index buffer for the vertex array.

Parameters:

indexBuffer – A reference to the index buffer to set.

inline const std::vector<Ref<VertexBuffer>> &GetVertexBuffers() const

Gets the vertex buffers of the vertex array.

Returns:

A constant reference to the vector of vertex buffers.

inline const Ref<IndexBuffer> &GetIndexBuffer() const

Gets the index buffer of the vertex array.

Returns:

A constant reference to the index buffer.

Public Static Functions

static Ref<VertexArray> Create()

Creates a vertex array.

Returns:

A reference to the created vertex array.

Scene

group scene

Defines

GLM_ENABLE_EXPERIMENTAL

Functions

void AddModelToTheSceneTree(Scene *scene, Ref<Model> model)

Add a model to the scene tree.

Parameters:
  • scene – The scene.

  • model – The model to add.

struct TagComponent
#include <Components.h>

Component representing a tag.

Public Functions

template<class Archive>
inline void serialize(Archive &archive)

Serializes the TagComponent.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

Public Members

std::string Tag

The tag string.

struct TransformComponent
#include <Components.h>

Component representing a transform.

Public Functions

inline glm::mat4 GetLocalTransform() const

Gets the local transformation matrix.

Returns:

The local transformation matrix.

inline void SetLocalTransform(const glm::mat4 &transform)

Sets the local transformation matrix.

Parameters:

transform – The transformation matrix to set.

inline const glm::mat4 &GetWorldTransform() const

Gets the world transformation matrix.

Returns:

The world transformation matrix.

inline void SetWorldTransform(const glm::mat4 &transform)

Sets the world transformation matrix.

Parameters:

transform – The transformation matrix to set.

template<class Archive>
inline void serialize(Archive &archive)

Serializes the TransformComponent.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

Public Members

glm::vec3 Position = {0.0f, 0.0f, 0.0f}

The position vector.

glm::vec3 Rotation = {0.0f, 0.0f, 0.0f}

The rotation vector.

glm::vec3 Scale = {1.0f, 1.0f, 1.0f}

The scale vector.

struct CameraComponent
#include <Components.h>

Component representing a camera.

Public Functions

template<class Archive>
inline void serialize(Archive &archive)

Serializes the CameraComponent.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

Public Members

SceneCamera Camera

The scene camera.

struct MeshComponent
#include <Components.h>

Component representing a mesh.

Public Functions

inline const Ref<Mesh> &GetMesh() const

Gets the mesh reference.

Returns:

The mesh reference.

template<class Archive>
inline void save(Archive &archive)

Serializes the MeshComponent.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

template<class Archive>
inline void load(Archive &archive)

Deserializes the MeshComponent.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to deserialize from.

Public Members

Ref<Mesh> mesh

The mesh reference.

bool drawAABB = false

Flag to draw the axis-aligned bounding box (AABB).

struct MaterialComponent
#include <Components.h>

Component representing a material.

Public Functions

template<class Archive>
inline void serialize(Archive &archive)

Serializes the MaterialComponent.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

Public Members

Ref<Material> material

The material reference.

struct LightComponent
#include <Components.h>

Component representing a light.

Public Types

enum Type

Enum representing the type of light.

Values:

enumerator DirectionalLight

Directional light.

enumerator PointLight

Point light.

enumerator SpotLight

Spot light.

Public Functions

template<class Archive>
inline void serialize(Archive &archive)

Serializes the LightComponent.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

Public Members

glm::vec3 Color = {1.0f, 1.0f, 1.0f}

The color of the light.

glm::vec3 Direction = {0.0f, -1.0f, 0.0f}

The direction of the light.

glm::vec3 Position = {0.0f, 0.0f, 0.0f}

The position of the light.

float Range = 5.0f

The range of the light.

float Attenuation = 1.0f

The attenuation of the light.

float Intensity = 1.0f

The intensity of the light.

float Angle = 45.0f

The angle of the light.

int type = static_cast<int>(Type::DirectionalLight)

The type of the light.

class Entity
#include <Entity.h>

Class representing an entity in the scene.

Public Functions

Entity() = default

Default constructor for Entity.

Entity(entt::entity handle, Scene *scene)

Constructor for Entity with handle and scene.

Parameters:
  • handle – The entity handle.

  • scene – The scene the entity belongs to.

Entity(const Entity &other) = default

Copy constructor for Entity.

Parameters:

other – The other entity to copy from.

template<typename T, typename ...Args>
inline T &AddComponent(Args&&... args)

Add a component to the entity.

Template Parameters:
  • T – The component type.

  • Args – The component constructor arguments.

Parameters:

args – The component constructor arguments.

Returns:

Reference to the added component.

template<typename T>
inline T &GetComponent()

Get a component from the entity.

Template Parameters:

T – The component type.

Returns:

Reference to the component.

template<typename T>
inline bool HasComponent()

Check if the entity has a component.

Template Parameters:

T – The component type.

Returns:

True if the entity has the component, false otherwise.

template<typename T>
inline void RemoveComponent()

Remove a component from the entity.

Template Parameters:

T – The component type.

inline operator bool() const

Check if the entity is valid.

Returns:

True if the entity is valid, false otherwise.

inline operator entt::entity() const

Convert the entity to its handle.

Returns:

The entity handle.

inline operator uint32_t() const

Convert the entity to its handle as a uint32_t.

Returns:

The entity handle as a uint32_t.

inline bool operator==(const Entity &other) const

Equality operator.

Parameters:

other – The other entity to compare with.

Returns:

True if the entities are equal, false otherwise.

inline bool operator!=(const Entity &other) const

Inequality operator.

Parameters:

other – The other entity to compare with.

Returns:

True if the entities are not equal, false otherwise.

inline void SetParent(Entity entity)

Set the parent of the entity.

Parameters:

entity – The parent entity.

class PrimitiveMesh
#include <PrimitiveMesh.h>

Class representing different types of primitive meshes.

Public Static Functions

static Ref<Mesh> CreateQuad()

Creates a quad mesh.

Returns:

A reference to the created quad mesh.

static Ref<Mesh> CreateCube(const glm::vec3 &size = {1.0f, 1.0f, 1.0f}, int subdivideW = 0, int subdidiveH = 0, int subdivideD = 0)

Creates a cube mesh.

Creates a cube mesh.

Parameters:
  • size – The size of the cube.

  • subdivideW – Number of subdivisions along the width.

  • subdivideH – Number of subdivisions along the height.

  • subdivideD – Number of subdivisions along the depth.

  • size – The size of the cube.

  • subdivideW – Subdivision parameter for width (currently not functional).

  • subdivideH – Subdivision parameter for height (currently not functional).

  • subdivideD – Subdivision parameter for depth (currently not functional).

Returns:

A reference to the created cube mesh.

Returns:

Ref<Mesh> A reference to the created cube mesh.

static Ref<Mesh> CreateSphere(float radius = 0.5f, float height = 1.0f, int radialSegments = 64, int rings = 32, bool isHemiSphere = false)

Creates a sphere mesh.

Parameters:
  • radius – The radius of the sphere.

  • height – The height of the sphere.

  • radialSegments – Number of radial segments.

  • rings – Number of rings.

  • isHemiSphere – Whether the sphere is a hemisphere.

Returns:

A reference to the created sphere mesh.

static Ref<Mesh> CreatePlane(const glm::vec2 &size = {1.0f, 1.0f}, const glm::vec3 &normal = {0.0f, 1.0f, 0.0f})

Creates a plane mesh.

Parameters:
  • size – The size of the plane.

  • normal – The normal vector of the plane.

Returns:

A reference to the created plane mesh.

static Ref<Mesh> CreateCylinder(float topRadius = 0.5f, float bottomRadius = 0.5f, float height = 1.0f, int radialSegments = 64, int rings = 1, bool capTop = true, bool capBottom = true)

Creates a cylinder mesh.

Parameters:
  • topRadius – The radius of the top of the cylinder.

  • bottomRadius – The radius of the bottom of the cylinder.

  • height – The height of the cylinder.

  • radialSegments – Number of radial segments.

  • rings – Number of rings.

  • capTop – Whether to cap the top of the cylinder.

  • capBottom – Whether to cap the bottom of the cylinder.

Returns:

A reference to the created cylinder mesh.

static Ref<Mesh> CreateCone(float radius = 0.5f, float height = 1.0f, int radialSegments = 64, int rings = 1, bool cap = true)

Creates a cone mesh.

Parameters:
  • radius – The radius of the base of the cone.

  • height – The height of the cone.

  • radialSegments – Number of radial segments.

  • rings – Number of rings.

  • cap – Whether to cap the base of the cone.

Returns:

A reference to the created cone mesh.

static Ref<Mesh> CreateTorus(float innerRadius = 0.5f, float outerRadius = 1.0f, int rings = 64, int ringSegments = 32)

Creates a torus mesh.

Parameters:
  • innerRadius – The inner radius of the torus.

  • outerRadius – The outer radius of the torus.

  • rings – Number of rings.

  • ringSegments – Number of ring segments.

Returns:

A reference to the created torus mesh.

static Ref<Mesh> CreateCapsule(float radius = 0.5f, float height = 2.0f, int radialSegments = 64, int rings = 8)

Creates a capsule mesh.

Parameters:
  • radius – The radius of the capsule.

  • height – The height of the capsule.

  • radialSegments – Number of radial segments.

  • rings – Number of rings.

Returns:

A reference to the created capsule mesh.

class Scene
#include <Scene.h>

Class representing a scene.

Public Functions

Scene()

Constructor for Scene.

~Scene() = default

Default destructor.

Entity CreateEntity(const std::string &name = std::string())

Create an entity in the scene.

Parameters:

name – The name of the entity.

Returns:

The created entity.

void DestroyEntity(Entity entity)

Destroy an entity in the scene.

Parameters:

entity – The entity to destroy.

void OnInit()

Initialize the scene.

void OnUpdateEditor(EditorCamera &camera, float dt)

Update the scene in editor mode.

Parameters:
  • camera – The editor camera.

  • dt – The delta time.

void OnUpdateRuntime(float dt)

Update the scene in runtime mode.

Parameters:

dt – The delta time.

void OnEvent(Event &e)

Handle an event in the scene.

Parameters:

e – The event.

void OnExit()

Exit the scene.

Public Static Functions

static Ref<Scene> Load(const std::filesystem::path &path)

Load a scene from a file.

Parameters:

path – The path to the file.

Returns:

The loaded scene.

static void Save(const std::filesystem::path &path, Ref<Scene> scene)

Save a scene to a file.

Parameters:
  • path – The path to the file.

  • scene – The scene to save.

class SceneCamera : public Coffee::Camera
#include <SceneCamera.h>

Camera class for the scene.

Public Functions

SceneCamera()

Constructor for SceneCamera.

~SceneCamera() = default

Default destructor.

struct HierarchyComponent
#include <SceneTree.h>

Component for managing entity hierarchy.

Public Functions

HierarchyComponent(entt::entity parent)

Constructor with parent entity.

Parameters:

parent – The parent entity.

HierarchyComponent()

Default constructor.

template<class Archive>
inline void serialize(Archive &archive)

Serialize the component.

Template Parameters:

Archive – The archive type.

Parameters:

archive – The archive.

Public Static Functions

static void OnConstruct(entt::registry &registry, entt::entity entity)

Called when the component is constructed.

Parameters:
  • registry – The entity registry.

  • entity – The entity.

static void OnDestroy(entt::registry &registry, entt::entity entity)

Called when the component is destroyed.

Parameters:
  • registry – The entity registry.

  • entity – The entity.

static void OnUpdate(entt::registry &registry, entt::entity entity)

Called when the component is updated.

Parameters:
  • registry – The entity registry.

  • entity – The entity.

static void Reparent(entt::registry &registry, entt::entity entity, entt::entity parent)

Reparent the entity to a new parent.

Parameters:
  • registry – The entity registry.

  • entity – The entity to reparent.

  • parent – The new parent entity.

class SceneTree
#include <SceneTree.h>

Class for managing the scene tree.

Public Functions

SceneTree(Scene *scene)

Constructor for SceneTree.

Parameters:

scene – The scene context.

~SceneTree() = default

Default destructor.

void Update()

Update the scene tree.

void UpdateTransform(entt::entity entity)

Update the transform of an entity.

Parameters:

entity – The entity to update.

namespace cereal

Functions

template<class Archive>
void save(Archive &archive, const std::filesystem::path &path)

Serializes a std::filesystem::path object.

Template Parameters:

Archive – The type of the archive.

Parameters:
  • archive – The archive to save the path to.

  • path – The filesystem path to be serialized.

template<class Archive>
void load(Archive &archive, std::filesystem::path &path)

Deserializes a std::filesystem::path object.

Template Parameters:

Archive – The type of the archive.

Parameters:
  • archive – The archive to load the path from.

  • path – The filesystem path to be deserialized.

template<class Archive>
void serialize(Archive &archive, glm::vec2 &vec)

Serializes a glm::vec2 object.

Template Parameters:

Archive – The type of the archive.

Parameters:
  • archive – The archive to serialize to.

  • vec – The glm::vec2 object to serialize.

template<class Archive>
void serialize(Archive &archive, glm::vec3 &vec)

Serializes a glm::vec3 object.

Template Parameters:

Archive – The type of the archive.

Parameters:
  • archive – The archive to serialize to.

  • vec – The glm::vec3 object to serialize.

template<class Archive>
void serialize(Archive &archive, glm::vec4 &vec)

Serializes a glm::vec4 object.

Template Parameters:

Archive – The type of the archive.

Parameters:
  • archive – The archive to serialize to.

  • vec – The glm::vec4 object to serialize.

template<class Archive>
void serialize(Archive &archive, glm::quat &quat)

Serializes a glm::quat object.

Template Parameters:

Archive – The type of the archive.

Parameters:
  • archive – The archive to serialize to.

  • quat – The glm::quat object to serialize.

namespace Coffee

Typedefs

template<typename T>
using Scope = std::unique_ptr<T>
template<typename T>
using Ref = std::shared_ptr<T>
using MouseCode = uint16_t

Enums

enum class ResourceType

Enumeration of different types of resources.

Values:

enumerator Unknown

Unknown resource type.

enumerator Texture

Texture resource type.

enumerator Model

Model resource type.

enumerator Shader

Shader resource type.

enum class ResourceFormat

Enumeration of resource formats.

Values:

enumerator Binary

Binary format.

enumerator JSON

JSON format.

enum class PrimitiveType

Enum class representing different types of primitive meshes.

Values:

enumerator Quad

A quad mesh.

enumerator Cube

A cube mesh.

enumerator Sphere

A sphere mesh.

enumerator Plane

A plane mesh.

enumerator Cylinder

A cylinder mesh.

enumerator Cone

A cone mesh.

enumerator Torus

A torus mesh.

enumerator Capsule

A capsule mesh.

enumerator None

No mesh.

Functions

template<typename T, typename ...Args>
Scope<T> CreateScope(Args&&... args)
template<typename T, typename ...Args>
Ref<T> CreateRef(Args&&... args)
ResourceFormat GetResourceSaveFormatFromType(ResourceType type)
glm::mat4 aiMatrix4x4ToGLMMat4(const aiMatrix4x4 &aiMat)
void OpenGLMessageCallback(unsigned source, unsigned type, unsigned id, unsigned severity, int length, const char *message, const void *userParam)
GLenum ImageFormatToOpenGLInternalFormat(ImageFormat format)
GLenum ImageFormatToOpenGLFormat(ImageFormat format)
static GLenum ShaderDataTypeToOpenGLBaseType(ShaderDataType type)

Variables

SDL_TimerCallback timerCallback = [](void* param, uint32_t interval, uint32_t elapsed) -> uint32_t{Timer* timer = static_cast<Timer*>(param);if(timer->GetCallback()){timer->GetCallback()();}if(timer->isOneShot()){timer->Stop();return 0;}if(timer->isAutoStart()){timer->Start(timer->getWaitTime());}return 0;}
static uint8_t s_SDLWindowCount = 0
static Ref<Project> s_ActiveProject
static const uint32_t s_MaxFramebufferSize = 8192
static bool s_viewportResized = false
static uint32_t s_viewportWidth = 0
static uint32_t s_viewportHeight = 0
static Ref<Material> missingMaterial
struct AABB
#include <Mesh.h>

Structure representing an axis-aligned bounding box (AABB).

Public Functions

inline AABB(const glm::vec3 &min, const glm::vec3 &max)

Constructs an AABB with specified minimum and maximum points.

Parameters:
  • min – The minimum point of the AABB.

  • max – The maximum point of the AABB.

Public Members

glm::vec3 min = glm::vec3(0.0f)

The minimum point of the AABB.

glm::vec3 max = glm::vec3(0.0f)

The maximum point of the AABB.

class Application
#include <Application.h>

The Application class is responsible for managing the main application loop, handling events, and managing layers and overlays.

Public Types

using EventCallbackFn = std::function<void(Event&)>

Type definition for event callback function.

Public Functions

Application()

Constructs the Application object.

virtual ~Application()

Destroys the Application object.

void Run()

Starts the main application loop.

void OnEvent(Event &e)

Handles incoming events.

Parameters:

e – The event to handle.

void PushLayer(Layer *layer)

Pushes a layer onto the layer stack.

Parameters:

layer – The layer to push.

void PushOverlay(Layer *layer)

Pushes an overlay onto the layer stack.

Parameters:

layer – The overlay to push.

inline Window &GetWindow()

Gets the main application window.

Returns:

A reference to the main application window.

inline void SetEventCallback(const EventCallbackFn &callback)

Sets the event callback function.

Parameters:

callback – The event callback function.

void Close()

Closes the application.

inline ImGuiLayer *GetImGuiLayer()

Gets the ImGui layer.

Returns:

A pointer to the ImGui layer.

Public Static Functions

static inline Application &Get()

Gets the singleton instance of the Application.

Returns:

A reference to the singleton instance.

class AppRenderEvent : public Coffee::Event
#include <ApplicationEvent.h>

Event for application render.

class AppTickEvent : public Coffee::Event
#include <ApplicationEvent.h>

Event for application tick.

class AppUpdateEvent : public Coffee::Event
#include <ApplicationEvent.h>

Event for application update.

struct BufferAttribute
#include <Buffer.h>

Structure representing a buffer attribute.

Public Functions

BufferAttribute() = default

Default constructor for BufferAttribute.

inline BufferAttribute(ShaderDataType type, const std::string &name, bool normalized = false)

Constructs a BufferAttribute with the specified parameters.

Parameters:
  • type – The type of the attribute.

  • name – The name of the attribute.

  • normalized – Whether the attribute is normalized.

inline uint32_t GetComponentCount() const

Returns the number of components in the attribute.

Returns:

The number of components.

Public Members

std::string Name

The name of the attribute.

ShaderDataType Type

The type of the attribute.

uint32_t Size

The size of the attribute.

size_t Offset

The offset of the attribute.

bool Normalized

Whether the attribute is normalized.

class BufferLayout
#include <Buffer.h>

Class representing a buffer layout.

Public Functions

inline BufferLayout()

Default constructor for BufferLayout.

inline BufferLayout(std::initializer_list<BufferAttribute> elements)

Constructs a BufferLayout with the specified attributes.

Parameters:

elements – The list of buffer attributes.

inline uint32_t GetStride() const

Returns the stride of the buffer layout.

Returns:

The stride in bytes.

inline const std::vector<BufferAttribute> &GetElements() const

Returns the list of buffer attributes.

Returns:

The list of buffer attributes.

inline std::vector<BufferAttribute>::iterator begin()

Returns an iterator to the beginning of the buffer attributes.

Returns:

An iterator to the beginning.

inline std::vector<BufferAttribute>::iterator end()

Returns an iterator to the end of the buffer attributes.

Returns:

An iterator to the end.

inline std::vector<BufferAttribute>::const_iterator begin() const

Returns a constant iterator to the beginning of the buffer attributes.

Returns:

A constant iterator to the beginning.

inline std::vector<BufferAttribute>::const_iterator end() const

Returns a constant iterator to the end of the buffer attributes.

Returns:

A constant iterator to the end.

class CacheManager
#include <CacheManager.h>

Manages cache-related operations for the CoffeeEngine.

Public Static Functions

static inline void SetCachePath(const std::filesystem::path &path)

Sets the cache path.

Parameters:

path – The path to set as the cache directory.

static inline const std::filesystem::path &GetCachePath()

Gets the current cache path.

Returns:

The current cache path.

static inline void CreateCacheDirectory()

Creates the cache directory.

static inline void ClearCache()

Clears the cache by removing all files in the cache directory.

static inline std::filesystem::path GetCachedFilePath(const std::string &filename)

Gets the file path for a cached file.

Parameters:

filename – The name of the file to be cached.

Returns:

The full path to the cached file.

class Camera
#include <Camera.h>

The Camera class is responsible for managing the camera’s projection matrix.

Subclassed by Coffee::EditorCamera, Coffee::SceneCamera

Public Functions

Camera() = default

Default constructor for the Camera class.

inline Camera(const glm::mat4 &projection)

Constructs a Camera object with the specified projection matrix.

Parameters:

projection – The projection matrix.

virtual ~Camera() = default

Virtual destructor for the Camera class.

inline const glm::mat4 &GetProjection() const

Gets the projection matrix of the camera.

Returns:

The projection matrix.

inline void SetViewportSize(float width, float height)

Sets the size of the viewport and updates the projection matrix.

Parameters:
  • width – The width of the viewport.

  • height – The height of the viewport.

struct CameraComponent
#include <Components.h>

Component representing a camera.

Public Functions

template<class Archive>
inline void serialize(Archive &archive)

Serializes the CameraComponent.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

Public Members

SceneCamera Camera

The scene camera.

class DebugRenderer
#include <DebugRenderer.h>

Class responsible for rendering debug lines.

Public Static Functions

static void Init()

Initializes the DebugRenderer.

static void Shutdown()

Shuts down the DebugRenderer.

static void DrawLine(const glm::vec3 &start, const glm::vec3 &end, glm::vec4 color = glm::vec4(1.0f), float lineWidth = 1.0f)

Draws a line between two points.

Parameters:
  • start – The starting point of the line.

  • end – The ending point of the line.

  • color – The color of the line. Default is white.

  • lineWidth – The width of the line. Default is 1.0f.

struct DebugVertex
#include <DebugRenderer.h>

Structure representing a vertex in a line.

Public Members

glm::vec3 Position

The position of the vertex.

glm::vec4 Color

The color of the vertex.

class EditorCamera : public Coffee::Camera
#include <EditorCamera.h>

The EditorCamera class is responsible for managing the editor camera’s view and projection matrices.

Public Types

enum class CameraState

Enum class representing the state of the camera.

Values:

enumerator NONE

No camera state.

enumerator ORBIT

Camera is in orbit mode.

enumerator FLY

Camera is in fly mode.

Public Functions

EditorCamera() = default

Default constructor for the EditorCamera class.

EditorCamera(float fov, ProjectionType projection = ProjectionType::PERSPECTIVE, float aspectRatio = 1.778, float nearClip = 0.1f, float farClip = 1000.0f)

Constructs an EditorCamera object with the specified parameters.

Parameters:
  • fov – The field of view for the perspective projection.

  • projection – The type of projection (perspective or orthographic).

  • aspectRatio – The aspect ratio of the viewport.

  • nearClip – The near clipping plane distance.

  • farClip – The far clipping plane distance.

void OnUpdate(float dt)

Updates the camera’s view matrix.

void OnEvent(Event &event)

Handles events for the camera.

Parameters:

event – The event to handle.

inline void SetFocusPoint(glm::vec3 focusPoint)

Sets the focal point of the camera.

Parameters:

focusPoint – The focal point.

inline const glm::mat4 GetViewMatrix() const

Gets the view matrix of the camera.

Returns:

The view matrix.

glm::vec3 GetUpDirection() const

Gets the up direction of the camera.

Returns:

The up direction.

glm::vec3 GetRightDirection() const

Gets the right direction of the camera.

Returns:

The right direction.

glm::vec3 GetForwardDirection() const

Gets the forward direction of the camera.

Returns:

The forward direction.

inline const glm::vec3 &GetPosition() const

Gets the position of the camera.

Returns:

The position.

glm::quat GetOrientation() const

Gets the orientation of the camera.

Returns:

The orientation.

inline const CameraState &GetState() const

Gets the current state of the camera.

Returns:

The current state of the camera.

class Entity
#include <Entity.h>

Class representing an entity in the scene.

Public Functions

Entity() = default

Default constructor for Entity.

Entity(entt::entity handle, Scene *scene)

Constructor for Entity with handle and scene.

Parameters:
  • handle – The entity handle.

  • scene – The scene the entity belongs to.

Entity(const Entity &other) = default

Copy constructor for Entity.

Parameters:

other – The other entity to copy from.

template<typename T, typename ...Args>
inline T &AddComponent(Args&&... args)

Add a component to the entity.

Template Parameters:
  • T – The component type.

  • Args – The component constructor arguments.

Parameters:

args – The component constructor arguments.

Returns:

Reference to the added component.

template<typename T>
inline T &GetComponent()

Get a component from the entity.

Template Parameters:

T – The component type.

Returns:

Reference to the component.

template<typename T>
inline bool HasComponent()

Check if the entity has a component.

Template Parameters:

T – The component type.

Returns:

True if the entity has the component, false otherwise.

template<typename T>
inline void RemoveComponent()

Remove a component from the entity.

Template Parameters:

T – The component type.

inline operator bool() const

Check if the entity is valid.

Returns:

True if the entity is valid, false otherwise.

inline operator entt::entity() const

Convert the entity to its handle.

Returns:

The entity handle.

inline operator uint32_t() const

Convert the entity to its handle as a uint32_t.

Returns:

The entity handle as a uint32_t.

inline bool operator==(const Entity &other) const

Equality operator.

Parameters:

other – The other entity to compare with.

Returns:

True if the entities are equal, false otherwise.

inline bool operator!=(const Entity &other) const

Inequality operator.

Parameters:

other – The other entity to compare with.

Returns:

True if the entities are not equal, false otherwise.

inline void SetParent(Entity entity)

Set the parent of the entity.

Parameters:

entity – The parent entity.

class Event
#include <Event.h>

Base class for all events.

Subclassed by Coffee::AppRenderEvent, Coffee::AppTickEvent, Coffee::AppUpdateEvent, Coffee::FileDropEvent, Coffee::KeyEvent, Coffee::MouseButtonEvent, Coffee::MouseMovedEvent, Coffee::MouseScrolledEvent, Coffee::WindowCloseEvent, Coffee::WindowResizeEvent

Public Functions

virtual EventType GetEventType() const = 0

Get the type of the event.

Returns:

The event type.

virtual const char *GetName() const = 0

Get the name of the event.

Returns:

The event name.

virtual int GetCategoryFlags() const = 0

Get the category flags of the event.

Returns:

The category flags.

inline virtual std::string ToString() const

Convert the event to a string representation.

Returns:

A string representation of the event.

inline bool IsInCategory(EventCategory category)

Check if the event is in a specific category.

Parameters:

category – The category to check.

Returns:

True if the event is in the category, false otherwise.

class EventDispatcher
#include <Event.h>

Event dispatcher to handle events.

Public Functions

template<typename T, typename F>
inline bool Dispatch(const F &func)

Dispatches the event if it matches the type.

Template Parameters:
  • T – The event type.

  • F – The function type.

Parameters:

func – The function to call if the event matches the type.

Returns:

True if the event was dispatched, false otherwise.

class FileDialog
#include <FileDialog.h>

Class for handling file dialogs.

Public Static Functions

static const std::filesystem::path OpenFile(const FileDialogArgs &args = {})

Opens a file dialog to select a file.

Parameters:

args – Arguments for the file dialog.

Returns:

The selected file path.

static const std::filesystem::path SaveFile(const FileDialogArgs &args = {})

Opens a file dialog to save a file.

Parameters:

args – Arguments for the file dialog.

Returns:

The selected file path.

struct FileDialogArgs
#include <FileDialog.h>

Arguments for the file dialog.

Public Members

std::vector<Filter> Filters = {}

List of filters.

std::string DefaultPath = ""

Default path for the file dialog.

std::string DefaultName = ""

Default name for the file dialog.

struct Filter
#include <FileDialog.h>

Filter for file types.

Public Members

const char *Name

Name of the filter.

const char *Extension

Extension of the filter.

class FileDropEvent : public Coffee::Event
#include <ApplicationEvent.h>

Event for Dropping a file.

Public Functions

inline uint64_t GetTimestamp() const

Get the timestamp of the event.

Returns:

The timestamp of the event.

inline uint32_t GetWindowID() const

Get the window ID of the event.

Returns:

The window ID of the event.

inline float GetX() const

Get the x position of the event.

Returns:

The x position of the event.

inline float GetY() const

Get the y position of the event.

Returns:

The y position of the event.

inline const std::string &GetSource() const

Get the source of the event.

Returns:

The source of the event.

inline const std::string &GetFile() const

Get the file of the event.

Returns:

The file of the event.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

class Framebuffer
#include <Framebuffer.h>

Class representing a framebuffer.

Public Functions

Framebuffer(uint32_t width, uint32_t height, std::initializer_list<ImageFormat> attachments)

Constructs a Framebuffer with the specified width, height, and attachments.

Parameters:
  • width – The width of the framebuffer.

  • height – The height of the framebuffer.

  • attachments – The list of image formats for the attachments.

~Framebuffer()

Destroys the Framebuffer.

void Invalidate()

Invalidates the framebuffer, forcing it to be recreated.

void Bind()

Binds the framebuffer.

void UnBind()

Unbinds the framebuffer.

void SetDrawBuffers(std::initializer_list<Ref<Texture>> colorAttachments)

Sets the draw buffers for the framebuffer.

Warning

This function is not finished, does not work, and is slow. Do not use it 🫡.

Parameters:

colorAttachments – The list of color attachments.

void SetDrawBuffers(std::initializer_list<uint32_t> colorAttachments)

Sets the draw buffers for the framebuffer.

Parameters:

colorAttachments – The list of color attachment indices.

void Resize(uint32_t width, uint32_t height)

Resizes the framebuffer.

Parameters:
  • width – The new width of the framebuffer.

  • height – The new height of the framebuffer.

inline const uint32_t GetWidth() const

Gets the width of the framebuffer.

Returns:

The width of the framebuffer.

inline const uint32_t GetHeight() const

Gets the height of the framebuffer.

Returns:

The height of the framebuffer.

void AttachColorTexture(Ref<Texture> &texture)

Attaches a color texture to the framebuffer.

Parameters:

texture – The color texture to attach.

void AttachDepthTexture(Ref<Texture> &texture)

Attaches a depth texture to the framebuffer.

Parameters:

texture – The depth texture to attach.

inline const Ref<Texture> &GetColorTexture(uint32_t index = 0) const

Gets the color texture at the specified index.

Parameters:

index – The index of the color texture.

Returns:

A reference to the color texture.

inline const Ref<Texture> &GetDepthTexture() const

Gets the depth texture.

Returns:

A reference to the depth texture.

Public Static Functions

static Ref<Framebuffer> Create(uint32_t width, uint32_t height, std::initializer_list<ImageFormat> attachments)

Creates a framebuffer with the specified width, height, and attachments.

Parameters:
  • width – The width of the framebuffer.

  • height – The height of the framebuffer.

  • attachments – The list of image formats for the attachments.

Returns:

A reference to the created framebuffer.

class GraphicsContext
#include <GraphicsContext.h>

Class representing the graphics context.

Public Functions

GraphicsContext(SDL_Window *windowHandle)

Constructs a GraphicsContext with the specified window handle.

Parameters:

windowHandle – The handle to the SDL window.

virtual ~GraphicsContext()

Virtual destructor for the GraphicsContext class.

void Init()

Initializes the graphics context.

void SwapBuffers()

Swaps the front and back buffers.

Public Static Functions

static Scope<GraphicsContext> Create(SDL_Window *window)

Creates a graphics context for the specified window.

Parameters:

window – The handle to the SDL window.

Returns:

A scope pointer to the created graphics context.

struct HierarchyComponent
#include <SceneTree.h>

Component for managing entity hierarchy.

Public Functions

HierarchyComponent(entt::entity parent)

Constructor with parent entity.

Parameters:

parent – The parent entity.

HierarchyComponent()

Default constructor.

template<class Archive>
inline void serialize(Archive &archive)

Serialize the component.

Template Parameters:

Archive – The archive type.

Parameters:

archive – The archive.

Public Static Functions

static void OnConstruct(entt::registry &registry, entt::entity entity)

Called when the component is constructed.

Parameters:
  • registry – The entity registry.

  • entity – The entity.

static void OnDestroy(entt::registry &registry, entt::entity entity)

Called when the component is destroyed.

Parameters:
  • registry – The entity registry.

  • entity – The entity.

static void OnUpdate(entt::registry &registry, entt::entity entity)

Called when the component is updated.

Parameters:
  • registry – The entity registry.

  • entity – The entity.

static void Reparent(entt::registry &registry, entt::entity entity, entt::entity parent)

Reparent the entity to a new parent.

Parameters:
  • registry – The entity registry.

  • entity – The entity to reparent.

  • parent – The new parent entity.

class ImGuiLayer : public Coffee::Layer
#include <ImGuiLayer.h>

The ImGuiLayer class is responsible for managing the ImGui layer in the application.

Public Functions

ImGuiLayer()

Constructs the ImGuiLayer object.

~ImGuiLayer()

Destroys the ImGuiLayer object.

virtual void OnAttach() override

Attaches the ImGui layer to the application.

virtual void OnDetach() override

Detaches the ImGui layer from the application.

virtual void OnEvent(Event &e) override

Handles events for the ImGui layer.

Parameters:

e – The event to handle.

void Begin()

Begins a new ImGui frame.

void End()

Ends the current ImGui frame.

virtual void OnImGuiRender() override

Renders ImGui elements.

inline void BlockEvents(bool block)

Blocks or unblocks events from being handled by the ImGui layer.

Parameters:

block – True to block events, false to unblock.

void SetTeaColorStyle()

Sets the Coffee color style for ImGui.

void SetGodotColorStyle()

Sets the Godot color style for ImGui.

void SetCoffeeColorStyle()

Sets the Coffee color style for ImGui.

class IndexBuffer
#include <Buffer.h>

Class representing an index buffer.

Public Functions

IndexBuffer(uint32_t *indices, uint32_t count)

Constructs an IndexBuffer with the specified indices and count.

Parameters:
  • indices – The index data.

  • count – The number of indices.

virtual ~IndexBuffer()

Destroys the IndexBuffer.

void Bind()

Binds the index buffer.

void Unbind()

Unbinds the index buffer.

inline uint32_t GetCount() const

Returns the number of indices in the buffer.

Returns:

The number of indices.

Public Static Functions

static Ref<IndexBuffer> Create(uint32_t *indices, uint32_t count)

Creates an index buffer with the specified indices and count.

Parameters:
  • indices – The index data.

  • count – The number of indices.

Returns:

A reference to the created index buffer.

class Input

Public Static Functions

static bool IsKeyPressed(const KeyCode key)

Checks if a specific key is currently being pressed.

Parameters:

key – The key code of the key to check.

Returns:

True if the key is currently being pressed, false otherwise.

static bool IsMouseButtonPressed(const MouseCode button)

Checks if a mouse button is currently pressed.

Parameters:

button – The mouse button to check.

Returns:

True if the mouse button is pressed, false otherwise.

static glm::vec2 GetMousePosition()

Retrieves the current position of the mouse.

Returns:

The current position of the mouse as a 2D vector.

static float GetMouseX()

Retrieves the current x-coordinate of the mouse cursor.

Returns:

The x-coordinate of the mouse cursor.

static float GetMouseY()

Retrieves the current y-coordinate of the mouse cursor.

Returns:

The y-coordinate of the mouse cursor.

class KeyEvent : public Coffee::Event
#include <KeyEvent.h>

Base class for key events.

Subclassed by Coffee::KeyPressedEvent, Coffee::KeyReleasedEvent, Coffee::KeyTypedEvent

Public Functions

inline KeyCode GetKeyCode() const

Get the key code associated with the event.

Returns:

The key code.

class KeyPressedEvent : public Coffee::KeyEvent
#include <KeyEvent.h>

Event for key press.

Public Functions

inline KeyPressedEvent(const KeyCode keycode, bool isRepeat = false)

Constructor for KeyPressedEvent.

Parameters:
  • keycode – The key code associated with the event.

  • isRepeat – Whether the key press is a repeat.

inline bool IsRepeat() const

Check if the key press is a repeat.

Returns:

True if the key press is a repeat, false otherwise.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

class KeyReleasedEvent : public Coffee::KeyEvent
#include <KeyEvent.h>

Event for key release.

Public Functions

inline KeyReleasedEvent(const KeyCode keycode)

Constructor for KeyReleasedEvent.

Parameters:

keycode – The key code associated with the event.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

class KeyTypedEvent : public Coffee::KeyEvent
#include <KeyEvent.h>

Event for key typing.

Public Functions

inline KeyTypedEvent(const KeyCode keycode)

Constructor for KeyTypedEvent.

Parameters:

keycode – The key code associated with the event.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

class Layer

Subclassed by Coffee::ImGuiLayer

Public Functions

inline Layer(const std::string &name = "Layer")

Constructor for the Layer class.

Parameters:

name – The name of the layer, default is “Layer”.

virtual ~Layer() = default

Virtual destructor for the Layer class.

inline virtual void OnAttach()

Called when the layer is attached.

inline virtual void OnDetach()

Called when the layer is detached.

inline virtual void OnUpdate(float dt)

Called every frame to update the layer.

Parameters:

dt – Delta time since the last frame.

inline virtual void OnImGuiRender()

Called to render ImGui elements.

inline virtual void OnEvent(Event &event)

Called when an event occurs.

Parameters:

event – The event that occurred.

inline const std::string &GetName() const

Gets the name of the layer.

Returns:

The name of the layer.

class LayerStack
#include <LayerStack.h>

Manages a stack of layers and overlays.

Public Functions

LayerStack() = default

Default constructor.

~LayerStack()

Destructor.

void PushLayer(Layer *layer)

Adds a layer to the stack.

Parameters:

layer – Pointer to the layer to be added.

void PushOverlay(Layer *overlay)

Adds an overlay to the stack.

Parameters:

overlay – Pointer to the overlay to be added.

void PopLayer(Layer *layer)

Removes a layer from the stack.

Parameters:

layer – Pointer to the layer to be removed.

void PopOverlay(Layer *overlay)

Removes an overlay from the stack.

Parameters:

overlay – Pointer to the overlay to be removed.

inline std::vector<Layer*>::iterator begin()

Returns an iterator to the beginning of the layer stack.

Returns:

Iterator to the beginning of the layer stack.

inline std::vector<Layer*>::iterator end()

Returns an iterator to the end of the layer stack.

Returns:

Iterator to the end of the layer stack.

inline std::vector<Layer*>::reverse_iterator rbegin()

Returns a reverse iterator to the beginning of the layer stack.

Returns:

Reverse iterator to the beginning of the layer stack.

inline std::vector<Layer*>::reverse_iterator rend()

Returns a reverse iterator to the end of the layer stack.

Returns:

Reverse iterator to the end of the layer stack.

inline std::vector<Layer*>::const_iterator begin() const

Returns a constant iterator to the beginning of the layer stack.

Returns:

Constant iterator to the beginning of the layer stack.

inline std::vector<Layer*>::const_iterator end() const

Returns a constant iterator to the end of the layer stack.

Returns:

Constant iterator to the end of the layer stack.

inline std::vector<Layer*>::const_reverse_iterator rbegin() const

Returns a constant reverse iterator to the beginning of the layer stack.

Returns:

Constant reverse iterator to the beginning of the layer stack.

inline std::vector<Layer*>::const_reverse_iterator rend() const

Returns a constant reverse iterator to the end of the layer stack.

Returns:

Constant reverse iterator to the end of the layer stack.

struct LightComponent
#include <Components.h>

Component representing a light.

Public Types

enum Type

Enum representing the type of light.

Values:

enumerator DirectionalLight

Directional light.

enumerator PointLight

Point light.

enumerator SpotLight

Spot light.

Public Functions

template<class Archive>
inline void serialize(Archive &archive)

Serializes the LightComponent.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

Public Members

glm::vec3 Color = {1.0f, 1.0f, 1.0f}

The color of the light.

glm::vec3 Direction = {0.0f, -1.0f, 0.0f}

The direction of the light.

glm::vec3 Position = {0.0f, 0.0f, 0.0f}

The position of the light.

float Range = 5.0f

The range of the light.

float Attenuation = 1.0f

The attenuation of the light.

float Intensity = 1.0f

The intensity of the light.

float Angle = 45.0f

The angle of the light.

int type = static_cast<int>(Type::DirectionalLight)

The type of the light.

class LinuxSystemInfo : public Coffee::SystemInfo

Public Functions

virtual uint32_t GetPhysicalProcessorCountImpl() const override

Gets the number of physical processors.

Returns:

The number of physical processors.

virtual uint64_t GetAvailableMemoryImpl() const override

Gets the amount of available memory in the system.

Returns:

The amount of available memory in the system.

virtual uint64_t GetUsedMemoryImpl() const override

Gets the amount of memory used in the system.

Returns:

The amount of memory used in the system.

virtual uint64_t GetProcessMemoryUsageImpl() const override

Gets the amount of memory used by the process.

Returns:

The amount of memory used by the process.

class Log
#include <Log.h>

The Log class is responsible for initializing and providing access to the core and client loggers.

Public Static Functions

static void Init()

Initializes the logging system.

static inline std::shared_ptr<spdlog::logger> &GetCoreLogger()

Gets the core logger.

Returns:

A shared pointer to the core logger.

static inline std::shared_ptr<spdlog::logger> &GetClientLogger()

Gets the client logger.

Returns:

A shared pointer to the client logger.

class Material
#include <Material.h>

Class representing a material.

Public Functions

Material()

Default constructor for the Material class.

Material(Ref<Shader> shader)

Constructs a Material with the specified shader.

Parameters:

shader – The shader to be used with the material.

Material(std::string &path)

Constructs a Material from a file path.

Note

This constructor is for future use when the material YAML exists.

Parameters:

path – The file path to the material definition.

Material(MaterialTextures &materialTextures)

Constructs a Material with the specified textures.

Parameters:

materialTextures – The textures to be used with the material.

~Material() = default

Default destructor for the Material class.

void Use()

Uses the material by binding its shader and textures.

inline Ref<Shader> GetShader()

Gets the shader associated with the material.

Returns:

A reference to the shader.

struct MaterialComponent
#include <Components.h>

Component representing a material.

Public Functions

template<class Archive>
inline void serialize(Archive &archive)

Serializes the MaterialComponent.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

Public Members

Ref<Material> material

The material reference.

struct MaterialProperties
#include <Material.h>

Structure representing the properties of a material.

Public Members

glm::vec4 color = glm::vec4(1.0f)

The color of the material.

float metallic = 0.0f

The metallic value of the material.

float roughness = 1.0f

The roughness value of the material.

float ao = 1.0f

The ambient occlusion value of the material.

glm::vec3 emissive = glm::vec3(0.0f)

The emissive value of the material.

struct MaterialRenderSettings
struct MaterialTextureFlags

Public Members

bool hasAlbedo = false

Whether the material has an albedo texture.

bool hasNormal = false

Whether the material has a normal map texture.

bool hasMetallic = false

Whether the material has a metallic texture.

bool hasRoughness = false

Whether the material has a roughness texture.

bool hasAO = false

Whether the material has an ambient occlusion texture.

bool hasEmissive = false

Whether the material has an emissive texture.

struct MaterialTextures
#include <Material.h>

Structure representing the textures used in a material.

Public Members

Ref<Texture> albedo

The albedo texture.

Ref<Texture> normal

The normal map texture.

Ref<Texture> metallic

The metallic texture.

Ref<Texture> roughness

The roughness texture.

Ref<Texture> ao

The ambient occlusion texture.

Ref<Texture> emissive

The emissive texture.

class Mesh
#include <Mesh.h>

Class representing a mesh.

Public Functions

Mesh(const std::vector<uint32_t> &indices, const std::vector<Vertex> &vertices)

Constructs a Mesh with the specified indices and vertices.

Parameters:
  • indices – The indices of the mesh.

  • vertices – The vertices of the mesh.

inline const Ref<VertexArray> &GetVertexArray() const

Gets the vertex array of the mesh.

Returns:

A reference to the vertex array.

inline const Ref<VertexBuffer> &GetVertexBuffer() const

Gets the vertex buffer of the mesh.

Returns:

A reference to the vertex buffer.

inline const Ref<IndexBuffer> &GetIndexBuffer() const

Gets the index buffer of the mesh.

Returns:

A reference to the index buffer.

inline void SetName(const std::string &name)

Sets the name of the mesh.

Parameters:

name – The name of the mesh.

inline const std::string &GetName() const

Gets the name of the mesh.

Returns:

The name of the mesh.

inline void SetMaterial(Ref<Material> &material)

Sets the material of the mesh.

Parameters:

material – A reference to the material.

inline void SetAABB(const AABB aabb)

Sets the axis-aligned bounding box (AABB) of the mesh.

Parameters:

aabb – The axis-aligned bounding box to set.

inline const AABB &GetAABB()

Gets the axis-aligned bounding box (AABB) of the mesh.

Returns:

A reference to the AABB.

inline AABB GetAABB(const glm::mat4 &transform)

Gets the transformed axis-aligned bounding box (AABB) of the mesh.

Parameters:

transform – The transformation matrix.

Returns:

The transformed AABB.

inline OBB GetOBB(const glm::mat4 &transform)

Gets the oriented bounding box (OBB) of the mesh.

Parameters:

transform – The transformation matrix.

Returns:

The OBB.

inline const Ref<Material> &GetMaterial() const

Gets the material of the mesh.

Returns:

A reference to the material.

inline const std::vector<Vertex> &GetVertices() const

Gets the vertices of the mesh.

Returns:

A reference to the vector of vertices.

inline const std::vector<uint32_t> &GetIndices() const

Gets the indices of the mesh.

Returns:

A reference to the vector of indices.

template<class Archive>
inline void save(Archive &archive)

Serializes the mesh to an archive.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

template<class Archive>
inline void load(Archive &archive)

Deserializes the mesh from an archive.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to deserialize from.

struct MeshComponent
#include <Components.h>

Component representing a mesh.

Public Functions

inline const Ref<Mesh> &GetMesh() const

Gets the mesh reference.

Returns:

The mesh reference.

template<class Archive>
inline void save(Archive &archive)

Serializes the MeshComponent.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

template<class Archive>
inline void load(Archive &archive)

Deserializes the MeshComponent.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to deserialize from.

Public Members

Ref<Mesh> mesh

The mesh reference.

bool drawAABB = false

Flag to draw the axis-aligned bounding box (AABB).

class Model : public Coffee::Resource
#include <Model.h>

Class representing a 3D model.

Public Functions

inline Model()

Default constructor for the Model class.

Model(const std::filesystem::path &path)

Constructs a Model from a file path.

Parameters:

filePath – The file path to the model.

inline const std::vector<Ref<Mesh>> &GetMeshes() const

Gets the meshes of the model.

Returns:

A reference to the vector of meshes.

inline void AddMesh(const Ref<Mesh> mesh)

Adds a mesh to the model.

Parameters:

mesh – A reference to the mesh to add.

inline std::string &GetName()

Gets the name of the model.

Returns:

A reference to the name of the model.

inline const Model *GetParent() const

Gets the parent model.

Returns:

A pointer to the parent model.

inline const std::vector<Ref<Model>> GetChildren() const

Gets the children models.

Returns:

A reference to the vector of children models.

inline const glm::mat4 GetTransform() const

Gets the transformation matrix of the model.

Returns:

The transformation matrix.

Public Static Functions

static Ref<Model> Load(const std::filesystem::path &path)

Loads a model from the specified file path.

Parameters:

path – The path to the model file.

class MouseButtonEvent : public Coffee::Event
#include <MouseEvent.h>

Base class for mouse button events.

Subclassed by Coffee::MouseButtonPressedEvent, Coffee::MouseButtonReleasedEvent

Public Functions

inline MouseCode GetMouseButton() const

Get the mouse button associated with the event.

Returns:

The mouse button.

class MouseButtonPressedEvent : public Coffee::MouseButtonEvent
#include <MouseEvent.h>

Event for mouse button press.

Public Functions

inline MouseButtonPressedEvent(const MouseCode button)

Constructor for MouseButtonPressedEvent.

Parameters:

button – The mouse button associated with the event.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

class MouseButtonReleasedEvent : public Coffee::MouseButtonEvent
#include <MouseEvent.h>

Event for mouse button release.

Public Functions

inline MouseButtonReleasedEvent(const MouseCode button)

Constructor for MouseButtonReleasedEvent.

Parameters:

button – The mouse button associated with the event.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

class MouseMovedEvent : public Coffee::Event
#include <MouseEvent.h>

Event for mouse movement.

Public Functions

inline MouseMovedEvent(const float x, const float y)

Constructor for MouseMovedEvent.

Parameters:
  • x – The x-coordinate of the mouse.

  • y – The y-coordinate of the mouse.

inline float GetX() const

Get the x-coordinate of the mouse.

Returns:

The x-coordinate.

inline float GetY() const

Get the y-coordinate of the mouse.

Returns:

The y-coordinate.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

class MouseScrolledEvent : public Coffee::Event
#include <MouseEvent.h>

Event for mouse scrolling.

Public Functions

inline MouseScrolledEvent(const float xOffset, const float yOffset)

Constructor for MouseScrolledEvent.

Parameters:
  • xOffset – The scroll offset along the x-axis.

  • yOffset – The scroll offset along the y-axis.

inline float GetXOffset() const

Get the scroll offset along the x-axis.

Returns:

The x-axis scroll offset.

inline float GetYOffset() const

Get the scroll offset along the y-axis.

Returns:

The y-axis scroll offset.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

struct OBB
#include <Mesh.h>

Structure representing an oriented bounding box (OBB).

Public Functions

inline OBB(const std::array<glm::vec3, 8> &corners)

Constructs an OBB with specified corners.

Parameters:

corners – The corners of the OBB.

inline OBB(const glm::mat4 &transform, const AABB &aabb)

Constructs an OBB from a transformation matrix and an AABB.

Parameters:
  • transform – The transformation matrix.

  • aabb – The axis-aligned bounding box.

Public Members

std::array<glm::vec3, 8> corners

The corners of the OBB.

class PrimitiveMesh
#include <PrimitiveMesh.h>

Class representing different types of primitive meshes.

Public Static Functions

static Ref<Mesh> CreateQuad()

Creates a quad mesh.

Returns:

A reference to the created quad mesh.

static Ref<Mesh> CreateCube(const glm::vec3 &size = {1.0f, 1.0f, 1.0f}, int subdivideW = 0, int subdidiveH = 0, int subdivideD = 0)

Creates a cube mesh.

Creates a cube mesh.

Parameters:
  • size – The size of the cube.

  • subdivideW – Number of subdivisions along the width.

  • subdivideH – Number of subdivisions along the height.

  • subdivideD – Number of subdivisions along the depth.

  • size – The size of the cube.

  • subdivideW – Subdivision parameter for width (currently not functional).

  • subdivideH – Subdivision parameter for height (currently not functional).

  • subdivideD – Subdivision parameter for depth (currently not functional).

Returns:

A reference to the created cube mesh.

Returns:

Ref<Mesh> A reference to the created cube mesh.

static Ref<Mesh> CreateSphere(float radius = 0.5f, float height = 1.0f, int radialSegments = 64, int rings = 32, bool isHemiSphere = false)

Creates a sphere mesh.

Parameters:
  • radius – The radius of the sphere.

  • height – The height of the sphere.

  • radialSegments – Number of radial segments.

  • rings – Number of rings.

  • isHemiSphere – Whether the sphere is a hemisphere.

Returns:

A reference to the created sphere mesh.

static Ref<Mesh> CreatePlane(const glm::vec2 &size = {1.0f, 1.0f}, const glm::vec3 &normal = {0.0f, 1.0f, 0.0f})

Creates a plane mesh.

Parameters:
  • size – The size of the plane.

  • normal – The normal vector of the plane.

Returns:

A reference to the created plane mesh.

static Ref<Mesh> CreateCylinder(float topRadius = 0.5f, float bottomRadius = 0.5f, float height = 1.0f, int radialSegments = 64, int rings = 1, bool capTop = true, bool capBottom = true)

Creates a cylinder mesh.

Parameters:
  • topRadius – The radius of the top of the cylinder.

  • bottomRadius – The radius of the bottom of the cylinder.

  • height – The height of the cylinder.

  • radialSegments – Number of radial segments.

  • rings – Number of rings.

  • capTop – Whether to cap the top of the cylinder.

  • capBottom – Whether to cap the bottom of the cylinder.

Returns:

A reference to the created cylinder mesh.

static Ref<Mesh> CreateCone(float radius = 0.5f, float height = 1.0f, int radialSegments = 64, int rings = 1, bool cap = true)

Creates a cone mesh.

Parameters:
  • radius – The radius of the base of the cone.

  • height – The height of the cone.

  • radialSegments – Number of radial segments.

  • rings – Number of rings.

  • cap – Whether to cap the base of the cone.

Returns:

A reference to the created cone mesh.

static Ref<Mesh> CreateTorus(float innerRadius = 0.5f, float outerRadius = 1.0f, int rings = 64, int ringSegments = 32)

Creates a torus mesh.

Parameters:
  • innerRadius – The inner radius of the torus.

  • outerRadius – The outer radius of the torus.

  • rings – Number of rings.

  • ringSegments – Number of ring segments.

Returns:

A reference to the created torus mesh.

static Ref<Mesh> CreateCapsule(float radius = 0.5f, float height = 2.0f, int radialSegments = 64, int rings = 8)

Creates a capsule mesh.

Parameters:
  • radius – The radius of the capsule.

  • height – The height of the capsule.

  • radialSegments – Number of radial segments.

  • rings – Number of rings.

Returns:

A reference to the created capsule mesh.

class Project
#include <Project.h>

The Project class is responsible for managing project data such as name, directory, and start scene path.

Public Functions

template<class Archive>
inline void serialize(Archive &archive)

Serializes the project data.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

Public Static Functions

static Ref<Project> New(const std::filesystem::path &path)

Creates a new project.

Returns:

A reference to the newly created project.

static Ref<Project> Load(const std::filesystem::path &path)

Loads a project from the specified path.

Parameters:

path – The path to the project file.

Returns:

A reference to the loaded project.

static void SaveActive()

Saves the active project to the specified path.

Parameters:

path – The path to save the project file.

static inline Ref<Project> GetActive()

Gets the active project.

Returns:

A reference to the active project.

static inline const std::filesystem::path &GetProjectDirectory()

Gets the directory of the active project.

Returns:

The path to the project directory.

static inline const std::string &GetProjectName()

Gets the name of the active project.

Returns:

The name of the project.

static inline std::filesystem::path GetCacheDirectory()

Retrieves the cache directory path of the active project.

This static method returns a constant reference to the cache directory path associated with the currently active project.

Returns:

const std::filesystem::path& Reference to the cache directory path.

class Renderer
#include <Renderer.h>

Class representing the 3D renderer.

Public Static Functions

static void Init()

Initializes the renderer.

static void Shutdown()

Shuts down the renderer.

static void BeginScene(EditorCamera &camera)

Begins a new scene with the specified editor camera.

Parameters:

camera – The editor camera.

static void BeginScene(Camera &camera, const glm::mat4 &transform)

Begins a new scene with the specified camera and transform.

Parameters:
  • camera – The camera.

  • transform – The transform matrix.

static void EndScene()

Ends the current scene.

static void BeginOverlay(EditorCamera &camera)

Begins an overlay with the specified editor camera.

Parameters:

camera – The editor camera.

static void EndOverlay()

Ends the current overlay.

static void Submit(const Ref<Shader> &shader, const Ref<VertexArray> &vertexArray, const glm::mat4 &transform = glm::mat4(1.0f), uint32_t entityID = 4294967295)

Submits a draw call with the specified shader, vertex array, and transform.

Parameters:
  • shader – The shader.

  • vertexArray – The vertex array.

  • transform – The transform matrix.

static void Submit(const Ref<Material> &material, const Ref<Mesh> &mesh, const glm::mat4 &transform = glm::mat4(1.0f), uint32_t entityID = 4294967295)

Submits a draw call with the specified material, mesh, and transform.

Parameters:
  • material – The material.

  • mesh – The mesh.

  • transform – The transform matrix.

static void Submit(const LightComponent &light)

Submits a light component.

Parameters:

light – The light component.

static void OnResize(uint32_t width, uint32_t height)

Resizes the renderer to the specified width and height.

Parameters:
  • width – The new width.

  • height – The new height.

static inline const Ref<Texture> &GetRenderTexture()

Gets the render texture.

Returns:

A reference to the render texture.

static inline const Ref<Texture> &GetEntityIDTexture()

Retrieves the texture associated with the entity ID.

This static method returns a reference to the texture that is used to identify entities within the renderer. The texture is stored as a static member of the class.

Returns:

A constant reference to the entity ID texture.

static inline const RendererData &GetData()

Gets the renderer data.

Returns:

A reference to the renderer data.

static inline const RendererStats &GetStats()

Gets the renderer statistics.

Returns:

A reference to the renderer statistics.

static inline RenderSettings &GetRenderSettings()

Gets the render settings.

Returns:

A reference to the render settings.

class RendererAPI
#include <RendererAPI.h>

Class representing the Renderer API.

Public Static Functions

static void Init()

Initializes the Renderer API.

static void SetClearColor(const glm::vec4 &color)

Sets the clear color for the renderer.

Parameters:

color – The clear color as a glm::vec4.

static void Clear()

Clears the current buffer.

static void SetDepthMask(bool enabled)

Enables or disables the depth mask.

Parameters:

enabled – True to enable the depth mask, false to disable it.

static void DrawIndexed(const Ref<VertexArray> &vertexArray)

Draws the indexed vertices from the specified vertex array.

Parameters:

vertexArray – The vertex array containing the vertices to draw.

static void DrawLines(const Ref<VertexArray> &vertexArray, uint32_t vertexCount, float lineWidth = 1.0f)

Draws lines from the specified vertex array.

Parameters:
  • vertexArray – The vertex array containing the vertices to draw.

  • vertexCount – The number of vertices to draw.

  • lineWidth – The width of the lines.

static Scope<RendererAPI> Create()

Creates a new Renderer API instance.

Returns:

A scope pointer to the created Renderer API instance.

struct RendererData
#include <Renderer.h>

Structure containing renderer data.

Public Members

CameraData cameraData

Camera data.

RenderData renderData

Render data.

Ref<UniformBuffer> CameraUniformBuffer

Uniform buffer for camera data.

Ref<UniformBuffer> RenderDataUniformBuffer

Uniform buffer for render data.

Ref<Texture> RenderTexture

Render texture.

struct CameraData
#include <Renderer.h>

Structure containing camera data.

Public Members

glm::mat4 projection

The projection matrix.

glm::mat4 view

The view matrix.

glm::vec3 position

The position of the camera.

struct RenderData
#include <Renderer.h>

Structure containing render data.

Public Members

LightComponent lights[32]

Array of light components.

int lightCount = 0

Number of lights.

struct RendererStats
#include <Renderer.h>

Structure containing renderer statistics.

Public Members

uint32_t DrawCalls = 0

Number of draw calls.

uint32_t VertexCount = 0

Number of vertices.

uint32_t IndexCount = 0

Number of indices.

struct RenderSettings
#include <Renderer.h>

Structure containing render settings.

Public Members

bool PostProcessing = true

Enable or disable post-processing.

bool SSAO = false

Enable or disable SSAO.

bool Bloom = false

Enable or disable bloom.

bool FXAA = false

Enable or disable FXAA.

float Exposure = 1.0f

Exposure value.

class Resource
#include <Resource.h>

Base class for different types of resources in the CoffeeEngine.

Subclassed by Coffee::Model, Coffee::Shader, Coffee::Texture

Public Functions

inline Resource(ResourceType type = ResourceType::Unknown)

Constructor that initializes the resource with a type.

Parameters:

type – The type of the resource.

virtual ~Resource() = default

Virtual destructor.

inline const std::string &GetName() const

Gets the name of the resource.

Returns:

The name of the resource.

inline const std::filesystem::path &GetPath()

Gets the file path of the resource.

Returns:

The file path of the resource.

inline ResourceType GetType() const

Gets the type of the resource.

Returns:

The type of the resource.

class ResourceImporter
#include <ResourceImporter.h>

Handles the import of resources such as textures.

Public Functions

Ref<Texture> ImportTexture(const std::filesystem::path &path, bool srgb, bool cache)

Imports a texture from a given file path.

Parameters:
  • path – The file path of the texture to import.

  • srgb – Whether the texture should be imported in sRGB format.

  • cache – Whether the texture should be cached.

Returns:

A reference to the imported texture.

class ResourceLoader
#include <ResourceLoader.h>

Loads resources such as textures and models for the CoffeeEngine.

Public Static Functions

static void LoadDirectory(const std::filesystem::path &directory)

Loads all resources from a directory.

Parameters:

directory – The directory to load resources from.

static void LoadFile(const std::filesystem::path &path)

Loads a single resource file.

Parameters:

path – The file path of the resource to load.

static Ref<Texture> LoadTexture(const std::filesystem::path &path, bool srgb = true, bool cache = true)

Loads a texture from a file.

Parameters:
  • path – The file path of the texture to load.

  • srgb – Whether the texture should be loaded in sRGB format.

  • cache – Whether the texture should be cached.

Returns:

A reference to the loaded texture.

static Ref<Model> LoadModel(const std::filesystem::path &path, bool cache = true)

Loads a model from a file.

Parameters:
  • path – The file path of the model to load.

  • cache – Whether the model should be cached.

Returns:

A reference to the loaded model.

class ResourceRegistry
#include <ResourceRegistry.h>

Manages the registration and retrieval of resources.

Public Static Functions

static inline void Add(const std::string &name, Ref<Resource> resource)

Adds a resource to the registry.

Parameters:
  • name – The name of the resource.

  • resource – A reference to the resource to add.

template<typename T>
static inline Ref<T> Get(const std::string &name)

Retrieves a resource from the registry.

Template Parameters:

T – The type of the resource.

Parameters:

name – The name of the resource.

Returns:

A reference to the resource, or nullptr if not found.

static inline bool Exists(const std::string &name)

Checks if a resource exists in the registry.

Parameters:

name – The name of the resource.

Returns:

True if the resource exists, false otherwise.

static inline void Clear()

Clears all resources from the registry.

static inline const std::unordered_map<std::string, Ref<Resource>> &GetResourceRegistry()

Gets the entire resource registry.

Returns:

A constant reference to the resource registry.

class ResourceSaver
#include <ResourceSaver.h>

Handles saving resources to disk and cache.

Public Static Functions

static void Save(const std::filesystem::path &path, const Ref<Resource> &resource)

Saves a resource to a specified path on disk.

Parameters:
  • path – The file path where the resource will be saved.

  • resource – A reference to the resource to save.

static void SaveToCache(const Ref<Resource> &resource)

Saves a resource to the project cache.

Parameters:

resource – A reference to the resource to save to cache.

class Scene
#include <Scene.h>

Class representing a scene.

Public Functions

Scene()

Constructor for Scene.

~Scene() = default

Default destructor.

Entity CreateEntity(const std::string &name = std::string())

Create an entity in the scene.

Parameters:

name – The name of the entity.

Returns:

The created entity.

void DestroyEntity(Entity entity)

Destroy an entity in the scene.

Parameters:

entity – The entity to destroy.

void OnInit()

Initialize the scene.

void OnUpdateEditor(EditorCamera &camera, float dt)

Update the scene in editor mode.

Parameters:
  • camera – The editor camera.

  • dt – The delta time.

void OnUpdateRuntime(float dt)

Update the scene in runtime mode.

Parameters:

dt – The delta time.

void OnEvent(Event &e)

Handle an event in the scene.

Parameters:

e – The event.

void OnExit()

Exit the scene.

Public Static Functions

static Ref<Scene> Load(const std::filesystem::path &path)

Load a scene from a file.

Parameters:

path – The path to the file.

Returns:

The loaded scene.

static void Save(const std::filesystem::path &path, Ref<Scene> scene)

Save a scene to a file.

Parameters:
  • path – The path to the file.

  • scene – The scene to save.

class SceneCamera : public Coffee::Camera
#include <SceneCamera.h>

Camera class for the scene.

Public Functions

SceneCamera()

Constructor for SceneCamera.

~SceneCamera() = default

Default destructor.

class SceneTree
#include <SceneTree.h>

Class for managing the scene tree.

Public Functions

SceneTree(Scene *scene)

Constructor for SceneTree.

Parameters:

scene – The scene context.

~SceneTree() = default

Default destructor.

void Update()

Update the scene tree.

void UpdateTransform(entt::entity entity)

Update the transform of an entity.

Parameters:

entity – The entity to update.

class Shader : public Coffee::Resource
#include <Shader.h>

Class representing a shader program.

Public Functions

Shader(const std::string &vertexPath, const std::string &fragmentPath)

Constructs a Shader with the specified vertex and fragment shader paths.

Parameters:
  • vertexPath – The file path to the vertex shader.

  • fragmentPath – The file path to the fragment shader.

virtual ~Shader()

Destructor for the Shader class.

void Bind()

Binds the shader program for use.

void Unbind()

Unbinds the shader program.

void setBool(const std::string &name, bool value) const

Sets a boolean uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • value – The boolean value to set.

void setInt(const std::string &name, int value) const

Sets an integer uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • value – The integer value to set.

void setFloat(const std::string &name, float value) const

Sets a float uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • value – The float value to set.

void setVec2(const std::string &name, const glm::vec2 &value) const

Sets a vec2 uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • value – The vec2 value to set.

void setVec3(const std::string &name, const glm::vec3 &value) const

Sets a vec3 uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • value – The vec3 value to set.

void setVec4(const std::string &name, const glm::vec4 &value) const

Sets a vec4 uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • value – The vec4 value to set.

void setMat2(const std::string &name, const glm::mat2 &mat) const

Sets a mat2 uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • mat – The mat2 value to set.

void setMat3(const std::string &name, const glm::mat3 &mat) const

Sets a mat3 uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • mat – The mat3 value to set.

void setMat4(const std::string &name, const glm::mat4 &mat) const

Sets a mat4 uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • mat – The mat4 value to set.

void checkCompileErrors(GLuint shader, std::string type)

Checks for compile errors in the shader.

Parameters:
  • shader – The shader ID.

  • type – The type of the shader.

Public Static Functions

static Ref<Shader> Create(const std::string &vertexPath, const std::string &fragmentPath)

Creates a shader from the specified vertex and fragment shader paths.

Parameters:
  • vertexPath – The file path to the vertex shader.

  • fragmentPath – The file path to the fragment shader.

Returns:

A reference to the created shader.

class Stopwatch
#include <Stopwatch.h>

A class to measure elapsed time.

The Stopwatch class provides functionality to start, stop, reset, and retrieve the elapsed time. It supports both regular and high-precision timing.

Public Functions

Stopwatch()

Constructs a new Stopwatch object.

void Start()

Starts the stopwatch.

If the stopwatch is already running, this method has no effect.

void Stop()

Stops the stopwatch.

If the stopwatch is not running, this method has no effect.

void Reset()

Resets the stopwatch.

This method stops the stopwatch and resets the elapsed time to zero.

float GetElapsedTime() const

Gets the elapsed time in seconds.

Returns:

The elapsed time in seconds.

double GetPreciseElapsedTime() const

Gets the precise elapsed time in seconds.

This method uses SDL_GetPerformanceCounter for higher precision.

Returns:

The precise elapsed time in seconds.

class SystemInfo

Subclassed by Coffee::LinuxSystemInfo, Coffee::WindowsSystemInfo

Public Functions

virtual uint32_t GetPhysicalProcessorCountImpl() const = 0

Gets the number of physical processors.

Returns:

The number of physical processors.

virtual uint64_t GetAvailableMemoryImpl() const = 0

Gets the amount of available memory in the system.

Returns:

The amount of available memory in the system.

virtual uint64_t GetUsedMemoryImpl() const = 0

Gets the amount of memory used in the system.

Returns:

The amount of memory used in the system.

virtual uint64_t GetProcessMemoryUsageImpl() const = 0

Gets the amount of memory used by the process.

Returns:

The amount of memory used by the process.

Public Static Functions

static uint32_t GetLogicalProcessorCount()

Gets the number of logical processors.

static uint32_t GetPhysicalProcessorCount()

Gets the number of physical processors.

static uint64_t GetTotalMemory()

Gets the total memory in the system.

static uint64_t GetAvailableMemory()

Gets the available memory in the system.

static uint64_t GetUsedMemory()

Gets the used memory in the system.

static uint64_t GetProcessMemoryUsage()

Gets the memory used by the process.

struct TagComponent
#include <Components.h>

Component representing a tag.

Public Functions

template<class Archive>
inline void serialize(Archive &archive)

Serializes the TagComponent.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

Public Members

std::string Tag

The tag string.

class Texture : public Coffee::Resource
#include <Texture.h>

Class representing a texture.

Public Functions

Texture(const TextureProperties &properties)

Constructs a Texture with the specified properties.

Parameters:

properties – The properties of the texture.

Texture(uint32_t width, uint32_t height, ImageFormat imageFormat)

Constructs a Texture with the specified width, height, and image format.

Parameters:
  • width – The width of the texture.

  • height – The height of the texture.

  • imageFormat – The format of the image.

Texture(const std::filesystem::path &path, bool srgb = true)

Constructs a Texture from a file path.

Parameters:
  • path – The file path to the texture.

  • srgb – Whether the texture is in sRGB format.

~Texture()

Destructor for the Texture class.

void Bind(uint32_t slot)

Binds the texture to the specified slot.

Parameters:

slot – The slot to bind the texture to.

void Resize(uint32_t width, uint32_t height)

Resizes the texture to the specified width and height.

Parameters:
  • width – The new width of the texture.

  • height – The new height of the texture.

inline std::pair<uint32_t, uint32_t> GetSize()

Gets the size of the texture.

Returns:

A pair containing the width and height of the texture.

inline uint32_t GetWidth()

Gets the width of the texture.

Returns:

The width of the texture.

inline uint32_t GetHeight()

Gets the height of the texture.

Returns:

The height of the texture.

inline uint32_t GetID()

Gets the ID of the texture.

Returns:

The ID of the texture.

inline ImageFormat GetImageFormat()

Gets the image format of the texture.

Returns:

The image format of the texture.

Public Static Functions

static Ref<Texture> Load(const std::filesystem::path &path, bool srgb = true)

Loads a texture from a file path.

Parameters:
  • path – The file path to the texture.

  • srgb – Whether the texture is in sRGB format.

Returns:

A reference to the loaded texture.

static Ref<Texture> Create(uint32_t width, uint32_t height, ImageFormat format)

Creates a texture with the specified width, height, and format.

Parameters:
  • width – The width of the texture.

  • height – The height of the texture.

  • format – The format of the texture.

Returns:

A reference to the created texture.

struct TextureProperties
#include <Texture.h>

Structure representing properties of a texture.

Public Members

ImageFormat Format

The format of the image.

uint32_t Height

The width and height of the texture.

bool GenerateMipmaps = true

Whether to generate mipmaps.

bool srgb = true

Whether the texture is in sRGB format.

class Timer
#include <Timer.h>

A class that represents a timer with various functionalities.

Public Functions

inline Timer()

Default constructor.

Timer(double waitTime, bool autoStart, bool oneShot, TimerCallback callback)

Parameterized constructor.

Parameters:
  • waitTime – The time to wait before the timer triggers.

  • autoStart – Whether the timer should start automatically.

  • oneShot – Whether the timer should trigger only once.

  • callback – The callback function to be called when the timer triggers.

void Start(double waitTime)

Starts the timer with a specified wait time.

Parameters:

waitTime – The time to wait before the timer triggers.

void Stop()

Stops the timer.

void setWaitTime(double waitTime)

Sets the wait time for the timer.

Parameters:

waitTime – The time to wait before the timer triggers.

inline double getWaitTime() const

Gets the wait time of the timer.

Returns:

The time to wait before the timer triggers.

inline void setOneShot(bool oneShot)

Sets whether the timer should trigger only once.

Parameters:

oneShot – Whether the timer should trigger only once.

inline bool isOneShot() const

Checks if the timer is set to trigger only once.

Returns:

True if the timer is set to trigger only once, false otherwise.

inline void setAutoStart(bool autoStart)

Sets whether the timer should start automatically.

Parameters:

autoStart – Whether the timer should start automatically.

inline bool isAutoStart() const

Checks if the timer is set to start automatically.

Returns:

True if the timer is set to start automatically, false otherwise.

void setPaused(bool paused)

Sets whether the timer is paused.

Parameters:

paused – Whether the timer is paused.

inline bool isPaused() const

Checks if the timer is paused.

Returns:

True if the timer is paused, false otherwise.

void isStopped()

Checks if the timer is stopped.

inline double GetTimeLeft() const

Gets the remaining time before the timer triggers.

Returns:

The remaining time before the timer triggers.

inline void SetCallback(TimerCallback callback)

Sets the callback function to be called when the timer triggers.

Parameters:

callback – The callback function.

inline TimerCallback GetCallback() const

Gets the callback function to be called when the timer triggers.

Returns:

The callback function.

struct TransformComponent
#include <Components.h>

Component representing a transform.

Public Functions

inline glm::mat4 GetLocalTransform() const

Gets the local transformation matrix.

Returns:

The local transformation matrix.

inline void SetLocalTransform(const glm::mat4 &transform)

Sets the local transformation matrix.

Parameters:

transform – The transformation matrix to set.

inline const glm::mat4 &GetWorldTransform() const

Gets the world transformation matrix.

Returns:

The world transformation matrix.

inline void SetWorldTransform(const glm::mat4 &transform)

Sets the world transformation matrix.

Parameters:

transform – The transformation matrix to set.

template<class Archive>
inline void serialize(Archive &archive)

Serializes the TransformComponent.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

Public Members

glm::vec3 Position = {0.0f, 0.0f, 0.0f}

The position vector.

glm::vec3 Rotation = {0.0f, 0.0f, 0.0f}

The rotation vector.

glm::vec3 Scale = {1.0f, 1.0f, 1.0f}

The scale vector.

class UniformBuffer
#include <UniformBuffer.h>

Class representing a uniform buffer.

Public Functions

UniformBuffer(uint32_t size, uint32_t binding)

Constructs a UniformBuffer with the specified size and binding.

Parameters:
  • size – The size of the buffer.

  • binding – The binding point of the buffer.

virtual ~UniformBuffer()

Destructor for the UniformBuffer class.

void SetData(const void *data, uint32_t size, uint32_t offset = 0)

Sets the data of the uniform buffer.

Parameters:
  • data – A pointer to the data to set.

  • size – The size of the data.

  • offset – The offset in the buffer to set the data.

Public Static Functions

static Ref<UniformBuffer> Create(uint32_t size, uint32_t binding)

Creates a uniform buffer with the specified size and binding.

Parameters:
  • size – The size of the buffer.

  • binding – The binding point of the buffer.

Returns:

A reference to the created uniform buffer.

struct Vertex
#include <Mesh.h>

Structure representing a vertex in a mesh.

Public Members

glm::vec3 Position = glm::vec3(0.0f)

The position of the vertex.

glm::vec2 TexCoords = glm::vec2(0.0f)

The texture coordinates of the vertex.

glm::vec3 Normals = glm::vec3(0.0f)

The normal vector of the vertex.

glm::vec3 Tangent = glm::vec3(0.0f)

The tangent vector of the vertex.

glm::vec3 Bitangent = glm::vec3(0.0f)

The bitangent vector of the vertex.

class VertexArray
#include <VertexArray.h>

Class representing a vertex array.

Public Functions

VertexArray()

Constructs a VertexArray.

virtual ~VertexArray()

Destructor for the VertexArray class.

void Bind()

Binds the vertex array.

void Unbind()

Unbinds the vertex array.

void AddVertexBuffer(const Ref<VertexBuffer> &vertexBuffer)

Adds a vertex buffer to the vertex array.

Parameters:

vertexBuffer – A reference to the vertex buffer to add.

void SetIndexBuffer(const Ref<IndexBuffer> &indexBuffer)

Sets the index buffer for the vertex array.

Parameters:

indexBuffer – A reference to the index buffer to set.

inline const std::vector<Ref<VertexBuffer>> &GetVertexBuffers() const

Gets the vertex buffers of the vertex array.

Returns:

A constant reference to the vector of vertex buffers.

inline const Ref<IndexBuffer> &GetIndexBuffer() const

Gets the index buffer of the vertex array.

Returns:

A constant reference to the index buffer.

Public Static Functions

static Ref<VertexArray> Create()

Creates a vertex array.

Returns:

A reference to the created vertex array.

class VertexBuffer
#include <Buffer.h>

Class representing a vertex buffer.

Public Functions

VertexBuffer(uint32_t size)

Constructs a VertexBuffer with the specified size.

Parameters:

size – The size of the buffer.

VertexBuffer(float *vertices, uint32_t size)

Constructs a VertexBuffer with the specified vertices and size.

Parameters:
  • vertices – The vertex data.

  • size – The size of the buffer.

virtual ~VertexBuffer()

Destroys the VertexBuffer.

void Bind()

Binds the vertex buffer.

void Unbind()

Unbinds the vertex buffer.

void SetData(void *data, uint32_t size)

Sets the data of the vertex buffer.

Parameters:
  • data – The data to set.

  • size – The size of the data.

inline const BufferLayout &GetLayout() const

Returns the layout of the vertex buffer.

Returns:

The buffer layout.

inline void SetLayout(const BufferLayout &layout)

Sets the layout of the vertex buffer.

Parameters:

layout – The buffer layout.

Public Static Functions

static Ref<VertexBuffer> Create(uint32_t size)

Creates a vertex buffer with the specified size.

Parameters:

size – The size of the buffer.

Returns:

A reference to the created vertex buffer.

static Ref<VertexBuffer> Create(float *vertices, uint32_t size)

Creates a vertex buffer with the specified vertices and size.

Parameters:
  • vertices – The vertex data.

  • size – The size of the buffer.

Returns:

A reference to the created vertex buffer.

class Window
#include <Window.h>

The Window class is responsible for managing the window and its properties.

Public Functions

Window(const WindowProps &props)

Constructs a Window object with the specified properties.

Parameters:

props – The properties of the window.

virtual ~Window()

Destroys the Window object.

void OnUpdate()

Updates the window.

inline unsigned int GetWidth() const

Gets the width of the window.

Returns:

The width of the window.

inline unsigned int GetHeight() const

Gets the height of the window.

Returns:

The height of the window.

void SetVSync(bool enabled)

Enables or disables VSync.

Parameters:

enabled – True to enable VSync, false to disable.

bool IsVSync() const

Checks if VSync is enabled.

Returns:

True if VSync is enabled, false otherwise.

void SetTitle(const std::string &title)

Sets the title of the window.

Parameters:

title – The new title of the window.

inline const std::string &GetTitle() const

Gets the title of the window.

Returns:

The title of the window.

void SetIcon(const std::string &path)

Sets the icon of the window.

Parameters:

path – The path to the icon file.

inline virtual void *GetNativeWindow() const

Gets the native window handle.

Returns:

A pointer to the native window.

Public Static Functions

static inline Scope<Window> Create(const WindowProps &props = WindowProps())

Creates a window with the specified properties.

Parameters:

props – The properties of the window.

Returns:

A scoped pointer to the created window.

class WindowCloseEvent : public Coffee::Event
#include <ApplicationEvent.h>

Event for window close.

struct WindowProps
#include <Window.h>

Structure to hold window properties such as title, width, and height.

Public Functions

inline WindowProps(const std::string &title = "Coffee Engine", uint32_t width = 1600, uint32_t height = 900)

Constructs WindowProps with default or specified values.

Parameters:
  • title – The title of the window.

  • width – The width of the window.

  • height – The height of the window.

Public Members

std::string Title

The title of the window.

uint32_t Width

The width of the window.

uint32_t Height

The height of the window.

class WindowResizeEvent : public Coffee::Event
#include <ApplicationEvent.h>

Event for window resize.

Public Functions

inline unsigned int GetWidth() const

Get the width of the window.

Returns:

The width of the window.

inline unsigned int GetHeight() const

Get the height of the window.

Returns:

The height of the window.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

class WindowsSystemInfo : public Coffee::SystemInfo

Public Functions

virtual uint32_t GetPhysicalProcessorCountImpl() const override

Gets the number of physical processors.

Returns:

The number of physical processors.

virtual uint64_t GetAvailableMemoryImpl() const override

Gets the amount of available memory in the system.

Returns:

The amount of available memory in the system.

virtual uint64_t GetUsedMemoryImpl() const override

Gets the amount of memory used in the system.

Returns:

The amount of memory used in the system.

virtual uint64_t GetProcessMemoryUsageImpl() const override

Gets the amount of memory used by the process.

Returns:

The amount of memory used by the process.

namespace Key

Enums

Values:

enumerator UNKNOWN
enumerator A
enumerator B
enumerator C
enumerator D
enumerator E
enumerator F
enumerator G
enumerator H
enumerator I
enumerator J
enumerator K
enumerator L
enumerator M
enumerator N
enumerator O
enumerator P
enumerator Q
enumerator R
enumerator S
enumerator T
enumerator U
enumerator V
enumerator W
enumerator X
enumerator Y
enumerator Z
enumerator D1
enumerator D2
enumerator D3
enumerator D4
enumerator D5
enumerator D6
enumerator D7
enumerator D8
enumerator D9
enumerator D0
enumerator RETURN
enumerator ESCAPE
enumerator BACKSPACE
enumerator TAB
enumerator SPACE
enumerator MINUS
enumerator EQUALS
enumerator LEFTBRACKET
enumerator RIGHTBRACKET
enumerator BACKSLASH

Located at the lower left of the return key on ISO keyboards and at the right end of the QWERTY row on ANSI keyboards. Produces REVERSE SOLIDUS (backslash) and VERTICAL LINE in a US layout, REVERSE SOLIDUS and VERTICAL LINE in a UK Mac layout, NUMBER SIGN and TILDE in a UK Windows layout, DOLLAR SIGN and POUND SIGN in a Swiss German layout, NUMBER SIGN and APOSTROPHE in a German layout, GRAVE ACCENT and POUND SIGN in a French Mac layout, and ASTERISK and MICRO SIGN in a French Windows layout.

enumerator NONUSHASH

ISO USB keyboards actually use this code instead of 49 for the same key, but all OSes I’ve seen treat the two codes identically. So, as an implementor, unless your keyboard generates both of those codes and your OS treats them differently, you should generate BACKSLASH instead of this code. As a user, you should not rely on this code because SDL will never generate it with most (all?) keyboards.

enumerator SEMICOLON
enumerator APOSTROPHE
enumerator GRAVE

Located in the top left corner (on both ANSI and ISO keyboards). Produces GRAVE ACCENT and TILDE in a US Windows layout and in US and UK Mac layouts on ANSI keyboards, GRAVE ACCENT and NOT SIGN in a UK Windows layout, SECTION SIGN and PLUS-MINUS SIGN in US and UK Mac layouts on ISO keyboards, SECTION SIGN and DEGREE SIGN in a Swiss German layout (Mac: only on ISO keyboards), CIRCUMFLEX ACCENT and DEGREE SIGN in a German layout (Mac: only on ISO keyboards), SUPERSCRIPT TWO and TILDE in a French Windows layout, COMMERCIAL AT and NUMBER SIGN in a French Mac layout on ISO keyboards, and LESS-THAN SIGN and GREATER-THAN SIGN in a Swiss German, German, or French Mac layout on ANSI keyboards.

enumerator COMMA
enumerator PERIOD
enumerator SLASH
enumerator CAPSLOCK
enumerator F1
enumerator F2
enumerator F3
enumerator F4
enumerator F5
enumerator F6
enumerator F7
enumerator F8
enumerator F9
enumerator F10
enumerator F11
enumerator F12
enumerator PRINTSCREEN
enumerator SCROLLLOCK
enumerator PAUSE
enumerator INSERT

insert on PC, help on some Mac keyboards (but does send code 73, not 117)

enumerator HOME
enumerator PAGEUP
enumerator DELETE
enumerator END
enumerator PAGEDOWN
enumerator RIGHT
enumerator LEFT
enumerator DOWN
enumerator UP
enumerator NUMLOCKCLEAR

num lock on PC, clear on Mac keyboards

enumerator KP_DIVIDE
enumerator KP_MULTIPLY
enumerator KP_MINUS
enumerator KP_PLUS
enumerator KP_ENTER
enumerator KP_1
enumerator KP_2
enumerator KP_3
enumerator KP_4
enumerator KP_5
enumerator KP_6
enumerator KP_7
enumerator KP_8
enumerator KP_9
enumerator KP_0
enumerator KP_PERIOD
enumerator NONUSBACKSLASH

This is the additional key that ISO keyboards have over ANSI ones, located between left shift and Y. Produces GRAVE ACCENT and TILDE in a US or UK Mac layout, REVERSE SOLIDUS (backslash) and VERTICAL LINE in a US or UK Windows layout, and LESS-THAN SIGN and GREATER-THAN SIGN in a Swiss German, German, or French layout.

enumerator APPLICATION

windows contextual menu, compose

enumerator POWER

The USB document says this is a status flag, not a physical key - but some Mac keyboards do have a power key.

enumerator KP_EQUALS
enumerator F13
enumerator F14
enumerator F15
enumerator F16
enumerator F17
enumerator F18
enumerator F19
enumerator F20
enumerator F21
enumerator F22
enumerator F23
enumerator F24
enumerator EXECUTE
enumerator HELP

AL Integrated Help Center

enumerator MENU

Menu (show menu)

enumerator SELECT
enumerator STOP

AC Stop

enumerator AGAIN

AC Redo/Repeat

enumerator UNDO

AC Undo

enumerator CUT

AC Cut

enumerator COPY

AC Copy

enumerator PASTE

AC Paste

enumerator FIND

AC Find

enumerator MUTE
enumerator VOLUMEUP
enumerator VOLUMEDOWN
enumerator KP_COMMA
enumerator KP_EQUALSAS400
enumerator INTERNATIONAL1

used on Asian keyboards, see footnotes in USB doc

enumerator INTERNATIONAL2
enumerator INTERNATIONAL3

Yen

enumerator INTERNATIONAL4
enumerator INTERNATIONAL5
enumerator INTERNATIONAL6
enumerator INTERNATIONAL7
enumerator INTERNATIONAL8
enumerator INTERNATIONAL9
enumerator LANG1

Hangul/English toggle

enumerator LANG2

Hanja conversion

enumerator LANG3

Katakana

enumerator LANG4

Hiragana

enumerator LANG5

Zenkaku/Hankaku

enumerator LANG6

reserved

enumerator LANG7

reserved

enumerator LANG8

reserved

enumerator LANG9

reserved

enumerator ALTERASE

Erase-Eaze

enumerator SYSREQ
enumerator CANCEL

AC Cancel

enumerator CLEAR
enumerator PRIOR
enumerator RETURN2
enumerator SEPARATOR
enumerator OUT
enumerator OPER
enumerator CLEARAGAIN
enumerator CRSEL
enumerator EXSEL
enumerator KP_00
enumerator KP_000
enumerator THOUSANDSSEPARATOR
enumerator DECIMALSEPARATOR
enumerator CURRENCYUNIT
enumerator CURRENCYSUBUNIT
enumerator KP_LEFTPAREN
enumerator KP_RIGHTPAREN
enumerator KP_LEFTBRACE
enumerator KP_RIGHTBRACE
enumerator KP_TAB
enumerator KP_BACKSPACE
enumerator KP_A
enumerator KP_B
enumerator KP_C
enumerator KP_D
enumerator KP_E
enumerator KP_F
enumerator KP_XOR
enumerator KP_POWER
enumerator KP_PERCENT
enumerator KP_LESS
enumerator KP_GREATER
enumerator KP_AMPERSAND
enumerator KP_DBLAMPERSAND
enumerator KP_VERTICALBAR
enumerator KP_DBLVERTICALBAR
enumerator KP_COLON
enumerator KP_HASH
enumerator KP_SPACE
enumerator KP_AT
enumerator KP_EXCLAM
enumerator KP_MEMSTORE
enumerator KP_MEMRECALL
enumerator KP_MEMCLEAR
enumerator KP_MEMADD
enumerator KP_MEMSUBTRACT
enumerator KP_MEMMULTIPLY
enumerator KP_MEMDIVIDE
enumerator KP_PLUSMINUS
enumerator KP_CLEAR
enumerator KP_CLEARENTRY
enumerator KP_BINARY
enumerator KP_OCTAL
enumerator KP_DECIMAL
enumerator KP_HEXADECIMAL
enumerator LCTRL
enumerator LSHIFT
enumerator LALT

alt, option

enumerator LGUI

windows, command (apple), meta

enumerator RCTRL
enumerator RSHIFT
enumerator RALT

alt gr, option

enumerator RGUI

windows, command (apple), meta

enumerator MODE

I’m not sure if this is really not covered by any of the above, but since there’s a special SDL_KMOD_MODE for it I’m adding it here

enumerator SLEEP

Sleep

enumerator WAKE

Wake

enumerator CHANNEL_INCREMENT

Channel Increment

enumerator CHANNEL_DECREMENT

Channel Decrement

enumerator MEDIA_PLAY

Play

enumerator MEDIA_PAUSE

Pause

enumerator MEDIA_RECORD

Record

enumerator MEDIA_FAST_FORWARD

Fast Forward

enumerator MEDIA_REWIND

Rewind

enumerator MEDIA_NEXT_TRACK

Next Track

enumerator MEDIA_PREVIOUS_TRACK

Previous Track

enumerator MEDIA_STOP

Stop

enumerator MEDIA_EJECT

Eject

enumerator MEDIA_PLAY_PAUSE

Play / Pause

enumerator MEDIA_SELECT
enumerator AC_NEW

AC New

enumerator AC_OPEN

AC Open

enumerator AC_CLOSE

AC Close

enumerator AC_EXIT

AC Exit

enumerator AC_SAVE

AC Save

enumerator AC_PRINT

AC Print

enumerator AC_PROPERTIES

AC Properties

enumerator AC_SEARCH

AC Search

enumerator AC_HOME

AC Home

enumerator AC_BACK

AC Back

enumerator AC_FORWARD

AC Forward

enumerator AC_STOP

AC Stop

enumerator AC_REFRESH

AC Refresh

enumerator AC_BOOKMARKS

AC Bookmarks

enumerator SOFTLEFT

Usually situated below the display on phones and used as a multi-function feature key for selecting a software defined function shown on the bottom left of the display.

enumerator SOFTRIGHT

Usually situated below the display on phones and used as a multi-function feature key for selecting a software defined function shown on the bottom right of the display.

enumerator CALL

Used for accepting phone calls.

enumerator ENDCALL

Used for rejecting phone calls.

enumerator RESERVED

400-500 reserved for dynamic keycodes

enumerator COUNT

not a key, just marks the number of scancodes for array bounds

namespace Mouse

Enums

Values:

enumerator BUTTON_LEFT

Left mouse button.

enumerator BUTTON_MIDDLE

Middle mouse button.

enumerator BUTTON_RIGHT

Right mouse button.

enumerator BUTTON_X1

Extra mouse button 1.

enumerator BUTTON_X2

Extra mouse button 2.