OPTPiX SpriteStudio SDK
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
package_SpriteStudio.h
1 #ifndef __PACKAGE_SPRITESTUDIO__
2 #define __PACKAGE_SPRITESTUDIO__
3 
4 #define BOOST_PYTHON_STATIC_LIB
5 #include <stdio.h>
6 #include <Python.h>
7 #include <boost/python.hpp>
8 
9 #include <fstream>
10 #include <iostream>
11 #include <sstream>
12 
13 using namespace boost::python;
14 using namespace std;
15 
16 
17 
18 
19 
20 void PYDEBUG_PRINTF( const char* strFormat, ... );
21 
22 
23 template<class myclass>
25 {
26 public:
27  myclass* bind_inst;
28 
29  myPyBinder(){}
30 
31  virtual ~myPyBinder(){}
32  virtual bool debug(){ return true; }
33  void bind(myclass* c) { bind_inst = c;}
34  bool isNull(){ return bind_inst ==0 ; }
35 };
36 
37 
38 
39 #define BIND_RETURN_PROP( _a ) this->bind_inst->_a
40 #define BIND_RETURN_PROPEX( type, _a ) type _a() { return (type)this->bind_inst->_a; }
41 #define BIND_NEW_PROP( type, _a ) \
42  type* _a() { \
43  type* new_type = new type();\
44  new_type->bind(bind_inst->_a);\
45  return new_type;\
46  }\
47 
48 
49 #define BIND_NEW_PROP_REF( type, _a ) \
50  type* _a() { \
51  type* new_type = new type();\
52  new_type->bind(&bind_inst->_a);\
53  return new_type;\
54  }\
55 
56 
57 #if 1
58 
59 inline void _bp_array_resize( boost::python::numeric::array& _array , int x , int y)
60 {
61  if ( y == 0 )
62  {
63  _array.resize( x );
64  }else{
65  _array.resize( boost::python::make_tuple(x, y) );
66  }
67 }
68 
69 #define BIND_RETURN_PROPEX_ARRAY( type , _a ,_dx,_dy) \
70  boost::python::numeric::array _a() { \
71  std::vector<type> array_;\
72  size_t len = sizeof(this->bind_inst->_a) / sizeof(type);\
73  for ( size_t i = 0 ; i < len ; i++ )\
74  {\
75  array_.push_back(this->bind_inst->_a[i]);\
76  }\
77  boost::python::numeric::array _aa(array_);\
78  _bp_array_resize( _aa , _dx , _dy );\
79  return _aa; }\
80 
81 #else
82 
83 #define BIND_RETURN_PROPEX_ARRAY( type , _a ) \
84  boost::python::numeric::array _a() { \
85  boost::python::numeric::array _aa(this->bind_inst->_a);\
86  _aa.resize( 12 );\
87  return _aa; }\
88 
89 #endif
90 
91 
92 #include "ssloader.h"
93 
94 
95 #include "bind_Animation.h"
96 #include "bind_SsAnimeDecoder.h"
97 #include "bind_SsAttribute.h"
98 #include "bind_AnimePack.h"
99 #include "bind_SsPart.h"
100 #include "bind_SsPartAnime.h"
101 #include "bind_SSXML.h"
102 
103 #include "bind_SsKeyframe.h"
104 #include "bind_Cellmap.h"
105 
106 
107 #endif