Skip to content
Snippets Groups Projects
library.h 1.34 KiB
Newer Older
#pragma once

#include <pybind11/pybind11.h>
#include <sc2api/sc2_api.h>
#include <iostream>
#include <pybind11/stl.h> /* Automatic conversion from std::vector to Python lists */
#include <pybind11/operators.h> /* Convenient operator support */
// Wrapper class since the initialization uses pure argc/argv and these cannot be wrapped into Python correctly
class Coordinator : public sc2::Coordinator
{
public:
    // TODO: We might not always want default value when we run on Linux
    Coordinator() : sc2::Coordinator()
    {
        char *argv[] = { "executable", NULL};
        int argc = sizeof(argv) / sizeof(char*) - 1;
        LoadSettings(argc, argv);
    }
class PyIDABot : public IDABot
{
public:
    using IDABot::IDABot;
    void OnGameStart() override
    {
        PYBIND11_OVERLOAD(
            void,
            IDABot,
            OnGameStart
        );
    }
    void OnStep() override
    {
        PYBIND11_OVERLOAD(
            void,
            IDABot,
            OnStep
        );
    }
    void OnStep_UpdateIDABot() override
    {
        PYBIND11_OVERLOAD(
            void,
            IDABot,
            OnStep_UpdateIDABot
        );
    }
};

void define_typeenums(pybind11::module & m);
void define_unit(pybind11::module & m);
void define_unittype(pybind11::module &m);
void define_util(pybind11::module &m);