Shkyera Engine
Easy to use, game engine for Python
|
Typedefs | |
typedef void(* | eventHandler) (py::list) |
Enumerations | |
enum | Event : int { LOG_INFO , LOG_ERROR , LOG_SUCCESS , LOG_VERBOSE , DRAW_LINE , DRAW_CIRCLE , DRAW_RECTANGLE , DRAW_CLEAR , TOTAL_EVENTS } |
Enum representing different types of events that can be processed in Python. More... | |
enum | PYTHON_TYPE : int { INT = 0 , FLOAT = 1 , STRING = 2 , TOTAL_TYPES = 3 } |
Enum representing different types that can be used in Python. More... | |
Functions | |
void | setRenderer (std::shared_ptr< Renderer > renderer) |
Set the renderer to be used for drawing in Python. More... | |
template<typename T > | |
std::vector< T > | parsePayload (py::list payload) |
Template function to parse a payload from a Python list into a C++ vector. More... | |
template<Event event> | |
void | processEvent (py::list payload) |
Function to process an event of a specific type. More... | |
template<> | |
void | processEvent< LOG_INFO > (py::list payload) |
template<> | |
void | processEvent< LOG_ERROR > (py::list payload) |
template<> | |
void | processEvent< LOG_SUCCESS > (py::list payload) |
template<> | |
void | processEvent< LOG_VERBOSE > (py::list payload) |
template<> | |
void | processEvent< DRAW_LINE > (py::list payload) |
template<> | |
void | processEvent< DRAW_CIRCLE > (py::list payload) |
template<> | |
void | processEvent< DRAW_RECTANGLE > (py::list payload) |
template<> | |
void | processEvent< DRAW_CLEAR > (py::list payload) |
void | setInterpreterRenderer (std::shared_ptr< Renderer > renderer) |
Set the renderer to use for the Python interpreter. More... | |
void | runEvents () |
void | setPublicVariables (py::object object, std::shared_ptr< ScriptComponent > script) |
void | initialize () |
void | runGame () |
void | startImplicit () |
void | start () |
Start the Python interpreter and initialize the Python environment. More... | |
void | allowRunning () |
Allow the Python environment to run. More... | |
void | stop () |
Stop the Python interpreter and finalize the Python environment. More... | |
bool | isRunning () |
Check if the Python environment is running. More... | |
void | resetPressedButtons () |
Resets the set of pressed buttons by the user. More... | |
void | addPressedButton (std::string key) |
Add the pressed key to the set, so that the user can interact with it from Python script. More... | |
std::vector< std::pair< std::string, PYTHON_TYPE > > | getPublicVariables (std::string scriptName) |
Function to get a list of public variables and their types from a Python script. More... | |
Variables | |
std::shared_ptr< Renderer > | _eventRenderer |
std::mutex | runningMutex |
std::mutex | inputMutex |
std::vector< std::string > | _pressedButtons |
bool | _currentlyRunning = false |
bool | _canRun = false |
py::object | _game |
py::object | _eventSystem |
py::object | _inputSystem |
std::shared_ptr< Renderer > | _renderer |
std::array< eventHandler, TOTAL_EVENTS > | _eventHandlers |
const std::string | MODULE = "src.python.shkyera." |
The Python module prefix for shkyera. More... | |
std::unordered_map< std::string, PYTHON_TYPE > | _mapPythonTypes = {{"int", INT}, {"float", FLOAT}, {"str", STRING}} |
typedef void(* shkyera::Python::eventHandler) (py::list) |
enum shkyera::Python::Event : int |
Enum representing different types of events that can be processed in Python.
Enumerator | |
---|---|
LOG_INFO | Log an informational message. |
LOG_ERROR | Log an error message. |
LOG_SUCCESS | Log a success message. |
LOG_VERBOSE | Log a verbose message. |
DRAW_LINE | Draw a line using the renderer. |
DRAW_CIRCLE | Draw a circle using the renderer. |
DRAW_RECTANGLE | Draw a rectangle using the renderer. |
DRAW_CLEAR | Clear the renderer. |
TOTAL_EVENTS | The total number of events. |
enum shkyera::Python::PYTHON_TYPE : int |
Enum representing different types that can be used in Python.
Enumerator | |
---|---|
INT | Integer type. |
FLOAT | Float type. |
STRING | String type. |
TOTAL_TYPES | The total number of supported types. |
void shkyera::Python::addPressedButton | ( | std::string | key | ) |
Add the pressed key to the set, so that the user can interact with it from Python script.
key | Pressed key |
void shkyera::Python::allowRunning | ( | ) |
Allow the Python environment to run.
std::vector< std::pair< std::string, PYTHON_TYPE > > shkyera::Python::getPublicVariables | ( | std::string | scriptName | ) |
void shkyera::Python::initialize | ( | ) |
bool shkyera::Python::isRunning | ( | ) |
std::vector< T > shkyera::Python::parsePayload | ( | py::list | payload | ) |
void shkyera::Python::processEvent | ( | py::list | payload | ) |
Function to process an event of a specific type.
event | The type of event to process. |
payload | A Python list containing event-specific data. |
void shkyera::Python::processEvent< DRAW_CIRCLE > | ( | py::list | payload | ) |
void shkyera::Python::processEvent< DRAW_CLEAR > | ( | py::list | payload | ) |
void shkyera::Python::processEvent< DRAW_LINE > | ( | py::list | payload | ) |
void shkyera::Python::processEvent< DRAW_RECTANGLE > | ( | py::list | payload | ) |
void shkyera::Python::processEvent< LOG_ERROR > | ( | py::list | payload | ) |
void shkyera::Python::processEvent< LOG_INFO > | ( | py::list | payload | ) |
void shkyera::Python::processEvent< LOG_SUCCESS > | ( | py::list | payload | ) |
void shkyera::Python::processEvent< LOG_VERBOSE > | ( | py::list | payload | ) |
void shkyera::Python::resetPressedButtons | ( | ) |
Resets the set of pressed buttons by the user.
void shkyera::Python::runEvents | ( | ) |
void shkyera::Python::runGame | ( | ) |
void shkyera::Python::setInterpreterRenderer | ( | std::shared_ptr< Renderer > | renderer | ) |
void shkyera::Python::setPublicVariables | ( | py::object | object, |
std::shared_ptr< ScriptComponent > | script | ||
) |
void shkyera::Python::setRenderer | ( | std::shared_ptr< Renderer > | renderer | ) |
Set the renderer to be used for drawing in Python.
renderer | A shared pointer to the renderer. |
void shkyera::Python::startImplicit | ( | ) |
bool shkyera::Python::_canRun = false |
bool shkyera::Python::_currentlyRunning = false |
std::array<eventHandler, TOTAL_EVENTS> shkyera::Python::_eventHandlers |
std::shared_ptr<Renderer> shkyera::Python::_eventRenderer |
py::object shkyera::Python::_eventSystem |
py::object shkyera::Python::_game |
py::object shkyera::Python::_inputSystem |
std::unordered_map<std::string, PYTHON_TYPE> shkyera::Python::_mapPythonTypes = {{"int", INT}, {"float", FLOAT}, {"str", STRING}} |
std::vector<std::string> shkyera::Python::_pressedButtons |
std::shared_ptr<Renderer> shkyera::Python::_renderer |
std::mutex shkyera::Python::inputMutex |
const std::string shkyera::Python::MODULE = "src.python.shkyera." |
The Python module prefix for shkyera.
std::mutex shkyera::Python::runningMutex |