Shkyera Engine
Easy to use, game engine for Python
Events.hpp
Go to the documentation of this file.
1 
7 #pragma once
8 
9 #include <pybind11/embed.h>
10 #include <pybind11/pybind11.h>
11 #include <pybind11/stl.h>
12 
13 #include "renderer/Renderer.hpp"
14 
15 namespace py = pybind11;
16 
17 namespace shkyera::Python {
18 
22 enum Event : int {
27 
32 
34 };
35 
42 template <typename T> std::vector<T> parsePayload(py::list payload);
43 
50 template <Event event> void processEvent(py::list payload);
51 
57 void setRenderer(std::shared_ptr<Renderer> renderer);
58 
59 } // namespace shkyera::Python
Definition: Events.cpp:7
std::vector< T > parsePayload(py::list payload)
Template function to parse a payload from a Python list into a C++ vector.
Definition: Events.cpp:13
Event
Enum representing different types of events that can be processed in Python.
Definition: Events.hpp:22
@ LOG_SUCCESS
Log a success message.
Definition: Events.hpp:25
@ DRAW_CLEAR
Clear the renderer.
Definition: Events.hpp:31
@ DRAW_RECTANGLE
Draw a rectangle using the renderer.
Definition: Events.hpp:30
@ DRAW_LINE
Draw a line using the renderer.
Definition: Events.hpp:28
@ LOG_INFO
Log an informational message.
Definition: Events.hpp:23
@ DRAW_CIRCLE
Draw a circle using the renderer.
Definition: Events.hpp:29
@ LOG_VERBOSE
Log a verbose message.
Definition: Events.hpp:26
@ TOTAL_EVENTS
The total number of events.
Definition: Events.hpp:33
@ LOG_ERROR
Log an error message.
Definition: Events.hpp:24
void processEvent(py::list payload)
Function to process an event of a specific type.
Definition: Events.cpp:28
void setRenderer(std::shared_ptr< Renderer > renderer)
Set the renderer to be used for drawing in Python.
Definition: Events.cpp:11