Skip to content
Snippets Groups Projects
Commit f4e1561d authored by David Bergström's avatar David Bergström
Browse files

Add more docstrings

parent 411874e2
No related branches found
No related tags found
No related merge requests found
......@@ -19,7 +19,7 @@ void define_base_location(py::module & m)
py::class_<BaseLocationManager>(m, "BaseLocationManager")
.def_property_readonly("base_locations", &BaseLocationManager::getBaseLocations, py::return_value_policy::reference)
.def_property_readonly("starting_base_locations", &BaseLocationManager::getStartingBaseLocations, py::return_value_policy::reference)
.def("get_occupied_base_locations", &BaseLocationManager::getOccupiedBaseLocations, py::return_value_policy::reference)
.def("get_player_starting_base_location", &BaseLocationManager::getPlayerStartingBaseLocation, py::return_value_policy::copy)
.def("get_next_expansion", &BaseLocationManager::getNextExpansion, py::return_value_policy::copy);
.def("get_occupied_base_locations", &BaseLocationManager::getOccupiedBaseLocations, py::return_value_policy::reference, "player_constant"_a)
.def("get_player_starting_base_location", &BaseLocationManager::getPlayerStartingBaseLocation, py::return_value_policy::copy, "player_constant"_a)
.def("get_next_expansion", &BaseLocationManager::getNextExpansion, py::return_value_policy::copy, "player_constant"_a);
}
\ No newline at end of file
......@@ -6,15 +6,15 @@ void define_map_tools(py::module & m)
{
const CCColor white{ 255, 255, 255 };
py::class_<MapTools>(m, "MapTools")
.def_property_readonly("width", &MapTools::width)
.def_property_readonly("height", &MapTools::height)
.def_property_readonly("width", &MapTools::width, "The width of the map")
.def_property_readonly("height", &MapTools::height, "The height of the map")
//.def("terrainHeight", &MapTools::terrainHeight, py::const_)
.def("draw_line", py::overload_cast<const CCPosition &, const CCPosition &, const CCColor &>(&MapTools::drawLine, py::const_), py::arg("start"), py::arg("stop"), py::arg("color"))
//.def("draw_line", py::overload_cast<CCPositionType, CCPositionType, CCPositionType, CCPositionType, const CCColor &>(&MapTools::drawLine, py::const_)); // TODO: Default argument??
.def("draw_box", py::overload_cast<const CCPosition &, const CCPosition &, const CCColor &>(&MapTools::drawBox, py::const_), py::arg("top_left"), py::arg("bottom_right"), py::arg("color"))
.def("draw_circle", py::overload_cast<const CCPosition &, CCPositionType, const CCColor &>(&MapTools::drawCircle, py::const_), py::arg("center"), py::arg("radius"), py::arg("color"))
.def("draw_text", &MapTools::drawText)
.def("draw_text_screen", &MapTools::drawTextScreen);
.def("draw_text", &MapTools::drawText, "position"_a, "text"_a, "color"_a)
.def("draw_text_screen", &MapTools::drawTextScreen, "percentage_x"_a, "percentage_y"_a, "text"_a, "color"_a);
/*
TODO: Left to implement
......
......@@ -5,9 +5,9 @@ namespace py = pybind11;
void define_unit(py::module & m)
{
py::class_<Unit>(m, "Unit")
.def_property_readonly("unit_type", &Unit::getType)
.def_property_readonly("position", &Unit::getPosition)
.def_property_readonly("tile_position", &Unit::getTilePosition)
.def_property_readonly("unit_type", &Unit::getType, "The :class:`library.UnitType` of the unit")
.def_property_readonly("position", &Unit::getPosition, "The class:`library.Point2D` of the unit")
.def_property_readonly("tile_position", &Unit::getTilePosition, "The :class:`library.Point2DI` of the unit")
.def_property_readonly("hit_points", &Unit::getHitPoints)
.def_property_readonly("shields", &Unit::getShields)
.def_property_readonly("energy", &Unit::getEnergy)
......
......@@ -18,9 +18,9 @@ PYBIND11_MODULE(library, m)
py::class_<Coordinator>(m, "Coordinator")
.def(py::init())
.def("set_participants", &sc2::Coordinator::SetParticipants)
.def("set_participants", &sc2::Coordinator::SetParticipants, "participants"_a)
.def("launch_starcraft", &sc2::Coordinator::LaunchStarcraft)
.def("start_game", &sc2::Coordinator::StartGame)
.def("start_game", &sc2::Coordinator::StartGame, "map_path"_a)
.def("update", &sc2::Coordinator::Update);
py::enum_<sc2::Race>(m, "Race")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment