bbgraphics.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. #ifndef BBGRAPHICS_H
  2. #define BBGRAPHICS_H
  3. #include "bbsys.h"
  4. #include "../gxruntime/gxgraphics.h"
  5. extern gxGraphics *gx_graphics;
  6. extern gxCanvas *gx_canvas;
  7. extern gxScene *gx_scene;
  8. class bbImage;
  9. //general graphics functions
  10. int bbCountGfxDrivers();
  11. BBStr * bbGfxDriverName( int n );
  12. BBStr * bbGfxDriverDesc( int n );
  13. void bbSetGfxDriver( int n );
  14. int bbGfxModeExists( int w,int h,int d );
  15. int bbCountGfxModes();
  16. int bbGfxModeWidth( int n );
  17. int bbGfxModeHeight( int n );
  18. int bbGfxModeDepth( int n );
  19. int bbGraphicsWidth();
  20. int bbGraphicsHeight();
  21. int bbGraphicsDepth();
  22. int bbAvailVidMem();
  23. int bbTotalVidMem();
  24. //mode functions
  25. void bbGraphics( int w,int h,int d,int mode );
  26. gxCanvas * bbFrontBuffer();
  27. gxCanvas * bbBackBuffer();
  28. void bbEndGraphics();
  29. int bbGraphicsLost();
  30. int bbScanLine();
  31. void bbVWait( int n );
  32. void bbFlip( int vwait );
  33. //graphics buffer functions
  34. void bbSetBuffer( gxCanvas *buff );
  35. gxCanvas * bbGraphicsBuffer();
  36. int bbLoadBuffer( gxCanvas *surf,BBStr *str );
  37. int bbSaveBuffer( gxCanvas *surf,BBStr *str );
  38. //fast read/write operations...
  39. void bbLockBuffer( gxCanvas *buff );
  40. void bbUnlockBuffer( gxCanvas *buff );
  41. int bbReadPixel( int x,int y,gxCanvas *buff );
  42. void bbWritePixel( int x,int y,int argb,gxCanvas *buff );
  43. int bbReadPixelFast( int x,int y,gxCanvas *buff );
  44. void bbWritePixelFast( int x,int y,int argb,gxCanvas *buff );
  45. //2d rendering functions
  46. void bbOrigin( int x,int y );
  47. void bbViewport( int x,int y,int w,int h );
  48. void bbColor( int r,int g,int b );
  49. void bbClsColor( int r,int g,int b );
  50. void bbCls();
  51. void bbPlot( int x,int y );
  52. void bbLine( int x1,int y1,int x2,int y2 );
  53. void bbRect( int x,int y,int w,int h,int solid );
  54. void bbOval( int x,int y,int w,int h,int solid );
  55. void bbText( int x,int y,BBStr *str,int centre_x,int centre_y );
  56. void bbGetColor( int x,int y );
  57. int bbColorRed();
  58. int bbColorGreen();
  59. int bbColorBlue();
  60. //font functions
  61. gxFont * bbLoadFont( BBStr *name,int height,int bold,int italic,int underline );
  62. void bbFreeFont( gxFont *f );
  63. void bbSetFont( gxFont *f );
  64. int bbFontWidth();
  65. int bbFontHeight();
  66. int bbStringWidth( BBStr *str );
  67. int bbStringHeight( BBStr *str );
  68. //image functions
  69. bbImage* bbLoadImage( BBStr *s );
  70. bbImage* bbCopyImage( bbImage *i );
  71. bbImage* bbCreateImage( int w,int h,int n );
  72. bbImage* bbLoadAnimImage( BBStr *s,int w,int h,int first,int cnt );
  73. void bbFreeImage( bbImage *i );
  74. int bbSaveImage( bbImage *i,BBStr *filename,int frame );
  75. void bbGrabImage( bbImage *i,int x,int y,int n );
  76. gxCanvas * bbImageBuffer( bbImage *i,int n );
  77. void bbDrawImage( bbImage *i,int x,int y,int frame );
  78. void bbDrawBlock( bbImage *i,int x,int y,int frame );
  79. void bbTileImage( bbImage *i,int x,int y,int frame );
  80. void bbTileBlock( bbImage *i,int x,int y,int frame );
  81. void bbDrawImageRect( bbImage *i,int x,int y,int r_x,int r_y,int r_w,int r_h,int frame );
  82. void bbDrawBlockRect( bbImage *i,int x,int y,int r_x,int r_y,int r_w,int r_h,int frame );
  83. void bbMaskImage( bbImage *i,int r,int g,int b );
  84. void bbHandleImage( bbImage *i,int x,int y );
  85. void bbScaleImage( bbImage *i,float w,float h );
  86. void bbResizeImage( bbImage *i,float w,float h );
  87. void bbRotateImage( bbImage *i,float angle );
  88. void bbTFormImage( bbImage *i,float a,float b,float c,float d );
  89. void bbTFormFilter( int enable );
  90. void bbAutoMidHandle( int enable );
  91. void bbMidHandle( bbImage *i );
  92. int bbImageWidth( bbImage *i );
  93. int bbImageHeight( bbImage *i );
  94. int bbImageXHandle( bbImage *i );
  95. int bbImageYHandle( bbImage *i );
  96. int bbImagesOverlap( bbImage *i1,int x1,int y1,bbImage *i2,int x2,int y2 );
  97. int bbImagesCollide( bbImage *i1,int x1,int y1,int f1,bbImage *i2,int x2,int y2,int f2 );
  98. int bbRectsOverlap( int x1,int y1,int w1,int h1,int x2,int y2,int w2,int h2 );
  99. int bbImageRectOverlap( bbImage *i,int x,int y,int r_x,int r_y,int r_w,int r_h );
  100. int bbImageRectCollide( bbImage *i,int x,int y,int f,int r_x,int r_y,int r_w,int r_h );
  101. //simple print functions
  102. void bbWrite( BBStr *str );
  103. void bbPrint( BBStr *str );
  104. BBStr * bbInput( BBStr *prompt );
  105. void bbLocate( int x,int y );
  106. #endif