Overview
Comment: | Pass the display on events. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
f309ba2b336aff8fa1006a6bb4be85e1 |
User & Date: | js on 2012-08-20 01:18:05 |
Other Links: | manifest | tags |
Context
2012-08-26
| ||
10:09 | Use flags for -[OGKDisplay init...]. check-in: 40c2d53ff0 user: js tags: trunk | |
2012-08-20
| ||
01:18 | Pass the display on events. check-in: f309ba2b33 user: js tags: trunk | |
2012-08-19
| ||
23:08 | New OGKDisplay methods. check-in: e1d3ff7a4f user: js tags: trunk | |
Changes
Modified src/OGKDisplay.h from [25cd74c4c2] to [1753a97d4c].
︙ | |||
26 27 28 29 30 31 32 33 34 35 36 37 38 39 | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | + | { ALLEGRO_DISPLAY *display; } @property (assign) of_point_t windowPosition; @property (assign) of_dimension_t size; + OGK_displayForAllegroDisplay: (ALLEGRO_DISPLAY*)display; - initWithSize: (of_dimension_t)size position: (of_point_t)position fullscreen: (BOOL)fullscreen resizable: (BOOL)resizable; - (void)setWindowTitle: (OFString*)title; - (void)update; - (ALLEGRO_DISPLAY*)OGK_allegroDisplay; |
︙ |
Modified src/OGKDisplay.m from [3e2683ad84] to [fbfc273e25].
︙ | |||
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | + + + + + + + + + + + + + + + + + + + + + + + + + + | * 2.) Altered source versions must be plainly marked as such, and must not * be misrepresented as being the original software. * 3.) This notice may not be removed or altered from any source distribution. */ #import "OGKDisplay.h" static OFMutex *mutex = nil; static OFMutableArray *displays = nil; static OFDataArray *allegroDisplays = nil; @implementation OGKDisplay + (void)initialize { if (self != [OGKDisplay class]) return; if (!al_install_system(ALLEGRO_VERSION_INT, NULL)) @throw [OFInitializationFailedException exceptionWithClass: self]; mutex = [[OFMutex alloc] init]; displays = [[OFMutableArray alloc] init]; allegroDisplays = [[OFDataArray alloc] initWithItemSize: sizeof(ALLEGRO_DISPLAY*)]; } + OGK_displayForAllegroDisplay: (ALLEGRO_DISPLAY*)display { [mutex lock]; @try { ALLEGRO_DISPLAY **cArray = [allegroDisplays cArray]; size_t i, count = [allegroDisplays count]; for (i = 0; i < count; i++) if (cArray[i] == display) return [displays objectAtIndex: i]; } @finally { [mutex unlock]; } return nil; } - initWithSize: (of_dimension_t)size position: (of_point_t)position fullscreen: (BOOL)fullscreen resizable: (BOOL)resizable { |
︙ | |||
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | + + + + + + + + + + + + + + + + + + | al_set_new_display_flags(flags); display = al_create_display(size.width, size.height); if (display == NULL) @throw [OFInitializationFailedException exceptionWithClass: [self class]]; [mutex lock]; @try { [allegroDisplays addItem: &display]; [displays addObject: self]; } @finally { [mutex unlock]; } return self; } - (void)dealloc { [mutex lock]; @try { size_t index = [displays indexOfObject: self]; [allegroDisplays removeItemAtIndex: index]; [displays removeObjectAtIndex: index]; } @finally { [mutex unlock]; } if (display != NULL) al_destroy_display(display); } - (void)setWindowTitle: (OFString*)title { al_set_window_title(display, |
︙ |
Modified src/OGKEventQueue.h from [e90f6c2f9f] to [b38728a4f6].
︙ | |||
23 24 25 26 27 28 29 | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | + - + - - - - - - + + + + + + + + + + | #import <ObjFW/ObjFW.h> #import "OGKEvent.h" #import "OGKDisplay.h" @protocol OGKEventQueueDelegate <OFObject> @optional - (void)display: (OGKDisplay*)display |
︙ |
Modified src/OGKEventQueue.m from [8d48ecf372] to [7219e86adc].
︙ | |||
59 60 61 62 63 64 65 | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | - - - + + + + + + + + + + - - - + + + + + + + + + + - - - + + + + + + + + + + - - - + + + + + + + + + + - - - + + + + + + + + + + - - - + + + + + + + + + + | while (al_get_next_event(eventQueue, allegroEvent)) { switch (allegroEvent->type) { case ALLEGRO_EVENT_DISPLAY_CLOSE: object_setClass(event, [OGKCloseEvent class]); if ([delegate respondsToSelector: |
︙ |
Modified test/TestMain.h from [0399db4bce] to [150ee79de4].
︙ | |||
25 26 27 28 29 30 31 32 33 34 | 25 26 27 28 29 30 31 32 33 34 35 | + | #import "OGKBitmap.h" @interface TestMain: OFObject <OFApplicationDelegate, OGKEventQueueDelegate> { OGKDisplay *display; OGKEventQueue *eventQueue; OGKBitmap *bitmap; of_point_t position; BOOL running; } @end |
Modified test/TestMain.m from [bc217b5c18] to [003d86a89e].
︙ | |||
23 24 25 26 27 28 29 | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | + - + + + + + + + + - + | #import "OGKEventQueue.h" #import "OGKBitmap.h" #import "TestMain.h" OF_APPLICATION_DELEGATE(TestMain) @implementation TestMain - (void)display: (OGKDisplay*)display |
︙ |