Skip to content

Commit

Permalink
First commit of all files
Browse files Browse the repository at this point in the history
  • Loading branch information
ericrius1 committed Apr 21, 2013
0 parents commit ef3fb81
Show file tree
Hide file tree
Showing 471 changed files with 120,048 additions and 0 deletions.
2,138 changes: 2,138 additions & 0 deletions Monslayers!.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0460"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B7E26BAB17220BC7005A73A3"
BuildableName = "Monslayers!.app"
BlueprintName = "Monslayers!"
ReferencedContainer = "container:Monslayers!.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B7E26BAB17220BC7005A73A3"
BuildableName = "Monslayers!.app"
BlueprintName = "Monslayers!"
ReferencedContainer = "container:Monslayers!.xcodeproj">
</BuildableReference>
</MacroExpansion>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B7E26BAB17220BC7005A73A3"
BuildableName = "Monslayers!.app"
BlueprintName = "Monslayers!"
ReferencedContainer = "container:Monslayers!.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B7E26BAB17220BC7005A73A3"
BuildableName = "Monslayers!.app"
BlueprintName = "Monslayers!"
ReferencedContainer = "container:Monslayers!.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>Monslayers!.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>B7E26BAB17220BC7005A73A3</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
62 changes: 62 additions & 0 deletions Monslayers!/Classes/AppDelegate.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
//
// Monslayers_AppDelegate.cpp
// Monslayers!
//
// Created by eric levin on 4/19/13.
// Copyright __MyCompanyName__ 2013. All rights reserved.
//

#include "AppDelegate.h"

#include "cocos2d.h"
#include "SimpleAudioEngine.h"
#include "HelloWorldScene.h"

USING_NS_CC;
using namespace CocosDenshion;

AppDelegate::AppDelegate()
{

}

AppDelegate::~AppDelegate()
{
}

bool AppDelegate::applicationDidFinishLaunching()
{
// initialize director
CCDirector *pDirector = CCDirector::sharedDirector();
pDirector->setOpenGLView(CCEGLView::sharedOpenGLView());

// turn on display FPS
pDirector->setDisplayStats(true);

// set FPS. the default value is 1.0/60 if you don't call this
pDirector->setAnimationInterval(1.0 / 60);

// create a scene. it's an autorelease object
CCScene *pScene = HelloWorld::scene();

// run
pDirector->runWithScene(pScene);

return true;
}

// This function will be called when the app is inactive. When comes a phone call,it's be invoked too
void AppDelegate::applicationDidEnterBackground()
{
CCDirector::sharedDirector()->stopAnimation();
SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();
SimpleAudioEngine::sharedEngine()->pauseAllEffects();
}

// this function will be called when the app is active again
void AppDelegate::applicationWillEnterForeground()
{
CCDirector::sharedDirector()->startAnimation();
SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();
SimpleAudioEngine::sharedEngine()->resumeAllEffects();
}
38 changes: 38 additions & 0 deletions Monslayers!/Classes/AppDelegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#ifndef _APP_DELEGATE_H_
#define _APP_DELEGATE_H_

#include "cocos2d.h"

/**
@brief The cocos2d Application.
The reason for implement as private inheritance is to hide some interface call by CCDirector.
*/
class AppDelegate : private cocos2d::CCApplication
{
public:
AppDelegate();
virtual ~AppDelegate();

/**
@brief Implement CCDirector and CCScene init code here.
@return true Initialize success, app continue.
@return false Initialize failed, app terminate.
*/
virtual bool applicationDidFinishLaunching();

/**
@brief The function be called when the application enter background
@param the pointer of the application
*/
virtual void applicationDidEnterBackground();

/**
@brief The function be called when the application enter foreground
@param the pointer of the application
*/
virtual void applicationWillEnterForeground();
};

#endif // _APP_DELEGATE_H_

56 changes: 56 additions & 0 deletions Monslayers!/Classes/AppMacros.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#ifndef __APPMACROS_H__
#define __APPMACROS_H__

#include "cocos2d.h"

/* For demonstrating using one design resolution to match different resources,
or one resource to match different design resolutions.
[Situation 1] Using one design resolution to match different resources.
Please look into Appdelegate::applicationDidFinishLaunching.
We check current device frame size to decide which resource need to be selected.
So if you want to test this situation which said in title '[Situation 1]',
you should change ios simulator to different device(e.g. iphone, iphone-retina3.5, iphone-retina4.0, ipad, ipad-retina),
or change the window size in "proj.XXX/main.cpp" by "CCEGLView::setFrameSize" if you are using win32 or linux plaform
and modify "proj.mac/AppController.mm" by changing the window rectangle.
[Situation 2] Using one resource to match different design resolutions.
The coordinates in your codes is based on your current design resolution rather than resource size.
Therefore, your design resolution could be very large and your resource size could be small.
To test this, just define the marco 'TARGET_DESIGN_RESOLUTION_SIZE' to 'DESIGN_RESOLUTION_2048X1536'
and open iphone simulator or create a window of 480x320 size.
[Note] Normally, developer just need to define one design resolution(e.g. 960x640) with one or more resources.
*/

#define DESIGN_RESOLUTION_480X320 0
#define DESIGN_RESOLUTION_1024X768 1
#define DESIGN_RESOLUTION_2048X1536 2

/* If you want to switch design resolution, change next line */
#define TARGET_DESIGN_RESOLUTION_SIZE DESIGN_RESOLUTION_480X320

typedef struct tagResource
{
cocos2d::CCSize size;
char directory[100];
}Resource;

static Resource smallResource = { cocos2d::CCSizeMake(480, 320), "iphone" };
static Resource mediumResource = { cocos2d::CCSizeMake(1024, 768), "ipad" };
static Resource largeResource = { cocos2d::CCSizeMake(2048, 1536), "ipadhd" };

#if (TARGET_DESIGN_RESOLUTION_SIZE == DESIGN_RESOLUTION_480X320)
static cocos2d::CCSize designResolutionSize = cocos2d::CCSizeMake(480, 320);
#elif (TARGET_DESIGN_RESOLUTION_SIZE == DESIGN_RESOLUTION_1024X768)
static cocos2d::CCSize designResolutionSize = cocos2d::CCSizeMake(1024, 768);
#elif (TARGET_DESIGN_RESOLUTION_SIZE == DESIGN_RESOLUTION_2048X1536)
static cocos2d::CCSize designResolutionSize = cocos2d::CCSizeMake(2048, 1536);
#else
#error unknown target design resolution!
#endif

// The font size 24 is designed for small resolution, so we should change it to fit for current design resolution
#define TITLE_FONT_SIZE (cocos2d::CCEGLView::sharedOpenGLView()->getDesignResolutionSize().width / smallResource.size.width * 24)

#endif /* __APPMACROS_H__ */
66 changes: 66 additions & 0 deletions Monslayers!/Classes/GameOverScene.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#include "GameOverScene.h";
#include "HelloWorldScene.h";

using namespace cocos2d;

bool GameOverScene::init()
{
if( CCScene::init() )
{
this->_layer = GameOverLayer::create();
this->_layer->retain();
this->addChild( _layer );
return true;
}
else
return false;
}


GameOverScene::~GameOverScene()
{
if( _layer )
{
_layer->release();
_layer = NULL;
}
}


bool GameOverLayer::init()
{
if( CCLayerColor::initWithColor( ccc4( 255, 255, 255, 255 ) ) )
{
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
this->_label = CCLabelTTF::create( "Start", "fonts/Marker Felt.ttf", 32 );
_label->retain();
_label->setColor( ccc3( 0, 0, 0) );
_label->setPosition( ccp( winSize.width/2, winSize.height/2 ) );
this->addChild( _label );

this->runAction( CCSequence::create(
CCDelayTime::create( 3.0 ),
CCCallFunc::create( this, callfunc_selector(GameOverLayer::gameOverDone)),
NULL));

return true;
}
else
return false;
}


GameOverLayer::~GameOverLayer()
{
if( _label )
{
_label->release();
_label = NULL;
}
}


void GameOverLayer::gameOverDone()
{
CCDirector::sharedDirector()->replaceScene( HelloWorld::scene() );
}
30 changes: 30 additions & 0 deletions Monslayers!/Classes/GameOverScene.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#ifndef _GAME_OVER_SCENE_H_
#define _GAME_OVER_SCENE_H_

#include "cocos2d.h"

class GameOverLayer : public cocos2d::CCLayerColor
{
public:
GameOverLayer() : _label(NULL) {};
virtual ~GameOverLayer();
bool init();
CREATE_FUNC(GameOverLayer);

void gameOverDone();

CC_SYNTHESIZE_READONLY(cocos2d::CCLabelTTF*, _label, Label );
};

class GameOverScene : public cocos2d::CCScene
{
public:
GameOverScene() : _layer(NULL) {};
virtual ~GameOverScene();
bool init();
CREATE_FUNC(GameOverScene);

CC_SYNTHESIZE_READONLY( GameOverLayer*, _layer, Layer );
};

#endif // _GAME_OVER_SCENE_H_
Loading

0 comments on commit ef3fb81

Please sign in to comment.