Exposed ba module/class initing in c++ layer

This commit is contained in:
Eric Froemling 2020-11-11 15:59:46 -08:00
parent 3baa2d754f
commit 22bcd4a3d7
22 changed files with 1627 additions and 1470 deletions

View File

@ -3932,24 +3932,24 @@
"assets/build/windows/Win32/ucrtbased.dll": "https://files.ballistica.net/cache/ba1/b5/85/f8b6d0558ddb87267f34254b1450",
"assets/build/windows/Win32/vc_redist.x86.exe": "https://files.ballistica.net/cache/ba1/1c/e1/4a1a2eddda2f4aebd5f8b64ab08e",
"assets/build/windows/Win32/vcruntime140d.dll": "https://files.ballistica.net/cache/ba1/50/8d/bc2600ac9491f1b14d659709451f",
"build/prefab/full/linux_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/c6/d0/ab980354aba10010949d93b7178e",
"build/prefab/full/linux_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/b6/55/ad5d921172aaa3b807c7167bb371",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/56/0a/38d93ee45f60277af7b54e694a51",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/b2/84/cff1af6f66bd5b7f4c4cb2f73c0c",
"build/prefab/full/mac_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/be/a7/e3818a4394f9685ef9aa04a54168",
"build/prefab/full/mac_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/5f/0a/368e75335223b843d33056c769c5",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/2f/9e/abbc94bc5a5e4dc096612f8d1d7a",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/83/a9/1527e7588933a87ea737b97248d2",
"build/prefab/full/windows_x86/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/56/d3/9c41032882c82d9c815307bc8b66",
"build/prefab/full/windows_x86/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/f9/f1/23276003203790454bf4270df8d8",
"build/prefab/full/windows_x86_server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/ba/97/15b5594cc82961beb5e17cbd5fc2",
"build/prefab/full/windows_x86_server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/80/49/4ee9af2a72b1becf04dcf1b9dd4d",
"build/prefab/lib/linux_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/64/4c/12a9c3e845cf29efd6a2740a9f67",
"build/prefab/lib/linux_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/2d/f9/12757cb5cb19288d2948f196d48f",
"build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/ce/b3/389a58e74c47318de2bc26269cbb",
"build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/91/e3/2a6988e1e5fc37365bb8bd4fb67b",
"build/prefab/lib/mac_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/ac/1e/feb3b200f5e979e69ff98e32f797",
"build/prefab/lib/mac_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/3a/3f/04ffa4a2626e9bfbd60e461d66bd",
"build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/a9/21/0e26a17656ab1e388dd71ecf0244",
"build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/9f/5d/cd22cab6347090bd4cd9c36f4941"
"build/prefab/full/linux_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/d2/35/5ff7dd7a25041c0784ba74b40137",
"build/prefab/full/linux_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/58/f5/97d56302b2320c328a1702b29b30",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/bd/95/c2eee0447fd64a41a1f36e31e257",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/26/d1/3c2b8fde63213bfdfcb975d7bbaa",
"build/prefab/full/mac_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/d7/94/c49ff5a94f47d2886c8db004c2ec",
"build/prefab/full/mac_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/5f/c5/d328666183caf3acb4a315b175c3",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/b9/87/ac5d264cafb87348ad2e791a3393",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/d4/e3/0f65cb6c998aad83ac0f26075951",
"build/prefab/full/windows_x86/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/e7/bc/261d8d63a33d6a0e17fb20477ffd",
"build/prefab/full/windows_x86/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/44/23/5dd042e6845fef6e3690bd4d5734",
"build/prefab/full/windows_x86_server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/ea/c6/cdc48f95725a16297b222de3c69e",
"build/prefab/full/windows_x86_server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/64/c8/5ccec4eba9397107f075cf2ab401",
"build/prefab/lib/linux_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/4f/4c/8590730e5d1cdae456c1b734a2a1",
"build/prefab/lib/linux_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/44/e5/d1c3162e114e51a5b5b826c2ec7c",
"build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/ee/21/8fab3da6b974cf323024d076b609",
"build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/20/5d/881676243c5f44bdca677497b4d4",
"build/prefab/lib/mac_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/af/fd/b522dcf75713cd293743cff84613",
"build/prefab/lib/mac_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/15/45/0c8a4e7775c699146aea682e5504",
"build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/09/31/4cf5f0cd0c180f9ecbb973b07ed9",
"build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/4a/1d/be1767741e32fd937917748944d6"
}

View File

@ -1,3 +1,6 @@
### 1.5.29 (20246)
- Exposed ba method/class initing in public C++ layer.
### 1.5.28 (20239)
- Simplified ba.enum_by_value()
- Updated Google Play version to hopefully show friend high scores again on score screens (at least for levels that have an associated Google Play leaderboard).

View File

@ -1,5 +1,5 @@
<!-- THIS FILE IS AUTO GENERATED; DO NOT EDIT BY HAND -->
<h4><em>last updated on 2020-11-10 for Ballistica version 1.5.28 build 20245</em></h4>
<h4><em>last updated on 2020-11-11 for Ballistica version 1.5.28 build 20246</em></h4>
<p>This page documents the Python classes and functions in the 'ba' module,
which are the ones most relevant to modding in Ballistica. If you come across something you feel should be included here or could be better explained, please <a href="mailto:support@froemling.net">let me know</a>. Happy modding!</p>
<hr>

View File

@ -21,8 +21,8 @@
namespace ballistica {
// These are set automatically via script; don't change here.
const int kAppBuildNumber = 20246;
const char* kAppVersion = "1.5.28";
const int kAppBuildNumber = 20247;
const char* kAppVersion = "1.5.29";
// Our standalone globals.
// These are separated out for easy access.

View File

@ -154,8 +154,8 @@ auto IsBootstrapped() -> bool;
/// Internal bits.
auto CreateAppInternal() -> AppInternal*;
auto AppInternalPythonInit2() -> void;
auto AppInternalInitModule() -> void;
auto AppInternalInitPythonModule() -> void;
auto AppInternalPythonPostInit() -> void;
auto AppInternalHasBlessingHash() -> bool;
auto AppInternalPutLog(bool fatal) -> bool;
auto AppInternalAwardAdTickets() -> void;

View File

@ -20,6 +20,7 @@ typedef struct ALCcontext_struct ALCcontext;
#endif
typedef struct _object PyObject;
typedef struct _ts PyThreadState;
typedef struct PyMethodDef PyMethodDef;
#if BA_SDL_BUILD || BA_MINSDL_BUILD
union SDL_Event;

View File

@ -3,7 +3,6 @@
#include "ballistica/python/methods/python_methods_app.h"
#include <string>
#include <vector>
#include "ballistica/app/app.h"
#include "ballistica/app/app_globals.h"
@ -19,6 +18,7 @@
#include "ballistica/python/class/python_class_session_data.h"
#include "ballistica/python/python.h"
#include "ballistica/python/python_context_call_runnable.h"
#include "ballistica/python/python_sys.h"
#include "ballistica/scene/scene.h"
namespace ballistica {
@ -885,7 +885,8 @@ auto PyTimeFormatCheck(PyObject* self, PyObject* args, PyObject* keywds)
BA_PYTHON_CATCH;
}
PyMethodDef PythonMethodsApp::methods_def[] = {
auto PythonMethodsApp::GetMethods() -> std::vector<PyMethodDef> {
return {
{"appname", (PyCFunction)PyAppName, METH_NOARGS,
"appname() -> str\n"
"\n"
@ -895,7 +896,8 @@ PyMethodDef PythonMethodsApp::methods_def[] = {
"\n"
"(internal)\n"
"\n"
"Return whether this build of the game can display full unicode such as\n"
"Return whether this build of the game can display full unicode such "
"as\n"
"Emoji, Asian languages, etc.\n"},
{"is_xcode_build", (PyCFunction)PyIsXCodeBuild, METH_NOARGS,
"is_xcode_build() -> bool\n"
@ -929,10 +931,12 @@ PyMethodDef PythonMethodsApp::methods_def[] = {
"on the platform (stdout on mac, android log on android, etc).\n"
"\n"
"Log messages also go to the in-game console unless 'to_console'\n"
"is False. They are also sent to the master-server for use in analyzing\n"
"is False. They are also sent to the master-server for use in "
"analyzing\n"
"issues unless to_server is False.\n"
"\n"
"Python's standard print() is wired to call this (with default values)\n"
"Python's standard print() is wired to call this (with default "
"values)\n"
"so in most cases you can just use that."},
{"print_stdout", PyPrintStdout, METH_VARARGS,
@ -955,12 +959,14 @@ PyMethodDef PythonMethodsApp::methods_def[] = {
"\n"
"(internal)\n"
"\n"
"Returns a dict containing general info about the operating environment\n"
"Returns a dict containing general info about the operating "
"environment\n"
"such as version, platform, etc.\n"
"This info is now exposed through ba.App; refer to those docs for\n"
"info on specific elements."},
{"commit_config", (PyCFunction)PyCommitConfig, METH_VARARGS | METH_KEYWORDS,
{"commit_config", (PyCFunction)PyCommitConfig,
METH_VARARGS | METH_KEYWORDS,
"commit_config(config: str) -> None\n"
"\n"
"(internal)"},
@ -999,10 +1005,13 @@ PyMethodDef PythonMethodsApp::methods_def[] = {
"Category: General Utility Functions\n"
"\n"
"If 'top' is True, the message will go to the top message area.\n"
"For 'top' messages, 'image' can be a texture to display alongside the\n"
"For 'top' messages, 'image' can be a texture to display alongside "
"the\n"
"message.\n"
"If 'log' is True, the message will also be printed to the output log\n"
"'clients' can be a list of client-ids the message should be sent to,\n"
"If 'log' is True, the message will also be printed to the output "
"log\n"
"'clients' can be a list of client-ids the message should be sent "
"to,\n"
"or None to specify that everyone should receive it.\n"
"If 'transient' is True, the message will not be included in the\n"
"game-stream and thus will not show up when viewing replays.\n"
@ -1023,7 +1032,8 @@ PyMethodDef PythonMethodsApp::methods_def[] = {
"This timer cannot be canceled or modified once created. If you\n"
" require the ability to do so, use the ba.Timer class instead.\n"
"\n"
"time: length of time (in seconds by default) that the timer will wait\n"
"time: length of time (in seconds by default) that the timer will "
"wait\n"
"before firing. Note that the actual delay experienced may vary\n "
"depending on the timetype. (see below)\n"
"\n"
@ -1032,14 +1042,17 @@ PyMethodDef PythonMethodsApp::methods_def[] = {
"may want to look into concepts such as ba.WeakCall if that is not\n"
"desired.\n"
"\n"
"repeat: if True, the timer will fire repeatedly, with each successive\n"
"repeat: if True, the timer will fire repeatedly, with each "
"successive\n"
"firing having the same delay as the first.\n"
"\n"
"timetype can be either 'sim', 'base', or 'real'. It defaults to\n"
"'sim'. Types are explained below:\n"
"\n"
"'sim' time maps to local simulation time in ba.Activity or ba.Session\n"
"Contexts. This means that it may progress slower in slow-motion play\n"
"'sim' time maps to local simulation time in ba.Activity or "
"ba.Session\n"
"Contexts. This means that it may progress slower in slow-motion "
"play\n"
"modes, stop when the game is paused, etc. This time type is not\n"
"available in UI contexts.\n"
"\n"
@ -1049,18 +1062,22 @@ PyMethodDef PythonMethodsApp::methods_def[] = {
"in certain cases such as network outages or game slowdowns due to\n"
"cpu load. Like 'sim' time, this is unavailable in UI contexts.\n"
"\n"
"'real' time always maps to actual clock time with a bit of filtering\n"
"added, regardless of Context. (the filtering prevents it from going\n"
"'real' time always maps to actual clock time with a bit of "
"filtering\n"
"added, regardless of Context. (the filtering prevents it from "
"going\n"
"backwards or jumping forward by large amounts due to the app being\n"
"backgrounded, system time changing, etc.)\n"
"Real time timers are currently only available in the UI context.\n"
"\n"
"the 'timeformat' arg defaults to seconds but can also be milliseconds.\n"
"the 'timeformat' arg defaults to seconds but can also be "
"milliseconds.\n"
"\n"
"# timer example: print some stuff through time:\n"
"ba.screenmessage('hello from now!')\n"
"ba.timer(1.0, ba.Call(ba.screenmessage, 'hello from the future!'))\n"
"ba.timer(2.0, ba.Call(ba.screenmessage, 'hello from the future 2!'))\n"},
"ba.timer(2.0, ba.Call(ba.screenmessage, 'hello from the future "
"2!'))\n"},
{"time", (PyCFunction)PyTime, METH_VARARGS | METH_KEYWORDS,
"time(timetype: ba.TimeType = TimeType.SIM,\n"
@ -1077,7 +1094,8 @@ PyMethodDef PythonMethodsApp::methods_def[] = {
"SIM. Types are explained below:\n"
"\n"
"SIM time maps to local simulation time in ba.Activity or ba.Session\n"
"Contexts. This means that it may progress slower in slow-motion play\n"
"Contexts. This means that it may progress slower in slow-motion "
"play\n"
"modes, stop when the game is paused, etc. This time type is not\n"
"available in UI contexts.\n"
"\n"
@ -1088,11 +1106,13 @@ PyMethodDef PythonMethodsApp::methods_def[] = {
"cpu load. Like 'sim' time, this is unavailable in UI contexts.\n"
"\n"
"REAL time always maps to actual clock time with a bit of filtering\n"
"added, regardless of Context. (the filtering prevents it from going\n"
"added, regardless of Context. (the filtering prevents it from "
"going\n"
"backwards or jumping forward by large amounts due to the app being\n"
"backgrounded, system time changing, etc.)\n"
"\n"
"the 'timeformat' arg defaults to SECONDS which returns float seconds,\n"
"the 'timeformat' arg defaults to SECONDS which returns float "
"seconds,\n"
"but it can also be MILLISECONDS to return integer milliseconds.\n"
"\n"
"Note: If you need pure unfiltered clock time, just use the standard\n"
@ -1109,27 +1129,31 @@ PyMethodDef PythonMethodsApp::methods_def[] = {
"This can be handy for calls that are disallowed from within other\n"
"callbacks, etc.\n"
"\n"
"This call expects to be used in the game thread, and will automatically\n"
"This call expects to be used in the game thread, and will "
"automatically\n"
"save and restore the ba.Context to behave seamlessly.\n"
"\n"
"If you want to push a call from outside of the game thread,\n"
"however, you can pass 'from_other_thread' as True. In this case\n"
"the call will always run in the UI context on the game thread."},
{"getactivity", (PyCFunction)PyGetActivity, METH_VARARGS | METH_KEYWORDS,
{"getactivity", (PyCFunction)PyGetActivity,
METH_VARARGS | METH_KEYWORDS,
"getactivity(doraise: bool = True) -> <varies>\n"
"\n"
"Return the current ba.Activity instance.\n"
"\n"
"Category: Gameplay Functions\n"
"\n"
"Note that this is based on context; thus code run in a timer generated\n"
"Note that this is based on context; thus code run in a timer "
"generated\n"
"in Activity 'foo' will properly return 'foo' here, even if another\n"
"Activity has since been created or is transitioning in.\n"
"If there is no current Activity, raises a ba.ActivityNotFoundError.\n"
"If doraise is False, None will be returned instead in that case."},
{"newactivity", (PyCFunction)PyNewActivity, METH_VARARGS | METH_KEYWORDS,
{"newactivity", (PyCFunction)PyNewActivity,
METH_VARARGS | METH_KEYWORDS,
"newactivity(activity_type: Type[ba.Activity],\n"
" settings: dict = None) -> ba.Activity\n"
"\n"
@ -1146,7 +1170,8 @@ PyMethodDef PythonMethodsApp::methods_def[] = {
"\n"
"(internal)\n"
"\n"
"Return the ba.Session currently being displayed, or None if there is\n"
"Return the ba.Session currently being displayed, or None if there "
"is\n"
"none."},
{"register_activity", (PyCFunction)PyRegisterActivity,
@ -1161,7 +1186,8 @@ PyMethodDef PythonMethodsApp::methods_def[] = {
"\n"
"(internal)"},
{"is_in_replay", (PyCFunction)PyIsInReplay, METH_VARARGS | METH_KEYWORDS,
{"is_in_replay", (PyCFunction)PyIsInReplay,
METH_VARARGS | METH_KEYWORDS,
"is_in_replay() -> bool\n"
"\n"
"(internal)"},
@ -1190,8 +1216,8 @@ PyMethodDef PythonMethodsApp::methods_def[] = {
"exists, etc. If there is no current Session, an Exception is raised, "
"or\n"
"if doraise is False then None is returned instead."},
{nullptr, nullptr, 0, nullptr}};
};
}
#pragma clang diagnostic pop

View File

@ -3,14 +3,16 @@
#ifndef BALLISTICA_PYTHON_METHODS_PYTHON_METHODS_APP_H_
#define BALLISTICA_PYTHON_METHODS_PYTHON_METHODS_APP_H_
#include "ballistica/python/python_sys.h"
#include <vector>
#include "ballistica/ballistica.h"
namespace ballistica {
/// App related individual python methods for our module.
class PythonMethodsApp {
public:
static PyMethodDef methods_def[];
static auto GetMethods() -> std::vector<PyMethodDef>;
};
} // namespace ballistica

View File

@ -4,7 +4,6 @@
#include <list>
#include <string>
#include <vector>
#include "ballistica/app/app.h"
#include "ballistica/dynamics/bg/bg_dynamics.h"
@ -23,6 +22,7 @@
#include "ballistica/platform/platform.h"
#include "ballistica/python/python.h"
#include "ballistica/python/python_context_call_runnable.h"
#include "ballistica/python/python_sys.h"
#include "ballistica/scene/node/node.h"
#include "ballistica/scene/node/node_type.h"
#include "ballistica/scene/scene.h"
@ -601,7 +601,8 @@ auto PyGetRandomNames(PyObject* self, PyObject* args) -> PyObject* {
BA_PYTHON_CATCH;
}
PyMethodDef PythonMethodsGameplay::methods_def[] = {
auto PythonMethodsGameplay::GetMethods() -> std::vector<PyMethodDef> {
return {
{"get_random_names", PyGetRandomNames, METH_VARARGS,
"get_random_names() -> list\n"
"\n"
@ -641,11 +642,13 @@ PyMethodDef PythonMethodsGameplay::methods_def[] = {
"\n"
"(internal)\n"
"\n"
"Sets the debug speed scale for the game. Actual speed is pow(2,speed)."},
"Sets the debug speed scale for the game. Actual speed is "
"pow(2,speed)."},
{"get_scores_to_beat", (PyCFunction)PyGetScoresToBeat,
METH_VARARGS | METH_KEYWORDS,
"get_scores_to_beat(level: str, config: str, callback: Callable) -> None\n"
"get_scores_to_beat(level: str, config: str, callback: Callable) -> "
"None\n"
"\n"
"(internal)"},
@ -666,7 +669,8 @@ PyMethodDef PythonMethodsGameplay::methods_def[] = {
{"set_map_bounds", (PyCFunction)PySetMapBounds,
METH_VARARGS | METH_KEYWORDS,
"set_map_bounds(bounds: Tuple[float, float, float, float, float, float])\n"
"set_map_bounds(bounds: Tuple[float, float, float, float, float, "
"float])\n"
" -> None\n"
"\n"
"(internal)\n"
@ -749,18 +753,22 @@ PyMethodDef PythonMethodsGameplay::methods_def[] = {
"If a dict is provided for 'attributes', the node's initial attributes\n"
"will be set based on them.\n"
"\n"
"'name', if provided, will be stored with the node purely for debugging\n"
"'name', if provided, will be stored with the node purely for "
"debugging\n"
"purposes. If no name is provided, an automatic one will be generated\n"
"such as 'terrain@foo.py:30'.\n"
"\n"
"If 'delegate' is provided, Python messages sent to the node will go to\n"
"that object's handlemessage() method. Note that the delegate is stored\n"
"If 'delegate' is provided, Python messages sent to the node will go "
"to\n"
"that object's handlemessage() method. Note that the delegate is "
"stored\n"
"as a weak-ref, so the node itself will not keep the object alive.\n"
"\n"
"if 'owner' is provided, the node will be automatically killed when that\n"
"if 'owner' is provided, the node will be automatically killed when "
"that\n"
"object dies. 'owner' can be another node or a ba.Actor"},
{nullptr, nullptr, 0, nullptr}};
};
}
#pragma clang diagnostic pop

View File

@ -3,14 +3,16 @@
#ifndef BALLISTICA_PYTHON_METHODS_PYTHON_METHODS_GAMEPLAY_H_
#define BALLISTICA_PYTHON_METHODS_PYTHON_METHODS_GAMEPLAY_H_
#include "ballistica/python/python_sys.h"
#include <vector>
#include "ballistica/ballistica.h"
namespace ballistica {
/// Gameplay related individual python methods for our module.
class PythonMethodsGameplay {
public:
static PyMethodDef methods_def[];
static auto GetMethods() -> std::vector<PyMethodDef>;
};
} // namespace ballistica

View File

@ -10,6 +10,7 @@
#include "ballistica/platform/platform.h"
#include "ballistica/python/python.h"
#include "ballistica/python/python_context_call_runnable.h"
#include "ballistica/python/python_sys.h"
namespace ballistica {
@ -223,7 +224,8 @@ auto PyGetDisplayResolution(PyObject* self, PyObject* args) -> PyObject* {
BA_PYTHON_CATCH;
}
PyMethodDef PythonMethodsGraphics::methods_def[] = {
auto PythonMethodsGraphics::GetMethods() -> std::vector<PyMethodDef> {
return {
{"get_display_resolution", PyGetDisplayResolution, METH_VARARGS,
"get_display_resolution() -> Optional[Tuple[int, int]]\n"
"\n"
@ -245,7 +247,8 @@ PyMethodDef PythonMethodsGraphics::methods_def[] = {
"\n"
"(internal)\n"
"\n"
"Provide an object to be called once the next non-progress-bar-frame has\n"
"Provide an object to be called once the next non-progress-bar-frame "
"has\n"
"been rendered. Useful for queueing things to load in the background\n"
"without elongating any current progress-bar-load."},
@ -256,7 +259,8 @@ PyMethodDef PythonMethodsGraphics::methods_def[] = {
{"get_string_width", (PyCFunction)PyGetStringWidth,
METH_VARARGS | METH_KEYWORDS,
"get_string_width(string: str, suppress_warning: bool = False) -> float\n"
"get_string_width(string: str, suppress_warning: bool = False) -> "
"float\n"
"\n"
"(internal)\n"
"\n"
@ -265,14 +269,16 @@ PyMethodDef PythonMethodsGraphics::methods_def[] = {
{"get_string_height", (PyCFunction)PyGetStringHeight,
METH_VARARGS | METH_KEYWORDS,
"get_string_height(string: str, suppress_warning: bool = False) -> float\n"
"get_string_height(string: str, suppress_warning: bool = False) -> "
"float\n"
"\n"
"(internal)\n"
"\n"
"Given a string, returns its height using the standard small app\n"
"font."},
{"evaluate_lstr", (PyCFunction)PyEvaluateLstr, METH_VARARGS | METH_KEYWORDS,
{"evaluate_lstr", (PyCFunction)PyEvaluateLstr,
METH_VARARGS | METH_KEYWORDS,
"evaluate_lstr(value: str) -> str\n"
"\n"
"(internal)"},
@ -307,8 +313,8 @@ PyMethodDef PythonMethodsGraphics::methods_def[] = {
"them elsewhere will be meaningless.\n"
"\n"
"see ba.SpecialChar for the list of available characters."},
{nullptr, nullptr, 0, nullptr}};
};
}
#pragma clang diagnostic pop

View File

@ -3,14 +3,16 @@
#ifndef BALLISTICA_PYTHON_METHODS_PYTHON_METHODS_GRAPHICS_H_
#define BALLISTICA_PYTHON_METHODS_PYTHON_METHODS_GRAPHICS_H_
#include "ballistica/python/python_sys.h"
#include <vector>
#include "ballistica/ballistica.h"
namespace ballistica {
/// Graphics related individual python methods for our module.
class PythonMethodsGraphics {
public:
static PyMethodDef methods_def[];
static auto GetMethods() -> std::vector<PyMethodDef>;
};
} // namespace ballistica

View File

@ -12,6 +12,7 @@
#include "ballistica/input/input.h"
#include "ballistica/platform/platform.h"
#include "ballistica/python/python.h"
#include "ballistica/python/python_sys.h"
#include "ballistica/ui/ui.h"
namespace ballistica {
@ -265,7 +266,8 @@ auto PyGetLocalActiveInputDevicesCount(PyObject* self, PyObject* args,
BA_PYTHON_CATCH;
}
PyMethodDef PythonMethodsInput::methods_def[] = {
auto PythonMethodsInput::GetMethods() -> std::vector<PyMethodDef> {
return {
{"get_local_active_input_devices_count",
(PyCFunction)PyGetLocalActiveInputDevicesCount,
METH_VARARGS | METH_KEYWORDS,
@ -313,7 +315,8 @@ PyMethodDef PythonMethodsInput::methods_def[] = {
"\n"
"(internal)\n"
"\n"
"Prevents all keyboard, mouse, and gamepad events from being processed."},
"Prevents all keyboard, mouse, and gamepad events from being "
"processed."},
{"release_keyboard_input", PyReleaseKeyboardInput, METH_VARARGS,
"release_keyboard_input() -> None\n"
@ -386,8 +389,8 @@ PyMethodDef PythonMethodsInput::methods_def[] = {
"\n"
"Returns a list of the currently connected gamepads that can be\n"
"configured."},
{nullptr, nullptr, 0, nullptr}};
};
}
#pragma clang diagnostic pop

View File

@ -3,14 +3,16 @@
#ifndef BALLISTICA_PYTHON_METHODS_PYTHON_METHODS_INPUT_H_
#define BALLISTICA_PYTHON_METHODS_PYTHON_METHODS_INPUT_H_
#include "ballistica/python/python_sys.h"
#include <vector>
#include "ballistica/ballistica.h"
namespace ballistica {
// Input related individual python methods for our module.
class PythonMethodsInput {
public:
static PyMethodDef methods_def[];
static auto GetMethods() -> std::vector<PyMethodDef>;
};
} // namespace ballistica

View File

@ -16,6 +16,7 @@
#include "ballistica/media/component/sound.h"
#include "ballistica/media/component/texture.h"
#include "ballistica/python/python.h"
#include "ballistica/python/python_sys.h"
#include "ballistica/ui/ui.h"
namespace ballistica {
@ -362,7 +363,8 @@ auto PyIsOSPlayingMusic(PyObject* self, PyObject* args, PyObject* keywds)
BA_PYTHON_CATCH;
}
PyMethodDef PythonMethodsMedia::methods_def[] = {
auto PythonMethodsMedia::GetMethods() -> std::vector<PyMethodDef> {
return {
{"is_os_playing_music", (PyCFunction)PyIsOSPlayingMusic,
METH_VARARGS | METH_KEYWORDS,
"is_os_playing_music() -> bool\n"
@ -474,7 +476,8 @@ PyMethodDef PythonMethodsMedia::methods_def[] = {
"\n"
"Note that this function returns immediately even if the media has yet\n"
"to be loaded. To avoid hitches, instantiate your media objects in\n"
"advance of when you will be using them, allowing time for them to load\n"
"advance of when you will be using them, allowing time for them to "
"load\n"
"in the background if necessary."},
{"get_package_collide_model", (PyCFunction)PyGetPackageCollideModel,
@ -493,7 +496,8 @@ PyMethodDef PythonMethodsMedia::methods_def[] = {
"\n"
"Note that this function returns immediately even if the media has yet\n"
"to be loaded. To avoid hitches, instantiate your media objects in\n"
"advance of when you will be using them, allowing time for them to load\n"
"advance of when you will be using them, allowing time for them to "
"load\n"
"in the background if necessary."},
{"get_package_model", (PyCFunction)PyGetPackageModel,
@ -511,7 +515,8 @@ PyMethodDef PythonMethodsMedia::methods_def[] = {
"\n"
"Note that this function returns immediately even if the media has yet\n"
"to be loaded. To avoid hitches, instantiate your media objects in\n"
"advance of when you will be using them, allowing time for them to load\n"
"advance of when you will be using them, allowing time for them to "
"load\n"
"in the background if necessary."},
{"get_package_sound", (PyCFunction)PyGetPackageSound,
@ -529,7 +534,8 @@ PyMethodDef PythonMethodsMedia::methods_def[] = {
"\n"
"Note that this function returns immediately even if the media has yet\n"
"to be loaded. To avoid hitches, instantiate your media objects in\n"
"advance of when you will be using them, allowing time for them to load\n"
"advance of when you will be using them, allowing time for them to "
"load\n"
"in the background if necessary."},
{"get_package_data", (PyCFunction)PyGetPackageData,
@ -547,16 +553,18 @@ PyMethodDef PythonMethodsMedia::methods_def[] = {
"\n"
"Note that this function returns immediately even if the media has yet\n"
"to be loaded. To avoid hitches, instantiate your media objects in\n"
"advance of when you will be using them, allowing time for them to load\n"
"advance of when you will be using them, allowing time for them to "
"load\n"
"in the background if necessary."},
{"get_package_texture", (PyCFunction)PyGetPackageTexture,
METH_VARARGS | METH_KEYWORDS,
"get_package_texture(package: ba.AssetPackage, name: str) -> ba.Texture\n"
"get_package_texture(package: ba.AssetPackage, name: str) -> "
"ba.Texture\n"
"\n"
"(internal)"},
{nullptr, nullptr, 0, nullptr}};
};
}
#pragma clang diagnostic pop

View File

@ -3,14 +3,16 @@
#ifndef BALLISTICA_PYTHON_METHODS_PYTHON_METHODS_MEDIA_H_
#define BALLISTICA_PYTHON_METHODS_PYTHON_METHODS_MEDIA_H_
#include "ballistica/python/python_sys.h"
#include <vector>
#include "ballistica/ballistica.h"
namespace ballistica {
/// Media related individual python methods for our module.
class PythonMethodsMedia {
public:
static PyMethodDef methods_def[];
static auto GetMethods() -> std::vector<PyMethodDef>;
};
} // namespace ballistica

View File

@ -22,6 +22,7 @@
#include "ballistica/platform/platform.h"
#include "ballistica/python/python.h"
#include "ballistica/python/python_context_call_runnable.h"
#include "ballistica/python/python_sys.h"
#include "ballistica/scene/scene.h"
namespace ballistica {
@ -740,8 +741,10 @@ auto PyApp(PyObject* self, PyObject* args, PyObject* keywds) -> PyObject* {
BA_PYTHON_CATCH;
}
PyMethodDef PythonMethodsSystem::methods_def[] = {
{"printobjects", (PyCFunction)PyPrintObjects, METH_VARARGS | METH_KEYWORDS,
auto PythonMethodsSystem::GetMethods() -> std::vector<PyMethodDef> {
return {
{"printobjects", (PyCFunction)PyPrintObjects,
METH_VARARGS | METH_KEYWORDS,
"printobjects() -> None\n"
"\n"
"Print debugging info about game objects.\n"
@ -783,12 +786,14 @@ PyMethodDef PythonMethodsSystem::methods_def[] = {
"modifications to be reflected in Android File Transfer."},
{"android_get_external_storage_path",
(PyCFunction)PyAndroidGetExternalStoragePath, METH_VARARGS | METH_KEYWORDS,
(PyCFunction)PyAndroidGetExternalStoragePath,
METH_VARARGS | METH_KEYWORDS,
"android_get_external_storage_path() -> str\n"
"\n"
"(internal)\n"
"\n"
"Returns the android external storage path, or None if there is none on\n"
"Returns the android external storage path, or None if there is none "
"on\n"
"this device"},
{"android_show_wifi_settings", (PyCFunction)PyAndroidShowWifiSettings,
@ -847,7 +852,8 @@ PyMethodDef PythonMethodsSystem::methods_def[] = {
"\n"
"(internal)"},
{"mark_log_sent", (PyCFunction)PyMarkLogSent, METH_VARARGS | METH_KEYWORDS,
{"mark_log_sent", (PyCFunction)PyMarkLogSent,
METH_VARARGS | METH_KEYWORDS,
"mark_log_sent() -> None\n"
"\n"
"(internal)"},
@ -919,7 +925,8 @@ PyMethodDef PythonMethodsSystem::methods_def[] = {
"\n"
"Category: General Utility Functions"},
{"print_context", (PyCFunction)PyPrintContext, METH_VARARGS | METH_KEYWORDS,
{"print_context", (PyCFunction)PyPrintContext,
METH_VARARGS | METH_KEYWORDS,
"print_context() -> None\n"
"\n"
"(internal)\n"
@ -1023,8 +1030,8 @@ PyMethodDef PythonMethodsSystem::methods_def[] = {
"setup_sigint() -> None\n"
"\n"
"(internal)"},
{nullptr, nullptr, 0, nullptr}};
};
}
#pragma clang diagnostic pop

View File

@ -3,14 +3,16 @@
#ifndef BALLISTICA_PYTHON_METHODS_PYTHON_METHODS_SYSTEM_H_
#define BALLISTICA_PYTHON_METHODS_PYTHON_METHODS_SYSTEM_H_
#include "ballistica/python/python_sys.h"
#include <vector>
#include "ballistica/ballistica.h"
namespace ballistica {
/// System related individual python methods for our module.
class PythonMethodsSystem {
public:
static PyMethodDef methods_def[];
static auto GetMethods() -> std::vector<PyMethodDef>;
};
} // namespace ballistica

View File

@ -12,6 +12,7 @@
#include "ballistica/game/game.h"
#include "ballistica/input/input.h"
#include "ballistica/python/python.h"
#include "ballistica/python/python_sys.h"
#include "ballistica/ui/root_ui.h"
#include "ballistica/ui/ui.h"
#include "ballistica/ui/widget/button_widget.h"
@ -2295,7 +2296,8 @@ auto PyIsPartyIconVisible(PyObject* self, PyObject* args, PyObject* keywds)
BA_PYTHON_CATCH;
}
PyMethodDef PythonMethodsUI::methods_def[] = {
auto PythonMethodsUI::GetMethods() -> std::vector<PyMethodDef> {
return {
{"is_party_icon_visible", (PyCFunction)PyIsPartyIconVisible,
METH_VARARGS | METH_KEYWORDS,
"is_party_icon_visible() -> bool\n"
@ -2308,7 +2310,8 @@ PyMethodDef PythonMethodsUI::methods_def[] = {
"(internal)\n"
"\n"
"Print the provided args to the game console (using str()).\n"
"For most debugging/info purposes you should just use Python's standard\n"
"For most debugging/info purposes you should just use Python's "
"standard\n"
"print, which will show up in the game console as well."},
{"open_dir_externally", (PyCFunction)PyOpenDirExternally,
@ -2342,7 +2345,8 @@ PyMethodDef PythonMethodsUI::methods_def[] = {
"\n"
"(internal)"},
{"has_video_ads", (PyCFunction)PyHasVideoAds, METH_VARARGS | METH_KEYWORDS,
{"has_video_ads", (PyCFunction)PyHasVideoAds,
METH_VARARGS | METH_KEYWORDS,
"has_video_ads() -> bool\n"
"\n"
"(internal)"},
@ -2383,8 +2387,8 @@ PyMethodDef PythonMethodsUI::methods_def[] = {
"\n"
"(internal)"},
{"set_party_icon_always_visible", (PyCFunction)PySetPartyIconAlwaysVisible,
METH_VARARGS | METH_KEYWORDS,
{"set_party_icon_always_visible",
(PyCFunction)PySetPartyIconAlwaysVisible, METH_VARARGS | METH_KEYWORDS,
"set_party_icon_always_visible(value: bool) -> None\n"
"\n"
"(internal)"},
@ -2435,8 +2439,10 @@ PyMethodDef PythonMethodsUI::methods_def[] = {
"(internal)\n"
"\n"
"Fade the local game screen in our out from black over a duration of\n"
"time. if \"to\" is 0, the screen will fade out to black. Otherwise it\n"
"will fade in from black. If endcall is provided, it will be run after a\n"
"time. if \"to\" is 0, the screen will fade out to black. Otherwise "
"it\n"
"will fade in from black. If endcall is provided, it will be run after "
"a\n"
"completely faded frame is drawn."},
{"show_online_score_ui", (PyCFunction)PyShowOnlineScoreUI,
@ -2458,12 +2464,14 @@ PyMethodDef PythonMethodsUI::methods_def[] = {
"\n"
"(internal)\n"
"\n"
"Returns a tuple of 4 values: (x-min, x-max, y-min, y-max) representing\n"
"Returns a tuple of 4 values: (x-min, x-max, y-min, y-max) "
"representing\n"
"the range of values that can be plugged into a root level\n"
"ba.ContainerWidget's stack_offset value while guaranteeing that its\n"
"center remains onscreen.\n"},
{"buttonwidget", (PyCFunction)PyButtonWidget, METH_VARARGS | METH_KEYWORDS,
{"buttonwidget", (PyCFunction)PyButtonWidget,
METH_VARARGS | METH_KEYWORDS,
"buttonwidget(edit: ba.Widget = None,\n"
" parent: ba.Widget = None,\n"
" size: Sequence[float] = None,\n"
@ -2542,7 +2550,8 @@ PyMethodDef PythonMethodsUI::methods_def[] = {
" color: Sequence[float] = None, texture: ba.Texture = None,\n"
" opacity: float = None, model_transparent: ba.Model = None,\n"
" model_opaque: ba.Model = None, has_alpha_channel: bool = True,\n"
" tint_texture: ba.Texture = None, tint_color: Sequence[float] = None,\n"
" tint_texture: ba.Texture = None, tint_color: Sequence[float] = "
"None,\n"
" transition_delay: float = None, draw_controller: ba.Widget = None,\n"
" tint2_color: Sequence[float] = None, tilt_scale: float = None,\n"
" mask_texture: ba.Texture = None, radial_amount: float = None)\n"
@ -2556,7 +2565,8 @@ PyMethodDef PythonMethodsUI::methods_def[] = {
"a new one is created and returned. Arguments that are not set to None\n"
"are applied to the Widget."},
{"columnwidget", (PyCFunction)PyColumnWidget, METH_VARARGS | METH_KEYWORDS,
{"columnwidget", (PyCFunction)PyColumnWidget,
METH_VARARGS | METH_KEYWORDS,
"columnwidget(edit: ba.Widget = None,\n"
" parent: ba.Widget = None,\n"
" size: Sequence[float] = None,\n"
@ -2643,7 +2653,8 @@ PyMethodDef PythonMethodsUI::methods_def[] = {
"a new one is created and returned. Arguments that are not set to None\n"
"are applied to the Widget."},
{"scrollwidget", (PyCFunction)PyScrollWidget, METH_VARARGS | METH_KEYWORDS,
{"scrollwidget", (PyCFunction)PyScrollWidget,
METH_VARARGS | METH_KEYWORDS,
"scrollwidget(edit: ba.Widget = None, parent: ba.Widget = None,\n"
" size: Sequence[float] = None, position: Sequence[float] = None,\n"
" background: bool = None, selected_child: ba.Widget = None,\n"
@ -2694,7 +2705,8 @@ PyMethodDef PythonMethodsUI::methods_def[] = {
" h_align: str = None, editable: bool = None, padding: float = None,\n"
" on_return_press_call: Callable[[], None] = None,\n"
" on_activate_call: Callable[[], None] = None,\n"
" selectable: bool = None, query: Widget = None, max_chars: int = None,\n"
" selectable: bool = None, query: Widget = None, max_chars: int = "
"None,\n"
" color: Sequence[float] = None, click_activate: bool = None,\n"
" on_select_call: Callable[[], None] = None,\n"
" always_highlight: bool = None, draw_controller: Widget = None,\n"
@ -2702,7 +2714,8 @@ PyMethodDef PythonMethodsUI::methods_def[] = {
" description: Union[str, ba.Lstr] = None,\n"
" transition_delay: float = None, maxwidth: float = None,\n"
" max_height: float = None, flatness: float = None,\n"
" shadow: float = None, autoselect: bool = None, rotate: float = None,\n"
" shadow: float = None, autoselect: bool = None, rotate: float = "
"None,\n"
" enabled: bool = None, force_internal_editing: bool = None,\n"
" always_show_carat: bool = None, big: bool = None,\n"
" extra_touch_border_scale: float = None, res_scale: float = None)\n"
@ -2727,9 +2740,10 @@ PyMethodDef PythonMethodsUI::methods_def[] = {
"\n"
"Category: User Interface Functions\n"
"\n"
"Unlike other UI calls, this can only be used to edit, not to create.\n"},
{nullptr, nullptr, 0, nullptr}};
"Unlike other UI calls, this can only be used to edit, not to "
"create.\n"},
};
}
#pragma clang diagnostic pop

View File

@ -3,14 +3,16 @@
#ifndef BALLISTICA_PYTHON_METHODS_PYTHON_METHODS_UI_H_
#define BALLISTICA_PYTHON_METHODS_PYTHON_METHODS_UI_H_
#include "ballistica/python/python_sys.h"
#include <vector>
#include "ballistica/ballistica.h"
namespace ballistica {
/// UI related individual python methods for our module.
class PythonMethodsUI {
public:
static PyMethodDef methods_def[];
static auto GetMethods() -> std::vector<PyMethodDef>;
};
} // namespace ballistica

View File

@ -25,6 +25,7 @@
#include "ballistica/python/class/python_class_activity_data.h"
#include "ballistica/python/class/python_class_collide_model.h"
#include "ballistica/python/class/python_class_context.h"
#include "ballistica/python/class/python_class_context_call.h"
#include "ballistica/python/class/python_class_data.h"
#include "ballistica/python/class/python_class_input_device.h"
#include "ballistica/python/class/python_class_material.h"
@ -34,8 +35,16 @@
#include "ballistica/python/class/python_class_session_player.h"
#include "ballistica/python/class/python_class_sound.h"
#include "ballistica/python/class/python_class_texture.h"
#include "ballistica/python/class/python_class_timer.h"
#include "ballistica/python/class/python_class_vec3.h"
#include "ballistica/python/class/python_class_widget.h"
#include "ballistica/python/methods/python_methods_app.h"
#include "ballistica/python/methods/python_methods_gameplay.h"
#include "ballistica/python/methods/python_methods_graphics.h"
#include "ballistica/python/methods/python_methods_input.h"
#include "ballistica/python/methods/python_methods_media.h"
#include "ballistica/python/methods/python_methods_system.h"
#include "ballistica/python/methods/python_methods_ui.h"
#include "ballistica/python/python_command.h"
#include "ballistica/python/python_context_call_runnable.h"
#include "ballistica/scene/node/node_attribute.h"
@ -928,7 +937,7 @@ void Python::Reset(bool do_init) {
// Set up system paths on our embedded platforms.
SetupPythonHome();
AppInternalInitModule();
AppInternalInitPythonModule();
Py_Initialize();
@ -971,7 +980,7 @@ void Python::Reset(bool do_init) {
// Import and grab all the Python stuff we use.
#include "generated/ballistica/binding.inc"
AppInternalPythonInit2();
AppInternalPythonPostInit();
// Alright I guess let's pull ba in to main, since pretty
// much all interactive commands will be using it.
@ -997,6 +1006,60 @@ void Python::Reset(bool do_init) {
}
}
auto Python::GetModuleMethods() -> std::vector<PyMethodDef> {
std::vector<PyMethodDef> all_methods;
for (auto&& methods : {
PythonMethodsUI::GetMethods(),
PythonMethodsInput::GetMethods(),
PythonMethodsApp::GetMethods(),
PythonMethodsGameplay::GetMethods(),
PythonMethodsGraphics::GetMethods(),
PythonMethodsMedia::GetMethods(),
PythonMethodsSystem::GetMethods(),
}) {
all_methods.insert(all_methods.end(), methods.begin(), methods.end());
}
return all_methods;
}
template <class T>
auto AddClass(PyObject* module) -> PyObject* {
T::SetupType(&T::type_obj);
BA_PRECONDITION(PyType_Ready(&T::type_obj) == 0);
Py_INCREF(&T::type_obj);
int r = PyModule_AddObject(module, T::type_name(),
reinterpret_cast<PyObject*>(&T::type_obj));
BA_PRECONDITION(r == 0);
return reinterpret_cast<PyObject*>(&T::type_obj);
}
auto Python::InitModuleClasses(PyObject* module) -> void {
// Init our classes and add them to our module.
AddClass<PythonClassNode>(module);
AddClass<PythonClassWidget>(module);
AddClass<PythonClassSessionPlayer>(module);
AddClass<PythonClassSessionData>(module);
AddClass<PythonClassActivityData>(module);
AddClass<PythonClassContext>(module);
AddClass<PythonClassContextCall>(module);
AddClass<PythonClassInputDevice>(module);
AddClass<PythonClassTimer>(module);
AddClass<PythonClassMaterial>(module);
AddClass<PythonClassTexture>(module);
AddClass<PythonClassSound>(module);
AddClass<PythonClassData>(module);
AddClass<PythonClassModel>(module);
AddClass<PythonClassCollideModel>(module);
PyObject* vec3 = AddClass<PythonClassVec3>(module);
// Register our vec3 as an abc.Sequence
auto register_call =
PythonRef(PyImport_ImportModule("collections.abc"), PythonRef::kSteal)
.GetAttr("Sequence")
.GetAttr("register");
PythonRef args(Py_BuildValue("(O)", vec3), PythonRef::kSteal);
BA_PRECONDITION(register_call.Call(args).exists());
}
void Python::PushObjCall(ObjID obj_id) {
g_game->PushCall([obj_id] {
ScopedSetContext cp(g_game->GetUIContext());

View File

@ -80,6 +80,10 @@ class Python {
void Reset(bool init = true);
/// Add classes to the newly created ba module.
static auto InitModuleClasses(PyObject* module) -> void;
static auto GetModuleMethods() -> std::vector<PyMethodDef>;
auto GetContextBaseString() -> std::string;
auto GetControllerValue(InputDevice* input_device,
const std::string& value_name) -> int;