Skip to content

Instantly share code, notes, and snippets.

@protocol LoadableDelegate;
@protocol Loadable
- (void) loadWithDelegate: (id <LoadableDelegate>) delegate;
- (BOOL) loadingUsesOpenGL;
@end
#import "Loadable.h"
@protocol LoadableDelegate
- (void) loadable: (id <Loadable>) ldble reportingProgress: (float) progrs;
@end
//
// Loader.m
// MatchUp
//
// Created by Thomas Visser on 12/06/2009.
// Copyright 2009 __MyCompanyName__. All rights reserved.
//
#import "Loader.h"
//
// Loader.h
// MatchUp
//
// Created by Thomas Visser on 12/06/2009.
// Copyright 2009 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "Loadable.h"
// Created by Thomas Visser on 10/10/2009.
#import "cocos2d.h"
#import "LoadableDelegate.h"
@class LoadProgressLayer, GameLayer;
@interface GameScene : Scene <LoadableDelegate> {
LoadProgressLayer * loadLayer; // a layer displaying the progress
GameLayer * gameLayer; // the layer that has to be loaded
// Created by Thomas Visser on 10/10/2009.
#import "GameScene.h"
#import "LoadProgressLayer.h"
#import "GameLayer.h"
#import "Loader.h"
@implementation GameScene
- (id) init {
// Created by Thomas Visser on 10/10/2009./
#import "cocos2d.h"
@interface LoadProgressLayer : Layer {
}
- (void) displayProgress: (float) prgs;
// Created by Thomas Visser on 10/10/2009.
#import "LoadProgressLayer.h"
@implementation LoadProgressLayer
- (void) displayProgress: (float) prgs {
// update a loading bar, but for now, we'll just NSLog the progress
NSLog(@"Displaying progress: %f", prgs);
// Created by Thomas Visser on 10/10/2009.
#import "cocos2d.h"
#import "Loadable.h"
#import "LoadableDelegate.h"
@interface GameLayer : Layer <Loadable, LoadableDelegate> {
NSArray * gameElements;
id loadDelegate;
}
// Created by Thomas Visser on 10/10/2009.
#import "GameLayer.h"
#import "LoadableDelegate.h"
#import "GraphicObject.h"
#import "Loader.h"
@implementation GameLayer
- (id) init {