Line data Source code
1 0 : /* 2 : 3 : OOGraphicsResetManager.h 4 : 5 : Tracks objects with state that needs to be reset when the graphics context is 6 : modified (for instance, when switching between windowed and full-screen mode 7 : in SDL builds). This means re-uploading all textures, and also resetting any 8 : display lists relying on old texture names. All objects which have display 9 : lists must therefore register with the OOGraphicsResetManager on init, and 10 : unregister on dealloc. 11 : 12 : 13 : Copyright (C) 2007-2013 Jens Ayton and contributors 14 : 15 : Permission is hereby granted, free of charge, to any person obtaining a copy 16 : of this software and associated documentation files (the "Software"), to deal 17 : in the Software without restriction, including without limitation the rights 18 : to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 : copies of the Software, and to permit persons to whom the Software is 20 : furnished to do so, subject to the following conditions: 21 : 22 : The above copyright notice and this permission notice shall be included in all 23 : copies or substantial portions of the Software. 24 : 25 : THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 : IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 : FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 : AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 : LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 : OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 : SOFTWARE. 32 : 33 : */ 34 : 35 : #import "OOCocoa.h" 36 : 37 : 38 : @protocol OOGraphicsResetClient 39 : 40 0 : - (void) resetGraphicsState; 41 : 42 : @end 43 : 44 : 45 0 : @interface OOGraphicsResetManager: NSObject 46 : { 47 : @private 48 0 : NSMutableSet *clients; 49 : } 50 : 51 0 : + (OOGraphicsResetManager *) sharedManager; 52 : 53 : // Clients are not retained. 54 0 : - (void) registerClient:(id<OOGraphicsResetClient>)client; 55 0 : - (void) unregisterClient:(id<OOGraphicsResetClient>)client; 56 : 57 : // Forwarded to all clients, after resetting textures. 58 0 : - (void) resetGraphicsState; 59 : 60 : @end