Advertisement
ZoriaRPG

script_bitmaps.cpp

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