Differences From Artifact [d4949e0576]:
- File src/OGKBitmap.m — part of check-in [2a081e62c9] at 2012-08-19 22:49:57 on branch trunk — Add OGKBitmap. (user: js, size: 2368) [annotate] [blame] [check-ins using]
To Artifact [ffce6aad92]:
- File
src/OGKBitmap.m
— part of check-in
[4719f25709]
at
2012-08-26 12:17:52
on branch trunk
— Only call al_*_destroy if Allegro is initialized.
Otherwise, it would crash if al_uinstall_system() has already been
called. Handling it this way eliminates the need to dealloc all objects
before calling al_uninstall_system(), which meant that it was the users
repsonsibility to call al_uninstall_system() after the user made sure
all objects are deallocated. Now the user does not get to see any
al_*() function. (user: js, size: 2427) [annotate] [blame] [check-ins using]
︙ | |||
28 29 30 31 32 33 34 | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | - - + | @implementation OGKBitmap + (void)initialize { if (self != [OGKBitmap class]) return; |
︙ | |||
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | + + + + + + | if (bitmap == NULL) @throw [OFInitializationFailedException exceptionWithClass: [self class]]; return self; } - (void)dealloc { if (bitmap != NULL && al_is_system_installed()) al_destroy_bitmap(bitmap); } - (void)drawAtPosition: (of_point_t)position { al_draw_bitmap(bitmap, position.x, position.y, 0); } - (ALLEGRO_BITMAP*)OGK_allegroBitmap { return bitmap; } @end |