Skip to content

Commit

Permalink
Add gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
alinradut committed Aug 17, 2011
1 parent 2ebeeb3 commit 0c411a0
Show file tree
Hide file tree
Showing 51 changed files with 2,072 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.DS_Store
build
110 changes: 110 additions & 0 deletions Classes/AppDelegate.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
//
// TileBasedGameAppDelegate.cpp
// TileBasedGame
//
// Created by Clawoo on 8/17/11.
// Copyright __MyCompanyName__ 2011. All rights reserved.
//

#include "AppDelegate.h"

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

USING_NS_CC;

AppDelegate::AppDelegate()
{

}

AppDelegate::~AppDelegate()
{
}

bool AppDelegate::initInstance()
{
bool bRet = false;
do
{
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)

// Initialize OpenGLView instance, that release by CCDirector when application terminate.
// The HelloWorld is designed as HVGA.
CCEGLView * pMainWnd = new CCEGLView();
CC_BREAK_IF(! pMainWnd
|| ! pMainWnd->Create(TEXT("cocos2d: Hello World"), 320, 480));

#endif // CC_PLATFORM_WIN32

#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
// OpenGLView initialized in testsAppDelegate.mm on ios platform, nothing need to do here.
#endif // CC_PLATFORM_IOS

#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// android does not do anything
#endif

#if (CC_TARGET_PLATFORM == CC_PLATFORM_WOPHONE)

// Initialize OpenGLView instance, that release by CCDirector when application terminate.
// The HelloWorld is designed as HVGA.
CCEGLView* pMainWnd = new CCEGLView(this);
CC_BREAK_IF(! pMainWnd || ! pMainWnd->Create(320,480));

#ifndef _TRANZDA_VM_
// on wophone emulator, we copy resources files to Work7/TG3/APP/ folder instead of zip file
cocos2d::CCFileUtils::setResource("HelloWorld.zip");
#endif

#endif // CC_PLATFORM_WOPHONE

bRet = true;
} while (0);
return bRet;
}

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

// enable High Resource Mode(2x, such as iphone4) and maintains low resource on other devices.
// pDirector->enableRetinaDisplay(true);

// sets landscape mode
pDirector->setDeviceOrientation(kCCDeviceOrientationLandscapeLeft);

// turn on display FPS
pDirector->setDisplayFPS(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()->pause();

// if you use SimpleAudioEngine, it must be pause
// SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();
}

// this function will be called when the app is active again
void AppDelegate::applicationWillEnterForeground()
{
CCDirector::sharedDirector()->resume();

// if you use SimpleAudioEngine, it must resume here
// SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();
}
51 changes: 51 additions & 0 deletions Classes/AppDelegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
//
// TileBasedGameAppDelegate.h
// TileBasedGame
//
// Created by Clawoo on 8/17/11.
// Copyright __MyCompanyName__ 2011. All rights reserved.
//

#ifndef _APP_DELEGATE_H_
#define _APP_DELEGATE_H_

#include "CCApplication.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 for initialize OpenGL instance, set source path, etc...
*/
virtual bool initInstance();

/**
@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_

86 changes: 86 additions & 0 deletions Classes/HelloWorldScene.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
//
// HelloWorldScene.cpp
// TileBasedGame
//
// Created by Clawoo on 8/17/11.
// Copyright __MyCompanyName__ 2011. All rights reserved.
//

#include "HelloWorldScene.h"

USING_NS_CC;

CCScene* HelloWorld::scene()
{
// 'scene' is an autorelease object
CCScene *scene = CCScene::node();

// 'layer' is an autorelease object
HelloWorld *layer = HelloWorld::node();

// add layer as a child to scene
scene->addChild(layer);

// return the scene
return scene;
}

// on "init" you need to initialize your instance
bool HelloWorld::init()
{
//////////////////////////////
// 1. super init first
if ( !CCLayer::init() )
{
return false;
}

/////////////////////////////
// 2. add a menu item with "X" image, which is clicked to quit the program
// you may modify it.

// add a "close" icon to exit the progress. it's an autorelease object
CCMenuItemImage *pCloseItem = CCMenuItemImage::itemFromNormalImage(
"CloseNormal.png",
"CloseSelected.png",
this,
menu_selector(HelloWorld::menuCloseCallback) );
pCloseItem->setPosition( ccp(CCDirector::sharedDirector()->getWinSize().width - 20, 20) );

// create menu, it's an autorelease object
CCMenu* pMenu = CCMenu::menuWithItems(pCloseItem, NULL);
pMenu->setPosition( CCPointZero );
this->addChild(pMenu, 1);

/////////////////////////////
// 3. add your codes below...

// add a label shows "Hello World"
// create and initialize a label
CCLabelTTF* pLabel = CCLabelTTF::labelWithString("Hello World", "Thonburi", 34);

// ask director the window size
CCSize size = CCDirector::sharedDirector()->getWinSize();

// position the label on the center of the screen
pLabel->setPosition( ccp(size.width / 2, size.height - 20) );

// add the label as a child to this layer
this->addChild(pLabel, 1);

// add "HelloWorld" splash screen"
CCSprite* pSprite = CCSprite::spriteWithFile("HelloWorld.png");

// position the sprite on the center of the screen
pSprite->setPosition( ccp(size.width/2, size.height/2) );

// add the sprite as a child to this layer
this->addChild(pSprite, 0);

return true;
}

void HelloWorld::menuCloseCallback(CCObject* pSender)
{
CCDirector::sharedDirector()->end();
}
30 changes: 30 additions & 0 deletions Classes/HelloWorldScene.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// HelloWorldScene.h
// TileBasedGame
//
// Created by Clawoo on 8/17/11.
// Copyright __MyCompanyName__ 2011. All rights reserved.
//

#ifndef __HELLOWORLD_SCENE_H__
#define __HELLOWORLD_SCENE_H__

#include "cocos2d.h"

class HelloWorld : public cocos2d::CCLayer
{
public:
// Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone
virtual bool init();

// there's no 'id' in cpp, so we recommand to return the exactly class pointer
static cocos2d::CCScene* scene();

// a selector callback
virtual void menuCloseCallback(CCObject* pSender);

// implement the "static node()" method manually
LAYER_NODE_FUNC(HelloWorld);
};

#endif // __HELLOWORLD_SCENE_H__
Binary file added Resource/CloseNormal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Resource/CloseSelected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Resource/Default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Resource/HelloWorld.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Resource/Icon-72.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Resource/Icon-Small-50.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Resource/Icon-Small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Resource/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Resource/Icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Resource/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions TileBasedGame.xcodeproj/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.mode1v3
*.pbxuser
22 changes: 22 additions & 0 deletions android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.cocos2dx.tilebasedgame"
android:versionCode="1"
android:versionName="1.0">
<application android:label="@string/app_name" android:debuggable="true" android:icon="@drawable/icon">
<activity android:name=".TileBasedGame"
android:label="@string/app_name"
android:screenOrientation="landscape"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:configChanges="orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<supports-screens android:largeScreens="true"
android:smallScreens="true"
android:anyDensity="true"
android:normalScreens="true"/>
</manifest>
Binary file added android/assets/CloseNormal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/assets/CloseSelected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/assets/Default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/assets/HelloWorld.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/assets/Icon-72.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/assets/Icon-Small-50.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/assets/Icon-Small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/assets/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/assets/Icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/assets/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions android/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This file is used to override default values used by the Ant build system.
#
# This file must be checked in Version Control Systems, as it is
# integral to the build system of your project.

# This file is only used by the Ant script.

# You can use this to override default values such as
# 'source.dir' for the location of your java source folder and
# 'out.dir' for the location of your output folder.

# You can also use it define how the release builds are signed by declaring
# the following properties:
# 'key.store' for the location of your keystore and
# 'key.alias' for the name of the key to use.
# The password will be asked during the build when you use the 'release' target.

Loading

0 comments on commit 0c411a0

Please sign in to comment.