1
0
mirror of https://github.com/thes3m/XNI synced 2024-12-26 13:26:06 +01:00
XNI/Classes/Retronator/Xni/Framework/DrawableGameComponent.m
Matej Jan d04d7bf8f3 All around update and fixes
git-svn-id: http://xni.googlecode.com/svn/XNI@104 ac433895-eea3-a490-d80a-17149a75e588
2012-05-14 08:40:49 +00:00

83 lines
1.5 KiB
Objective-C

//
// DrawableGameComponent.m
// XNI
//
// Created by Matej Jan on 12.10.10.
// Copyright 2010 Retronator. All rights reserved.
//
#import "DrawableGameComponent.h"
#import "System.h"
#import "Retronator.Xni.Framework.h"
#import "Retronator.Xni.Framework.Graphics.h"
@implementation DrawableGameComponent
- (id) initWithGame:(Game *)theGame {
if (self = [super initWithGame:theGame]) {
visible = YES;
drawOrder = 0;
visibleChanged = [[Event alloc] init];
drawOrderChanged = [[Event alloc] init];
graphicsDeviceService = [self.game.services getServiceOfType:[Protocols graphicsDeviceService]];
}
return self;
}
@synthesize visible;
- (void) setVisible:(BOOL)value {
if (visible != value) {
visible = value;
[self onVisibleChanged];
}
}
@synthesize drawOrder;
- (void) setDrawOrder:(int)value {
if (drawOrder != value) {
drawOrder = value;
[self onDrawOrderChanged];
}
}
@synthesize visibleChanged;
@synthesize drawOrderChanged;
- (GraphicsDevice*) graphicsDevice {
return graphicsDeviceService.graphicsDevice;
}
- (void) initialize {
if (!contentLoaded) {
[self loadContent];
contentLoaded = YES;
}
}
- (void) loadContent {}
- (void) drawWithGameTime:(GameTime*)gameTime {}
- (void) unloadContent {}
- (void)onVisibleChanged {
[visibleChanged raiseWithSender:self];
}
- (void)onDrawOrderChanged {
[drawOrderChanged raiseWithSender:self];
}
- (void) dealloc
{
if (contentLoaded) {
[self unloadContent];
}
[drawOrderChanged release];
[visibleChanged release];
[super dealloc];
}
@end