Source

pygamekit / prerequisites.pxd

# C defines that are too small or don't fit anywhere else

from libcpp cimport bool
from cpython cimport bool as pybool

cdef extern from "stdlib.h":
     void *memcpy(void *dst, void *src, long n)

cdef extern from "time.h":
    int usleep(int usec)
     
cdef enum TransformOrientation:
    TRANSFORM_LOCAL,
    TRANSFORM_PARENT,
    TRANSFORM_WORLD
    
cdef extern from "gkCommon.h":

    ctypedef float gkScalar

    enum:
        GK_PLATFORM_WIN32
        GK_PLATFORM_APPLE
        GK_PLATFORM_APPLE_IOS
        GK_PLATFORM_LINUX
        GK_PLATFORM_ANDROID
        GK_PLATFORM

    cppclass gkClock "Ogre::Timer":
        void reset()
        unsigned long int getMilliseconds()
        unsigned long int getMicroseconds()
        
#cdef extern from "math.h":
    #int isnan(double x)

# TODO WARNING: some compilers may optimize this to False
# Check with this:
#print "isnan test successful:",isnan(float('nan'))!=0
cdef inline int isnan "_gk_isnan"(gkScalar f):
    return f!=f
        
cdef extern from "gkUtils.h" namespace "gkUtils":
    cdef gkString getUniqueName(gkString&)
        
cdef extern from "utTypes.h":
    ctypedef unsigned int UTsize  # not exactly true
    
    cppclass utArray[T]:
        utArray()
        utArray(utArray[T]& o)
        void clear(bool useCache=*)
        UTsize find(T &v)
        void push_back(T &v)
        void pop_back()
        erase(T &v)
        erase(UTsize pos)
        resize(UTsize nr)
        resize(UTsize nr, T &fill)
        reserve(UTsize nr)
        sort(bool (*cmp)(T &a, T &b))
        T &getitem "&operator[]"(UTsize idx)
        T operator[](UTsize idx)
        UTsize capacity()
        UTsize size()
        
    cppclass utArrayIterator[T]:
        utArrayIterator()
        utArrayIterator(utArray[T])
        bool   hasMoreElements()
        T      getNext()
        void   next()
        T      peekNext()
        
    cppclass utStack[T]:
        utStack()
        utStack(utStack &o)
        void clear()
        void push(T &v)
        T &pop()
        T &top()
        T &peek(UTsize offset)
        UTsize size()
        UTsize itop()
        bool empty()
        
        
cdef extern from "gkString.h": 
    cppclass gkString: 
        gkString()
        gkString(char*)
        char* c_str()
        gkString& assign ( gkString& str )
        gkString& assign ( gkString& str, size_t pos, size_t n )
        gkString& assign ( char* s, size_t n )
        gkString& assign ( char* s )
        gkString& assign ( size_t n, char c )
        
    ctypedef utArray[gkString] gkStringVector
    #ctypedef utArrayIterator[gkString] gkStringVectorIterator
    cppclass gkStringVectorIterator:
        gkStringVectorIterator()
        gkStringVectorIterator(gkStringVector)
        bool     hasMoreElements()
        gkString getNext()
        void     next()
        gkString peekNext()

    
    
from libcpp.vector cimport vector

cdef extern from *:
    ctypedef char* const_char_ptr "const char*"

    cppclass gkColor:
        gkColor(float r, float g, float b, float a)
        gkColor(float r, float g, float b)
        
    ctypedef gkColor Ogre_ColourValue "Ogre::ColourValue"
        
    cdef cppclass gkHashedString:
        gkHashedString(gkString&)
        gkString &str()
        
    ctypedef gkHashedString const_gkHashedString "const gkHashedString"
    
    #cdef cppclass Ogre_StringVector "Ogre::StringVector":
        #void push_back(gkString)
    ##TODO: with cython>0.15.1, replace the lines above with the lines below
    ctypedef vector[gkString] Ogre_StringVector "Ogre::StringVector"

cdef enum OgreRenderSystem:
    OGRE_RS_GL
    OGRE_RS_GLES
    OGRE_RS_D3D9
    OGRE_RS_D3D10
    OGRE_RS_D3D11
    OGRE_RS_UNKNOWN
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.