Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
sebcode committed Aug 5, 2015
0 parents commit 8beec3f
Show file tree
Hide file tree
Showing 809 changed files with 104,388 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FinalFighter.xcodeproj/project.xcworkspace/
FinalFighter.xcodeproj/xcuserdata/
.DS_Store
17 changes: 17 additions & 0 deletions FinalFighter-iphone/AppDelegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// AppDelegate.h
// FinalFighter-iphone
//
// Created by Sebastian Volland on 08.10.12.
// Copyright __MyCompanyName__ 2012. All rights reserved.
//

@class LandscapeNavigationController;

@interface AppController : NSObject <UIApplicationDelegate, CCDirectorDelegate>

@property (nonatomic, strong) UIWindow *window;
@property (readonly) LandscapeNavigationController *navController;
@property (readonly) CCDirectorIOS *director;

@end
189 changes: 189 additions & 0 deletions FinalFighter-iphone/AppDelegate.mm
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
//
// AppDelegate.mm
// FinalFighter-iphone
//
// Created by Sebastian Volland on 08.10.12.
// Copyright __MyCompanyName__ 2012. All rights reserved.
//

#import "cocos2d.h"
#import "AppDelegate.h"
#import "MenuLayer.h"
#import "WorldLayer.h"
#import "GameLevelTutorial.h"
#import "GameLevelFragtemple.h"
#import "GameLevelYerLethalMetal.h"
#import "GameDebug.h"
#import "GameMusicPlayer.h"
#import "GameSoundPlayer.h"
#import "GameStats.h"
#import "GameChallengeManager.h"
#import "LandscapeNavigationController.h"

@implementation AppController

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
//#if DEBUG
// ****************************
// /* CHEAT FOR DEBUG */
// GameChallengeManager *gcm = [GameChallengeManager getInstance];
// [gcm markAllAsDone];
// ****************************
// [[GameCenterManager sharedInstance] resetAchievements];
// ****************************
// NSString *appDomain = [[NSBundle mainBundle] bundleIdentifier];
// [[NSUserDefaults standardUserDefaults] removePersistentDomainForName:appDomain];
// ****************************
//#endif

// Create the main window
_window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

[self startGame];

#ifndef DEBUG
#if !(TARGET_IPHONE_SIMULATOR)
/* splash screen laenger anzeigen */
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
[NSThread sleepForTimeInterval:1.0];
}
#endif
#endif

return YES;
}

- (void)startGame
{
CGRect bounds = [_window bounds];

// Create an CCGLView with a RGB565 color buffer, and a depth buffer of 0-bits
CCGLView *glView = [CCGLView viewWithFrame:bounds
pixelFormat:kEAGLColorFormatRGB565 //kEAGLColorFormatRGBA8
depthFormat:0 //GL_DEPTH_COMPONENT24_OES
preserveBackbuffer:NO
sharegroup:nil
multiSampling:NO
numberOfSamples:0];

// Enable multiple touches
[glView setMultipleTouchEnabled:YES];
_director = (CCDirectorIOS*) [CCDirector sharedDirector];
_director.wantsFullScreenLayout = YES;

#ifdef DISPLAY_STATS
[_director setDisplayStats:YES];
#endif

[_director setAnimationInterval:1.0/60];
[_director setView:glView];
[glView setMultipleTouchEnabled:YES];
[_director setDelegate:self];
[_director setProjection:kCCDirectorProjection2D];
[_director enableRetinaDisplay:NO];

[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"menu.plist"];
[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"sprites.plist"];

// Default texture format for PNG/BMP/TIFF/JPEG/GIF images
// It can be RGBA8888, RGBA4444, RGB5_A1, RGB565
// You can change anytime.
[CCTexture2D setDefaultAlphaPixelFormat:kCCTexture2DPixelFormat_RGBA8888];

// If the 1st suffix is not found and if fallback is enabled then fallback suffixes are going to searched. If none is found, it will try with the name without suffix.
// On iPad HD : "-ipadhd", "-ipad", "-hd"
// On iPad : "-ipad", "-hd"
// On iPhone HD: "-hd"
CCFileUtils *sharedFileUtils = [CCFileUtils sharedFileUtils];
[sharedFileUtils setEnableFallbackSuffixes:NO]; // Default: NO. No fallback suffixes are going to be used
[sharedFileUtils setiPhoneRetinaDisplaySuffix:@"-hd"]; // Default on iPhone RetinaDisplay is "-hd"
[sharedFileUtils setiPadSuffix:@"-ipad"]; // Default on iPad is "ipad"
[sharedFileUtils setiPadRetinaDisplaySuffix:@"-ipadhd"]; // Default on iPad RetinaDisplay is "-ipadhd"

// Assume that PVR images have premultiplied alpha
[CCTexture2D PVRImagesHavePremultipliedAlpha:YES];

[self readUserDefaults];

[GameMusicPlayer getInstance];
[GameSoundPlayer getInstance];

GameStats *stats = [GameStats getInstance];
[stats incInt:@"startups"];

_navController = [[LandscapeNavigationController alloc] initWithRootViewController:_director];
_navController.navigationBarHidden = YES;
[_window setRootViewController:_navController];
[_window makeKeyAndVisible];

CCScene *scene = START_SCENE;
[_director pushScene: scene];
}

- (void)readUserDefaults
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

NSDictionary *def = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:100], @"SoundVolume",
[NSNumber numberWithInt:100], @"MusicVolume",
nil];

[defaults registerDefaults:def];
}

- (NSUInteger)application:(UIApplication*)application supportedInterfaceOrientationsForWindow:(UIWindow*)window
{
return UIInterfaceOrientationMaskAllButUpsideDown;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}

- (void)applicationWillResignActive:(UIApplication *)application
{
if ([_navController visibleViewController] == _director) {
[_director pause];
}
}

- (void)applicationDidBecomeActive:(UIApplication *)application
{
if ([_navController visibleViewController] == _director) {
[_director resume];
}
}

- (void)applicationDidEnterBackground:(UIApplication*)application
{
if ([_navController visibleViewController] == _director) {
[_director stopAnimation];
}
}

- (void)applicationWillEnterForeground:(UIApplication*)application
{
if ([_navController visibleViewController] == _director) {
[_director startAnimation];
}
}

- (void)applicationWillTerminate:(UIApplication *)application
{
CC_DIRECTOR_END();
}

- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application
{
[[CCDirector sharedDirector] purgeCachedData];
}

- (void)applicationSignificantTimeChange:(UIApplication *)application
{
[[CCDirector sharedDirector] setNextDeltaTimeZero:YES];
}

@end
75 changes: 75 additions & 0 deletions FinalFighter-iphone/GLES-Render.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* Copyright (c) 2006-2007 Erin Catto http:https://www.gphysics.com
*
* iPhone port by Simon Oliver - http:https://www.simonoliver.com - http:https://www.handcircus.com
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 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.
*/

//
// File modified for cocos2d integration
// http:https://www.cocos2d-iphone.org
//

#ifndef GLES_RENDER_H
#define GLES_RENDER_H

#import "cocos2d.h"

#ifdef __CC_PLATFORM_IOS
#import <OpenGLES/EAGL.h>
#elif defined(__CC_PLATFORM_MAC)
#import <OpenGL/OpenGL.h>
#endif

#include "Box2D.h"

struct b2AABB;

// This class implements debug drawing callbacks that are invoked
// inside b2World::Step.
class GLESDebugDraw : public b2Draw
{
float32 mRatio;
CCGLProgram *mShaderProgram;
GLint mColorLocation;

void initShader( void );
public:
GLESDebugDraw();

GLESDebugDraw( float32 ratio );

void DrawPolygon(const b2Vec2* vertices, int32 vertexCount, const b2Color& color);

void DrawSolidPolygon(const b2Vec2* vertices, int32 vertexCount, const b2Color& color);

void DrawCircle(const b2Vec2& center, float32 radius, const b2Color& color);

void DrawSolidCircle(const b2Vec2& center, float32 radius, const b2Vec2& axis, const b2Color& color);

void DrawSegment(const b2Vec2& p1, const b2Vec2& p2, const b2Color& color);

void DrawTransform(const b2Transform& xf);

void DrawPoint(const b2Vec2& p, float32 size, const b2Color& color);

void DrawString(int x, int y, const char* string, ...);

void DrawAABB(b2AABB* aabb, const b2Color& color);
};


#endif // GLES_RENDER_H
Loading

0 comments on commit 8beec3f

Please sign in to comment.