ZoriaRPG

Script Created Bitmaps

Oct 21st, 2018
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | None | 0 0
  1. //18-Sept-2018
  2.  
  3. class ffscript
  4. {
  5.     typedef struct user_bitmap
  6.     {
  7.         BITMAP *u_bmp;
  8.         int width;
  9.         int height;
  10.         int depth = 8;
  11.     }
  12.     #define MAX_USER_BITMAPS 256
  13.     typedef struct script_bitmaps
  14.     {
  15.         int num_active = 0;
  16.         user_bitmap[MAX_USER_BITMAPS];
  17.     }
  18.    
  19.     int get_free_bitmap()
  20.     {
  21.         int num_free = mscript_bitmaps.num_active;
  22.         if ( num_free < ( MAX_USER_BITMAPS-1 )
  23.         {
  24.             ++script_bitmaps.num_active;
  25.             return num_free;
  26.         }
  27.         return 0;
  28.     }
  29.     long create_user_bitmap_ex(int w, int h, int d, ...)
  30.     {
  31.         int id = get_free_bitmap();
  32.         if ( id > 0 )
  33.         {
  34.             script_bitmaps.user_bitmap[id].width = w;
  35.             script_bitmaps.user_bitmap[id].height = h;
  36.             script_bitmaps.user_bitmap[id].depth = d;
  37.             script_bitmaps.user_bitmap[id].u_bmp = CreateBitmapEx(...args);
  38.         }
  39.     }
  40. }
Add Comment
Please, Sign In to add comment