Skip to content
Snippets Groups Projects
library.cpp 805 B
Newer Older
  • Learn to ignore specific revisions
  • #include <pybind11/pybind11.h>
    #include <sc2api/sc2_api.h>
    #include "src/IDABot.h"
    #include <iostream>
    
    void run()
    {
        char *argv[] = { "executable", NULL};
        int argc = sizeof(argv) / sizeof(char*) - 1;
        sc2::Coordinator coordinator;
        coordinator.LoadSettings(argc, argv);
    
        IDABot bot;
        coordinator.SetParticipants({
            CreateParticipant(sc2::Race::Terran, &bot),
            sc2::CreateComputer(sc2::Race::Zerg)
            });
    
        coordinator.LaunchStarcraft();
        coordinator.StartGame("InterloperTest.SC2Map");
    
        while (coordinator.Update()) {
        }
    }
    
    int add(int i, int j)
    {
        return i + j + 1;
    }
    
    PYBIND11_MODULE(library, m)
    {
        m.doc() = "pybind11 example plugin";
        m.def("add", &add, "A function which adds two numbers");
        m.def("run", &run, "Start Starcraft 2");
    }