split py files
[android/external-libkmsxx.git] / py / pykms.cpp
1 #include <pybind11/pybind11.h>
2 #include <pybind11/stl.h>
3 #include <kms++.h>
5 namespace py = pybind11;
7 using namespace kms;
8 using namespace std;
10 void init_pykmstest(py::module &m);
11 void init_pykmsbase(py::module &m);
13 class PyPageFlipHandlerBase : PageFlipHandlerBase
14 {
15 public:
16         using PageFlipHandlerBase::PageFlipHandlerBase;
18         virtual void handle_page_flip(uint32_t frame, double time)
19         {
20                 PYBIND11_OVERLOAD_PURE(
21                                         void,                /* Return type */
22                                         PageFlipHandlerBase, /* Parent class */
23                                         handle_page_flip,    /* Name of function */
24                                         frame, time
25                                         );
26         }
27 };
29 PYBIND11_PLUGIN(pykms) {
30         py::module m("pykms", "kms bindings");
32         init_pykmsbase(m);
34         py::class_<PyPageFlipHandlerBase>(m, "PageFlipHandlerBase")
35                         .alias<PageFlipHandlerBase>()
36                         .def(py::init<>())
37                         .def("handle_page_flip", &PageFlipHandlerBase::handle_page_flip)
38                         ;
40         init_pykmstest(m);
42         return m.ptr();
43 }