Advertisement
joric

Oldschool virtual methods

Sep 19th, 2011
306
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.50 KB | None | 0 0
  1. typedef struct {   
  2.     void (*systemSleep)(long ms);  
  3.     long (*currentTimeMillis)();
  4.     void* (*createPrimarySurface)();
  5.     void* (*createSurface)(int width, int height);
  6.     void (*getSystemPath)(char *buf, char *name);
  7.     void* (*loadSurfaceFromFile)(char * name);
  8.     void (*blitSurface)(void * dest, void * src, int x, int y);
  9.     void (*blitSurfaceRegion)(void * dest, void * src, int x, int y, int dx, int dy, int w, int h);
  10.     void (*flipSurface)(void * surface);
  11.     void (*fillSurfaceRect)(void * surface, int x, int y, int w, int h, int color);
  12.     void (*surfaceClip)(void * surface, int i, int j, int k, int l);
  13.     void (*surfaceAlpha)(void * surface, int alpha);
  14.     int (*getSurfaceWidth)(void * surface);
  15.     int (*getSurfaceHeight)(void * surface);
  16.     int (*processEvents)();
  17.     int (*loadSound)(char *name, int type, int id);
  18.     void (*playSound)(int id, int loops);
  19.     void (*stopSound)(int id); 
  20.     void (*freeSound)(int id); 
  21.     void (*setSoundVolume)(int id, int volume);
  22.     void (*getDocumentPath)(char *buf, char *name);
  23.     void (*platformRequest)(char *wapLink);
  24.     void (*quit)();
  25. } refexport_t;
  26.  
  27. typedef struct {
  28.     void (*init)();
  29.     void (*tick)();
  30.     void (*paint)();
  31.     void (*keyPressed)(int code);
  32.     void (*keyReleased)(int code);
  33.     void (*pointerPressed)(int x, int y);
  34.     void (*pointerReleased)(int x, int y);
  35.     void (*pointerDragged)(int x, int y);
  36.     void (*startApp)();
  37.     void (*pauseApp)();
  38.     void (*quit)();        
  39. } refimport_t;
  40.  
  41.  
  42. //dll exports the only function:
  43. refimport_t * GetRefAPI( int apiVersion, refexport_t *rexp );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement