Skip to content
Browse files

Imported c2d-to-x-v0.8, receipts 2 & 3

  • Loading branch information...
1 parent e98f173 commit a54e5aaa570ea96f125f9c3c916e9da9cae96a3f @Deepscorn committed Sep 9, 2012
Showing with 1,467 additions and 0 deletions.
  1. +266 −0 c2d-to-x.tcl
  2. +165 −0 cookbook/receipt2-coloring-sprites/Classes/HelloWorldScene.cpp
  3. +35 −0 cookbook/receipt2-coloring-sprites/Classes/HelloWorldScene.h
  4. BIN cookbook/receipt2-coloring-sprites/Resources/CloseNormal.png
  5. BIN cookbook/receipt2-coloring-sprites/Resources/CloseSelected.png
  6. BIN cookbook/receipt2-coloring-sprites/Resources/HelloWorld.png
  7. BIN cookbook/receipt2-coloring-sprites/Resources/blank.png
  8. BIN cookbook/receipt2-coloring-sprites/Resources/fire.png
  9. +17 −0 cookbook/receipt2-coloring-sprites/Resources/fps_images.fnt
  10. BIN cookbook/receipt2-coloring-sprites/Resources/fps_images.png
  11. BIN cookbook/receipt2-coloring-sprites/Resources/samurai_evil.png
  12. BIN cookbook/receipt2-coloring-sprites/Resources/samurai_good.png
  13. +59 −0 cookbook/receipt3-animating-sprites/Classes/AppDelegate.cpp
  14. +38 −0 cookbook/receipt3-animating-sprites/Classes/AppDelegate.h
  15. +193 −0 cookbook/receipt3-animating-sprites/Classes/Ch1_AnimatingSprites.cpp
  16. +46 −0 cookbook/receipt3-animating-sprites/Classes/Ch1_AnimatingSprites.h
  17. +31 −0 cookbook/receipt3-animating-sprites/Classes/SimpleAnimObject.cpp
  18. +18 −0 cookbook/receipt3-animating-sprites/Classes/SimpleAnimObject.h
  19. BIN cookbook/receipt3-animating-sprites/Resources/CloseNormal.png
  20. BIN cookbook/receipt3-animating-sprites/Resources/CloseSelected.png
  21. BIN cookbook/receipt3-animating-sprites/Resources/dracula_castle.jpg
  22. +99 −0 cookbook/receipt3-animating-sprites/Resources/eurostile_30.fnt
  23. BIN cookbook/receipt3-animating-sprites/Resources/eurostile_30.png
  24. +17 −0 cookbook/receipt3-animating-sprites/Resources/fps_images.fnt
  25. BIN cookbook/receipt3-animating-sprites/Resources/fps_images.png
  26. BIN cookbook/receipt3-animating-sprites/Resources/lightning_bolt.png
  27. BIN cookbook/receipt3-animating-sprites/Resources/lightning_glow.png
  28. +92 −0 cookbook/receipt3-animating-sprites/Resources/simple_bat.plist
  29. BIN cookbook/receipt3-animating-sprites/Resources/simple_bat.png
  30. +86 −0 cookbook/receipt3-animating-sprites/proj.win32/Tutorial2.rc
  31. +151 −0 cookbook/receipt3-animating-sprites/proj.win32/Tutorial2.win32.vcxproj
  32. +71 −0 cookbook/receipt3-animating-sprites/proj.win32/Tutorial2.win32.vcxproj.filters
  33. +10 −0 cookbook/receipt3-animating-sprites/proj.win32/Tutorial2.win32.vcxproj.user
  34. +40 −0 cookbook/receipt3-animating-sprites/proj.win32/main.cpp
  35. +13 −0 cookbook/receipt3-animating-sprites/proj.win32/main.h
  36. BIN cookbook/receipt3-animating-sprites/proj.win32/res/Tutorial2.ico
  37. +20 −0 cookbook/receipt3-animating-sprites/proj.win32/resource.h
View
266 c2d-to-x.tcl
@@ -0,0 +1,266 @@
+# C2d-to-x: cocos2d objective c to cocos2d-x C++ converter (ver. 0.75 alpha). A free converter.
+# by Deepscorn, all questions or suggestions, please send to vnms11@gmail.com
+
+# LICENSE
+# Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0)
+# You can read it here:
+# http://creativecommons.org/licenses/by-nc-sa/3.0/
+
+# HOWTO call:
+# I used free version of ActiveTCL to run this script. It can be downloaded here:
+# http://www.activestate.com/activetcl/downloads
+# supported platforms:
+# Windows, Mac, Linux, AIX, HP-UX & Solaris
+#
+# first par: path to file to convert
+# second par: path to result (converted) file
+# example call from tkcon (first param must be empty):
+# exec {C:\Tcl\bin\tclsh} {C:\Dropbox\c2d-to-x\c2d-to-x.tcl} << {} {C:\temp\Recipe.h} {C:\temp\RecipeConverted.h}
+# or using *.bat file:
+# tclsh "C:\Dropbox\c2d-to-x\c2d-to-x.tcl" "C:\Dropbox\c2d-to-x\cocos2d_cookbook_chapter_1\cocos2d_cookbook_chapter_1\RecipeCollection01\RecipeCollection01\Recipe.mm" "D:\develop\cocos2d\Tutorial3\Classes"
+# if directory is specified as third parameter, than file with name from second parameter will be created there!
+
+#SUPPORTED FORMATS:
+# *.h file remains the same
+# *.mm file will be *.cpp
+
+# IMPLICIT LOGIC:
+# 1. class must start from Capital letter: "CCMenuItemFont" for ex.
+# 2. class instance must not start from capital letter: "prev" for ex.
+# so "[CCMenuItemFont setFontSize:16];"
+# will be: "CCMenuItemFont::setFontSize(16);
+# and "[node stopAllActions];"
+# will be "node->stopAllActions();"
+# 3. Only line-by-line convertion is supported by the moment
+# 4. File name of *.mm file must correspond to class name, because all methods, realized there will have it's prefix.
+# E.g.: File Some.mm: int a() { -> int Some::a() {
+
+# FROM AUTHOR
+# Recently, I was following "Cocos2d Cookbook Receipts" from http://cocos2dcookbook.com/. This looks like very useful book for learning cocos2d-x for me. It is divided into receipts, so functionality in one recept doesn't use another, so it is very good for game development. It may be read in any way. So, if I want to use some receipt I had to convert it to cocos2d-x (v2.0.1 I use). To get faster I wrote this small script. Maybe it will be useful for you too.
+
+# V 0.75
+# Added tabulation symbol support in some cases.
+# USING_NS_CC automatically added after cocos2d.h include
+# In cpp file class name is added to each method. Read Implicit Logic #4 carefully!
+# NSLog is translated as CCLOG. It's a macro and does nothing, unless you define COCOS2D_DEBUG.
+# converts multiline statements too
+# fixed bug, now a[i] inside function calls remain the same
+# Added replaces list and list of delimeters for you to suit your needs (see below)
+# added ":" delimeter in some cases
+#
+# V 0.8
+# fixed some @"text" issue
+# new delimeters syntax for faster work and easy-look code: \t for tabulation, any special character must start with \\, for ex.: \\.
+# added: some.a will be converted to some->getA()
+# ->string() will be converted to ->getString() (remove 2 corresponding elements from replaces list below, if you don't want such behavior)
+
+# MUST STILL DO BY HAND
+# Include class methods in {}
+
+# REPLACES LIST - modify on your own
+set elements [list "@interface" "class" "id" "bool" "self" "this" "super" "this" "nil" "NULL" "YES" "true" "NO" "false" "#import" "#include" "NSString" "CCString" "NSLog" "CCLOG" "CGSize" "CCSize" "NSString" "CCString" "NSUInteger" "CCInteger" "unichar" "char" "NSMakeRange" "CCRangeMake" ">string\\(\\)" ">getString()"]
+# only this delimeters may delimit elements
+set delimeters {[ \t\(\);\-\\.\\*/+%!:\,]}
+#if line starts with one of these elements - it will be deleted
+set elements_del [list "^@end" "^@implementation"]
+#
+
+# path to file to convert
+set fname_src [lindex $argv 0]
+# path to result file
+set fname_dst [lindex $argv 1]
+
+# replace functions - start
+#FUNCTIONS, WHICH DOES NOT REQUIRE ";"
+proc handle_del { line } {
+# line passed by value
+ global elements_del
+ foreach subel $elements_del {
+ if {[regexp $subel $line]} {
+ set line ""
+ break
+ }
+ }
+ return $line
+}
+# handles one-word replacement. Checks if it is single word,
+# e.g. it has delimeters from the left and right
+proc handle_replace_one { line } {
+# line passed by value
+ global elements
+ global delimeters
+ ##import "cocos2d.h" -> #include "cocos2d.h"\nUSING_NS_CC;
+ set line [regsub {\#import +("cocos2d.h")} $line "\#include \\1\nUSING_NS_CC;"]
+ for {set i 0} {$i<[llength $elements]} {incr i 2} {
+ #our template must end with delimeter
+ set templ "[lindex $elements $i]($delimeters)"
+ # templ may be at the line beginning
+ set templ2 "^$templ"
+ set line [regsub $templ2 $line "[lindex $elements $i+1]\\1"]
+ # or templ may start with delimeter
+ set templ3 "($delimeters)$templ"
+ set line [regsub $templ3 $line "\\1[lindex $elements $i+1]\\2"]
+ }
+ return $line
+}
+proc handle_replace_at_last { line } {
+ #must be THE LAST!
+ #@interface ParticleWaterfall : CCParticleRain {}
+ #@interface ParticleWaterfall : public CCParticleRain {}
+ set line [regsub {([A-Za-z]+) *[:] *([A-Za-z]+)} $line "\\1: public \\2"]
+ return $line
+}
+#end - FUNCTIONS, WHICH DOES NOT REQUIRE ";"
+#must be called after super position replacement!
+proc handle_replace_one_per_line { line } {
+# line passed by value
+ proc fromCapital str {
+ set res ""
+ append res [string toupper [string index $str 0]]
+ for {set i 1} {$i<[string length $str]} {incr i} {
+ append res [string index $str $i]
+ }
+ return $res
+ }
+ #self.speed = 100;
+ #self->setSpeed(100);
+ set temp [regexp {(.+)[.]([A-Za-z0-9]+) *[=] *([^;]*)} "$line" match sub1 sub2 sub3 ]
+ if {$temp} {
+ set line "$sub1->set[fromCapital $sub2]($sub3);"
+ }
+ #sharedDirector().winSize
+ #sharedDirector()->getWinSize()
+ while {[set temp [regexp {(.+\(\))[.](\w+)([^=]$)} "$line" match sub1 sub2 sub3]]} {
+ set line "$sub1->get[fromCapital $sub2]()$sub3"
+ }
+ return $line
+}
+#must be called by super power algorithm!
+proc handle_replace_many_per_line { line classname} {
+# line passed by value
+ #-(CCLayer*) runRecipe;
+ #CCLayer* runRecipe();
+ set line [regsub {[-][(]([A-Za-z]+[*]*)[)] *([A-Za-z]+)( *[;\{])} "$line" "\\1 $classname\:\:\\2()\\3" ]
+ #-(id)initWithTotalParticles:(int)p;
+ set line [regsub {[-][(]([A-Za-z]+[*]*)[)] *([A-Za-z]+):\((.+?)\)([A-Za-z]+)} "$line" "\\1 $classname\:\:\\2(\\3 \\4)" ]
+
+ #@"ParticleExplosion"
+ #"ParticleExplosion"
+ #while {[regsub -all {@(".*")} $line "\\1" line]} {}
+ regsub -all {@(".*?")} $line "\\1" line
+ return $line
+}
+#recursive replacement (for super position replacement)
+proc subliner3 { start subline } {
+ #puts $start|$subline
+ #START ALLWAYS has METHOD, not attribute list
+ # start -> (::,->) order is important!
+ set start [regsub {([A-Z][A-Za-z0-9]*) +([A-Za-z0-9]*)} $start "\\1::\\2" ]
+ set start [regsub {([a-z][A-Za-z0-9]*(\[[A-Za-z0-9]+\])*) +([A-Za-z0-9]*)} $start "\\1->\\3" ]
+ #ATTRIBUTE LIST now
+ if {[regexp {\[.+?\]} $subline] == 1} {
+ #COMPLEX ATTRIBUTES we have
+ #[word word ... word] -> word->word()->...->word()
+ while {[regexp {(.*)\[([^\[\]:]+)\](.*)} $subline match s1 s2 s3] == 1} {
+ set s2 [subliner3 $s2 ""]
+ set subline $s1$s2$s3
+ }
+ #[word word ... word:attr ... attr] -> word->word()->...->word(attr,...,attr)
+ while {[regexp {(.*)\[([^\[\]:]+)[:]([^\[\]]+)\](.*)} $subline match s1 s2 s3 s4] == 1} {
+ set s2 [subliner3 $s2 $s3]
+ set subline $s1$s2$s4
+ }
+ }
+ #ATTRIBUTES are SIMPLE now
+ # manage with simply attribute list like (0,false,obj), so there is no any unconverted subelements
+ #fixed BUG10.08.12 - may have delegate
+ set subline [regsub -all {[\(]([A-Za-z0-9]*)[:][\)]} $subline "\(\\1\)"]
+ # typeName: -> ,
+ set subline [regsub -all { *[A-Za-z0-9]+[:] *([^:])} $subline ", \\1"]
+ if { $start == ""} { return $subline }
+ return $start\($subline\)
+}
+proc handle_super_position { line } {
+
+ #super-power algorithm!
+ #FROM: CCLabelTTF* name = \[CCLabelTTF labelWithString:\[NSString stringWithFormat:@\"%@ %@\", actionMethods\[currentActionX\], actionMethods\[currentActionY\]\] fontName:@\"Arial\" fontSize:14];
+ #TO: CCLabelTTF* name = CCLabelTTF::labelWithString(CCString::stringWithFormat("%@ %@",actionMethods[currentActionX],actionMethods[currentActionY]),"Arial",14);
+ #puts "line:$line"
+
+ if {[regexp {.*?[\[].+ *[\]] *(.+$)} $line match ending] == 1} {
+ #check if we need more lines of code
+ if { $ending == "" || [regexp {,} $ending] } {
+ return -code error "Not enough symbols to analyze!"
+ }
+ #[word] -> {<}word{>} because of subliner3's specific
+ regsub -all {\[([A-Za-z0-9]+)\]} $line "\{<\}\\1\{>\}" line
+ set line [subliner3 "" $line]
+ #remove all changes, we made because of subliner3's specific
+ regsub -all {\{<\}} $line "\[" line
+ regsub -all {\{>\}} $line "\]" line
+ #puts "result:$line"
+ }
+ return $line
+}
+# replace functions - end
+
+# main
+#if have only directory as destination - use source file name
+set only_fname_src [file tail $fname_src]
+#get file name without ext for many purposes
+regexp {(.+).(mm|h)$} $only_fname_src match fname_no_ext
+if {[file isdirectory $fname_dst] == 1} {
+ #set newname [regsub {(.+).mm$} $only_fname_src "\\1.cpp"]
+ set newname $fname_no_ext.cpp
+ set fname_dst $fname_dst/$newname
+}
+#check if we have *.h or *.mm file
+set fileHas_H_Extension [regexp {.h$} $only_fname_src]
+#open destination file
+set fileto [open $fname_dst w]
+#add to start of *.h file
+if {$fileHas_H_Extension} {
+ set fnamecomb [regsub {\.} $only_fname_src "_"]
+ set fnamecomb [string toupper $fnamecomb]
+ puts $fileto "#ifndef $fnamecomb"
+ puts $fileto "#define $fnamecomb"
+ flush $fileto
+}
+
+# main replace-loop
+set filefrom [open $fname_src r]
+
+#lastline and errflag are used when it is necessary to replace until ";" and
+#line doesn't contain ";"
+set lastline ""
+foreach line [split [read $filefrom] \n] {
+ #DELETE
+ set line [handle_del $line]
+ #REPLACE UNTIL ";"
+ #puts "\nline:$line"
+ set line [handle_replace_many_per_line $line $fname_no_ext]
+ #puts "res:$line"
+ set line $lastline$line
+ #puts $line
+ if { [catch {set line [handle_super_position $line]} fid] } {
+ #remove \n
+ set lastline [string trimright $line]
+ continue
+ } else {
+ set lastline ""
+ }
+ set line [handle_replace_one_per_line $line]
+ #REPLACE - no matter where is ";"
+ set line [handle_replace_one $line]
+ set line [handle_replace_at_last $line]
+
+ puts $fileto $line
+}
+
+
+# add at the end of *.h file
+if {$fileHas_H_Extension} {
+ puts $fileto "#endif $fnamecomb"
+}
+flush $fileto
+close $fileto
View
165 cookbook/receipt2-coloring-sprites/Classes/HelloWorldScene.cpp
@@ -0,0 +1,165 @@
+#include "HelloWorldScene.h"
+
+using namespace cocos2d;
+
+CCScene* HelloWorld::scene()
+{
+ CCScene * scene = NULL;
+ do
+ {
+ // 'scene' is an autorelease object
+ scene = CCScene::node();
+ CC_BREAK_IF(! scene);
+
+ // 'layer' is an autorelease object
+ HelloWorld *layer = HelloWorld::node();
+ CC_BREAK_IF(! layer);
+
+ // add layer as a child to scene
+ scene->addChild(layer);
+ } while (0);
+
+ // return the scene
+ return scene;
+}
+
+// on "init" you need to initialize your instance
+bool HelloWorld::init()
+{
+ bool bRet = false;
+ do
+ {
+ //////////////////////////////////////////////////////////////////////////
+ // super init first
+ //////////////////////////////////////////////////////////////////////////
+
+ CC_BREAK_IF(! CCLayer::init());
+
+ //////////////////////////////////////////////////////////////////////////
+ // add your codes below...
+ //////////////////////////////////////////////////////////////////////////
+
+ // 1. Add a menu item with "X" image, which is clicked to quit the program.
+
+ // Create a "close" menu item with close icon, it's an auto release object.
+ CCMenuItemImage *pCloseItem = CCMenuItemImage::itemWithNormalImage(
+ "CloseNormal.png",
+ "CloseSelected.png",
+ this,
+ menu_selector(HelloWorld::menuCloseCallback));
+ CC_BREAK_IF(! pCloseItem);
+
+ // Place the menu item bottom-right conner.
+ pCloseItem->setPosition(ccp(CCDirector::sharedDirector()->getWinSize().width - 20, 20));
+
+ // Create a menu with the "close" menu item, it's an auto release object.
+ CCMenu* pMenu = CCMenu::menuWithItems(pCloseItem, NULL);
+ pMenu->setPosition(CCPointZero);
+ CC_BREAK_IF(! pMenu);
+
+ // Add the menu to HelloWorld layer as a child layer.
+ this->addChild(pMenu, 1);
+
+ // 2. Add a label shows "Hello World".
+
+ // Create a label and initialize with string "Hello World".
+ CCLabelTTF* pLabel = CCLabelTTF::labelWithString("Coloring sprites", "Arial", 24);
+ CC_BREAK_IF(! pLabel);
+
+ // Get window size and place the label upper.
+ CCSize size = CCDirector::sharedDirector()->getWinSize();
+ pLabel->setPosition(ccp(size.width / 2, size.height - 50));
+
+ // Add the label to HelloWorld layer as a child layer.
+ this->addChild(pLabel, 1);
+
+ // 3. Add add a splash screen, show the cocos2d splash image.
+ CCSprite* pSprite = CCSprite::spriteWithFile("HelloWorld.png");
+ CC_BREAK_IF(! pSprite);
+
+ // Place the sprite on the center of the screen
+ pSprite->setPosition(ccp(size.width/2, size.height/2));
+
+ // Add the sprite to HelloWorld layer as a child layer.
+ this->addChild(pSprite, 0);
+
+ //YOUR code here...
+ runRecipe();
+
+ bRet = true;
+ } while (0);
+
+ return bRet;
+}
+
+void HelloWorld::runRecipe() {
+ //fade scene to...
+ CCSprite *fadeSprite = CCSprite::spriteWithFile("blank.png");
+ fadeSprite->setOpacity(0);
+ fadeSprite->setPosition(ccp(240,160));
+ fadeSprite->setTextureRect(CCRectMake(0,0,480,320));
+ this->addChild(fadeSprite,3,TAG_FADE_SPRITE);
+ //add gradient below the mountains
+ //NO CCGradient* found in cocos2d-x v 2.0!
+ initButtons();
+
+ //samurais...
+ CCSize winSize = CCDirector::sharedDirector()->getWinSize();
+ CCSprite* goodSamurai = CCSprite::spriteWithFile("samurai_good.png",CCRectMake(0,0,winSize.width*0.75f,winSize.height));
+ goodSamurai->setAnchorPoint(ccp(0,0));
+ goodSamurai->setPosition(ccp(0,0));
+ this->addChild(goodSamurai);
+ this->glowAt(ccp(210,220),CCSizeMake(3.0f,11.0f),ccc3(0,230,255),45.0f,goodSamurai);
+ CCSprite* evilSamurai = CCSprite::spriteWithFile("samurai_evil.png",CCRectMake(0,0,winSize.width*0.75f,winSize.height));
+ evilSamurai->setFlipX(true);
+ evilSamurai->setAnchorPoint(ccp(0,0));
+ evilSamurai->setPosition(ccp(winSize.width*0.25f,0));
+ this->addChild(evilSamurai);
+ this->glowAt(ccp(150,220),CCSizeMake(3.0f,11.0f),ccc3(255,200,2),-45.0f,evilSamurai);
+}
+
+void HelloWorld::glowAt(CCPoint pos,CCSize size, ccColor3B color, float rotation, CCSprite* sprite) {
+ CCSprite *glowSprite = CCSprite::spriteWithFile("fire.png");
+ glowSprite->setColor(color);
+ glowSprite->setPosition(pos);
+ glowSprite->setRotation(rotation);
+ //glowSprite->setBlendFunc(new ccBlendFunc(GL_ONE,GL_ONE));
+ glowSprite->runAction(CCRepeatForever::actionWithAction((CCActionInterval*)CCSequence::actions(
+ CCScaleTo::actionWithDuration(0.9f,size.width,size.height),
+ CCScaleTo::actionWithDuration(0.9f,size.width*0.75f,size.height*0.75f),
+ NULL)));
+ glowSprite->runAction(CCRepeatForever::actionWithAction((CCActionInterval*)CCSequence::actions(
+ CCFadeTo::actionWithDuration(0.9f,150),
+ CCFadeTo::actionWithDuration(0.9f,255),
+ NULL)));
+ sprite->addChild(glowSprite);
+}
+
+void HelloWorld::initButtons() {
+ CCMenuItemFont::setFontSize(16);
+ //fade to 'black' button
+ CCMenuItemFont *fadeToBlack = CCMenuItemFont::itemWithString("FADE TO BLACK");
+ fadeToBlack->setTarget(this,menu_selector(HelloWorld::fadeToBlackCallback));
+ CCMenu* fadeToBlackMenu = CCMenu::menuWithItems(fadeToBlack,NULL);
+ fadeToBlackMenu->setPosition(ccp(180,20));
+ this->addChild(fadeToBlackMenu,4,TAG_FADE_TO_BLACK);
+}
+
+/* Fade the scene to black */
+void HelloWorld::fadeToBlackCallback(CCObject* sender) {
+ CCSprite *fadeSprite = (CCSprite*)this->getChildByTag(TAG_FADE_SPRITE);
+ fadeSprite->stopAllActions();
+ fadeSprite->setColor(ccc3(0,0,0));
+ fadeSprite->setOpacity(0.0f);
+ fadeSprite->runAction(CCSequence::actions(
+ CCFadeIn::actionWithDuration(2.0f),
+ CCFadeOut::actionWithDuration(2.0f),
+ NULL));
+}
+
+void HelloWorld::menuCloseCallback(CCObject* pSender)
+{
+ // "close" menu item clicked
+ CCDirector::sharedDirector()->end();
+}
+
View
35 cookbook/receipt2-coloring-sprites/Classes/HelloWorldScene.h
@@ -0,0 +1,35 @@
+#ifndef __HELLOWORLD_SCENE_H__
+#define __HELLOWORLD_SCENE_H__
+
+#include "cocos2d.h"
+
+#include "Box2D/Box2D.h"
+
+#include "SimpleAudioEngine.h"
+
+USING_NS_CC;
+
+class HelloWorld : public cocos2d::CCLayer
+{
+public:
+ //YOUR code here...
+ void runRecipe();
+ void glowAt(CCPoint pos,CCSize size, ccColor3B color, float rotation, CCSprite* sprite);
+ void initButtons();
+ void fadeToBlackCallback(CCObject* sender);
+ enum {TAG_FADE_SPRITE, TAG_FADE_TO_BLACK};
+ //Standart stuff below...
+ // 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__
View
BIN cookbook/receipt2-coloring-sprites/Resources/CloseNormal.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN cookbook/receipt2-coloring-sprites/Resources/CloseSelected.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN cookbook/receipt2-coloring-sprites/Resources/HelloWorld.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN cookbook/receipt2-coloring-sprites/Resources/blank.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN cookbook/receipt2-coloring-sprites/Resources/fire.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
17 cookbook/receipt2-coloring-sprites/Resources/fps_images.fnt
@@ -0,0 +1,17 @@
+info face="Consolas" size=16 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=2,2
+common lineHeight=18 base=12 scaleW=64 scaleH=64 pages=1 packed=0
+page id=0 file="fps_images.png"
+chars count=13
+char id=47 x=2 y=2 width=11 height=17 xoffset=0 yoffset=-0 xadvance=9 page=0 chnl=0 letter="/"
+char id=48 x=15 y=2 width=13 height=16 xoffset=-1 yoffset=-0 xadvance=9 page=0 chnl=0 letter="0"
+char id=56 x=30 y=2 width=12 height=16 xoffset=-1 yoffset=-0 xadvance=9 page=0 chnl=0 letter="8"
+char id=51 x=44 y=2 width=11 height=16 xoffset=0 yoffset=-0 xadvance=9 page=0 chnl=0 letter="3"
+char id=53 x=2 y=21 width=11 height=16 xoffset=0 yoffset=-0 xadvance=9 page=0 chnl=0 letter="5"
+char id=54 x=15 y=21 width=11 height=16 xoffset=0 yoffset=-0 xadvance=9 page=0 chnl=0 letter="6"
+char id=52 x=28 y=21 width=13 height=15 xoffset=-1 yoffset=-0 xadvance=9 page=0 chnl=0 letter="4"
+char id=55 x=43 y=21 width=12 height=15 xoffset=-1 yoffset=-0 xadvance=9 page=0 chnl=0 letter="7"
+char id=57 x=2 y=39 width=12 height=15 xoffset=-1 yoffset=-0 xadvance=9 page=0 chnl=0 letter="9"
+char id=49 x=16 y=39 width=11 height=15 xoffset=0 yoffset=-0 xadvance=9 page=0 chnl=0 letter="1"
+char id=50 x=29 y=39 width=11 height=15 xoffset=0 yoffset=-0 xadvance=9 page=0 chnl=0 letter="2"
+char id=46 x=42 y=39 width=7 height=8 xoffset=2 yoffset=8 xadvance=9 page=0 chnl=0 letter="."
+char id=32 x=51 y=39 width=0 height=0 xoffset=0 yoffset=132 xadvance=9 page=0 chnl=0 letter="space"
View
BIN cookbook/receipt2-coloring-sprites/Resources/fps_images.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN cookbook/receipt2-coloring-sprites/Resources/samurai_evil.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN cookbook/receipt2-coloring-sprites/Resources/samurai_good.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
59 cookbook/receipt3-animating-sprites/Classes/AppDelegate.cpp
@@ -0,0 +1,59 @@
+#include "cocos2d.h"
+#include "CCEGLView.h"
+#include "AppDelegate.h"
+//#include "HelloWorldScene.h"
+#include "SimpleAudioEngine.h"
+#include "Ch1_AnimatingSprites.h"
+
+using namespace CocosDenshion;
+
+USING_NS_CC;
+
+AppDelegate::AppDelegate()
+{
+}
+
+AppDelegate::~AppDelegate()
+{
+ SimpleAudioEngine::end();
+}
+
+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);
+
+ // 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();
+ CCScene *pScene = Ch1_AnimatingSprites::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();
+
+ SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();
+}
+
+// this function will be called when the app is active again
+void AppDelegate::applicationWillEnterForeground()
+{
+ CCDirector::sharedDirector()->resume();
+
+ SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();
+}
View
38 cookbook/receipt3-animating-sprites/Classes/AppDelegate.h
@@ -0,0 +1,38 @@
+#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 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__
+
View
193 cookbook/receipt3-animating-sprites/Classes/Ch1_AnimatingSprites.cpp
@@ -0,0 +1,193 @@
+//translated to cocos2d-x by Deepscorn, 2012, vnms11@gmail.com
+#include "Ch1_AnimatingSprites.h"
+
+//implementation Ch1_AnimatingSprites
+
+//this implementation till I find (or create) better
+int arc4random() {
+ return rand();
+}
+
+CCLayer* Ch1_AnimatingSprites::runRecipe() {
+ //Add our PLIST to the SpriteFrameCache
+ CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("simple_bat.plist");
+
+ //Add castle background
+ CCSprite *castle = CCSprite::spriteWithFile("dracula_castle.jpg");
+ castle->setPosition(ccp(240,160));
+ this->addChild(castle,0,TAG_CASTLE);
+
+ //Add a lightning bolt
+ lightningBolt = CCSprite::spriteWithFile("lightning_bolt.png");
+ lightningBolt->setPosition(ccp(240,160));
+ lightningBolt->setOpacity(64);
+ lightningBolt->retain();
+
+ //Add a sprite to make it light up other areas.
+ lightningGlow = CCSprite::spriteWithFile("lightning_glow.png");
+ lightningGlow->setColor(ccc3(255,255,0));
+ lightningGlow->setPosition(ccp(240,160));
+ lightningGlow->setOpacity(100);
+ //lightningGlow->setBlendFunc( (ccBlendFunc) { GL_ONE, GL_ONE });
+ lightningBolt->addChild(lightningGlow);
+
+ //Set a counter for lightning duration randomization
+ lightningRemoveCount = 0;
+
+ //Bats Array Initialization
+ bats = new CCArray();
+
+ //Add bats using a batch node.
+ CCSpriteBatchNode *batch1 = CCSpriteBatchNode::batchNodeWithFile("simple_bat.png",10);
+ this->addChild(batch1,2,TAG_BATS);
+
+ //Make them start flying up.
+ for(int x=0; x<10; x++){
+ //Create SimpleAnimObject of bat - method spriteWithBatchNode is declared in SimpleAnimObject! Not coco2d method!
+ SimpleAnimObject *bat = SimpleAnimObject::spriteWithBatchNode(batch1,CCRectMake(0,0,48,48));
+ batch1->addChild(bat);
+
+ CCPoint ptRand = ccp(arc4random()%400+40, arc4random()%150+150);
+ bat->setPosition(ptRand);
+
+ //Make the bat fly up. Get the animation delay (flappingSpeed).
+ float flappingSpeed = this->makeBatFlyUp(bat);
+
+ //Base y velocity on flappingSpeed.
+ bat->setVelocity(ccp((arc4random()%1000)/500 + 0.2f, 0.1f/flappingSpeed));
+
+ //Add a pointer to this bat object to the NSMutableArray
+ bats->addObject(bat);
+ //bat->retain();
+
+ //Set the bat's direction based on x velocity.
+ if(bat->getVelocity().x > 0){
+ bat->setFlipX(true);
+ }
+ }
+
+ //Schedule physics updates
+ this->schedule(schedule_selector(Ch1_AnimatingSprites::step));
+
+ return this;
+}
+
+float Ch1_AnimatingSprites::makeBatFlyUp(SimpleAnimObject* bat) {
+ CCSpriteFrameCache * cache = CCSpriteFrameCache::sharedSpriteFrameCache();
+
+ //Randomize animation speed.
+ float delay = (float)(arc4random()%5+5)/80;
+ CCAnimation *animation = CCAnimation::animation();
+ //initWithName("simply_bat_fly" delay(delay);
+ animation->setDelayPerUnit(delay);
+ //Randomize animation frame order.
+ int num = arc4random()%4+1;
+ for(int i=1; i<=4; i+=1){
+ animation->addSpriteFrame(cache->spriteFrameByName(CCString::stringWithFormat("simple_bat_0%i.png",num)->getCString()));
+ num++;
+ if(num > 4){ num = 1; }
+ }
+
+ //Stop any running animations and apply this one.
+ bat->stopAllActions();
+ bat->runAction(CCRepeatForever::actionWithAction(CCAnimate::actionWithAnimation(animation)));
+
+ //Keep track of which animation is running.
+ bat->setAnimationType(BAT_FLYING_UP);
+
+ return delay; //We return how fast the bat is flapping.*/
+}
+
+ void Ch1_AnimatingSprites::makeBatGlideDown(SimpleAnimObject* bat) {
+ CCSpriteFrameCache * cache = CCSpriteFrameCache::sharedSpriteFrameCache();
+
+ //Apply a simple single frame gliding animation.
+ CCAnimation *animation = CCAnimation::animation();
+ //initWithName("simple_bat_glide" delay(100.0f);
+ animation->setDelayPerUnit(100.f);
+ animation->addSpriteFrame(cache->spriteFrameByName("simple_bat_01.png"));
+
+ //Stop any running animations and apply this one.
+ bat->stopAllActions();
+ bat->runAction(CCRepeatForever::actionWithAction(CCAnimate::actionWithAnimation(animation)));
+
+ //Keep track of which animation is running.
+ bat->setAnimationType(BAT_GLIDING_DOWN);
+}
+
+void Ch1_AnimatingSprites::step(ccTime delta) {
+ CCSize s = CCDirector::sharedDirector()->getWinSize();
+
+ for(int i=0;i<bats->count();i++){
+ //Get SimpleAnimObject out of NSArray of NSValue objects.
+ SimpleAnimObject *bat = (SimpleAnimObject*)bats->objectAtIndex(i);//(key pointerValue);
+
+ //Make sure bats don't fly off the screen
+ if(bat->getPosition().x > s.width){
+ bat->setVelocity(ccp(-bat->getVelocity().x, bat->getVelocity().y));
+ bat->setFlipX(false);
+ }else if(bat->getPosition().x < 0){
+ bat->setVelocity(ccp(-bat->getVelocity().x, bat->getVelocity().y));
+ bat->setFlipX(true);
+ }else if(bat->getPosition().y > s.height){
+ bat->setVelocity(ccp(bat->getVelocity().x, -bat->getVelocity().y));
+ this->makeBatGlideDown(bat);
+ }else if(bat->getPosition().y < 0){
+ bat->setVelocity(ccp(bat->getVelocity().x, -bat->getVelocity().y));
+ this->makeBatFlyUp(bat);
+ }
+
+ //Randomly make them fly back up
+ if(arc4random()%100 == 7){
+ if(bat->getAnimationType() == BAT_GLIDING_DOWN){ this->makeBatFlyUp(bat); bat->setVelocity(ccp(bat->getVelocity().x, -bat->getVelocity().y)); }
+ else if(bat->getAnimationType() == BAT_FLYING_UP){ this->makeBatGlideDown(bat); bat->setVelocity(ccp(bat->getVelocity().x, -bat->getVelocity().y)); }
+ }
+
+ //Update bat position based on direction
+ bat->setPosition(ccp(bat->getPosition().x + bat->getVelocity().x, bat->getPosition().y + bat->getVelocity().y));
+ }
+
+ //Randomly make lightning strike
+ if(arc4random()%70 == 7){
+ if(lightningRemoveCount < 0){
+ this->addChild(lightningBolt,1,TAG_LIGHTNING_BOLT);
+ lightningRemoveCount = arc4random()%5+5;
+ }
+ }
+
+ //Count down
+ lightningRemoveCount -= 1;
+
+ //Clean up any old lightning bolts
+ if(lightningRemoveCount == 0){
+ this->removeChildByTag(TAG_LIGHTNING_BOLT,false);
+ }
+}
+
+void Ch1_AnimatingSprites::cleanRecipe() {
+ bats->release();
+ //(super cleanRecipe); - no need to call, because virtual destructor will do that implicitly
+}
+
+CCScene* Ch1_AnimatingSprites::scene()
+{
+ CCScene * scene = NULL;
+ do
+ {
+ // 'scene' is an autorelease object
+ scene = CCScene::node();
+ CC_BREAK_IF(! scene);
+
+ // 'layer' is an autorelease object
+ Ch1_AnimatingSprites *layer = Ch1_AnimatingSprites::node();
+ CC_BREAK_IF(! layer);
+ //manually run recipe by calling layer->runRecipe();
+ layer->runRecipe();
+ // add layer as a child to scene
+ scene->addChild(layer);
+
+ } while (0);
+
+ // return the scene
+ return scene;
+}
View
46 cookbook/receipt3-animating-sprites/Classes/Ch1_AnimatingSprites.h
@@ -0,0 +1,46 @@
+//translated to cocos2d-x by Deepscorn, 2012, vnms11@gmail.com
+#ifndef CH1_ANIMATING_SPRITES
+#define CH1_ANIMATING_SPRITES
+
+#include "cocos2d.h"
+//#include "Recipe.h"
+#include "SimpleAnimObject.h"
+
+USING_NS_CC;
+
+enum {
+ TAG_CASTLE = 0,
+ TAG_LIGHTNING_BOLT = 1,
+ TAG_BATS = 2
+};
+
+//Bat animation types
+enum {
+ BAT_FLYING_UP = 0,
+ BAT_GLIDING_DOWN = 1
+};
+
+//inherit from CCLayer (not Receipt in Receipt.h file) for less code
+class Ch1_AnimatingSprites : public CCLayer {
+private:
+ CCArray *bats;
+ CCAnimation *batFlyUp;
+ CCSprite *lightningBolt;
+ CCSprite *lightningGlow;
+ int lightningRemoveCount;
+private:
+ CCLayer* runRecipe();
+ float makeBatFlyUp(SimpleAnimObject* bat);
+ void makeBatGlideDown(SimpleAnimObject* bat);
+ void step(ccTime delta);
+ void cleanRecipe();
+public:
+ //added to original receipt
+ LAYER_NODE_FUNC(Ch1_AnimatingSprites);
+ static CCScene* scene();
+ Ch1_AnimatingSprites(): bats(NULL), batFlyUp(NULL), lightningBolt(NULL), lightningGlow(NULL),
+ lightningRemoveCount(0) {}
+ ~Ch1_AnimatingSprites() { cleanRecipe(); }
+};
+
+#endif
View
31 cookbook/receipt3-animating-sprites/Classes/SimpleAnimObject.cpp
@@ -0,0 +1,31 @@
+//translated to cocos2d-x by Deepscorn, 2012, vnms11@gmail.com
+#include "SimpleAnimObject.h"
+#include "cocos2d.h"
+
+USING_NS_CC;
+
+//implementation SimpleAnimObject
+
+void SimpleAnimObject::update(ccTime t) {
+ this->setPosition(ccp(this->getPosition().x +
+ velocity.x, this->getPosition().y + velocity.y));
+}
+CCRect SimpleAnimObject::rect() {
+ float scaleMod = 0.5f;
+ float w = this->getContentSize().width * this->getScale() * scaleMod;
+ float h = this->getContentSize().height * this->getScale() * scaleMod;
+ CCPoint point = CCPointMake(this->getPosition().x - (w/2), this->getPosition().y - (h/2));
+ return CCRectMake(point.x, point.y, w, h);
+}
+
+SimpleAnimObject* SimpleAnimObject::spriteWithBatchNode(CCSpriteBatchNode* batch, CCRect rect) {
+ SimpleAnimObject *pobSprite = new SimpleAnimObject();
+ CCTexture2D *pTexture = batch->getTexture();
+ if (pobSprite && pTexture && pobSprite->initWithTexture(pTexture, rect))
+ {
+ pobSprite->autorelease();
+ return pobSprite;
+ }
+ CC_SAFE_DELETE(pobSprite);
+ return NULL;
+ }
View
18 cookbook/receipt3-animating-sprites/Classes/SimpleAnimObject.h
@@ -0,0 +1,18 @@
+//translated to cocos2d-x by Deepscorn, 2012, vnms11@gmail.com
+#ifndef SIMPLE_ANIM_OBJECT
+#define SIMPLE_ANIM_OBJECT
+
+#include "cocos2d.h"
+USING_NS_CC;
+
+class SimpleAnimObject : public CCSprite {
+ void update(ccTime t);
+ CCRect rect();
+ CC_SYNTHESIZE(int,animationType,AnimationType);
+ CC_SYNTHESIZE(CCPoint,velocity,Velocity);
+public:
+ //added to receipt for easy-reading code
+ static SimpleAnimObject* spriteWithBatchNode(CCSpriteBatchNode* batch, CCRect rect);
+};
+
+#endif
View
BIN cookbook/receipt3-animating-sprites/Resources/CloseNormal.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN cookbook/receipt3-animating-sprites/Resources/CloseSelected.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN cookbook/receipt3-animating-sprites/Resources/dracula_castle.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
99 cookbook/receipt3-animating-sprites/Resources/eurostile_30.fnt
@@ -0,0 +1,99 @@
+info face="EurostileRegular" size=30 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=1,1
+common lineHeight=32 base=24 scaleW=256 scaleH=256 pages=1 packed=0
+page id=0 file="eurostile_30.png"
+chars count=94
+char id=32 x=0 y=0 width=0 height=0 xoffset=0 yoffset=24 xadvance=10 page=0 chnl=0
+char id=41 x=0 y=0 width=9 height=31 xoffset=0 yoffset=2 xadvance=10 page=0 chnl=0
+char id=40 x=9 y=0 width=9 height=31 xoffset=0 yoffset=2 xadvance=10 page=0 chnl=0
+char id=92 x=18 y=0 width=25 height=30 xoffset=-3 yoffset=3 xadvance=21 page=0 chnl=0
+char id=47 x=43 y=0 width=25 height=30 xoffset=-3 yoffset=3 xadvance=21 page=0 chnl=0
+char id=125 x=68 y=0 width=10 height=30 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=0
+char id=123 x=78 y=0 width=10 height=30 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=0
+char id=93 x=88 y=0 width=9 height=30 xoffset=0 yoffset=3 xadvance=10 page=0 chnl=0
+char id=91 x=97 y=0 width=9 height=30 xoffset=0 yoffset=3 xadvance=10 page=0 chnl=0
+char id=106 x=106 y=0 width=9 height=29 xoffset=-2 yoffset=3 xadvance=8 page=0 chnl=0
+char id=36 x=115 y=0 width=21 height=28 xoffset=-1 yoffset=1 xadvance=20 page=0 chnl=0
+char id=124 x=136 y=0 width=7 height=28 xoffset=-1 yoffset=3 xadvance=4 page=0 chnl=0
+char id=37 x=143 y=0 width=27 height=25 xoffset=-1 yoffset=2 xadvance=26 page=0 chnl=0
+char id=48 x=170 y=0 width=20 height=25 xoffset=0 yoffset=2 xadvance=20 page=0 chnl=0
+char id=57 x=190 y=0 width=19 height=25 xoffset=0 yoffset=2 xadvance=20 page=0 chnl=0
+char id=56 x=209 y=0 width=19 height=25 xoffset=0 yoffset=2 xadvance=20 page=0 chnl=0
+char id=54 x=228 y=0 width=19 height=25 xoffset=0 yoffset=2 xadvance=20 page=0 chnl=0
+char id=51 x=0 y=31 width=19 height=25 xoffset=0 yoffset=2 xadvance=20 page=0 chnl=0
+char id=121 x=19 y=31 width=17 height=25 xoffset=-2 yoffset=8 xadvance=14 page=0 chnl=0
+char id=113 x=36 y=31 width=16 height=25 xoffset=0 yoffset=8 xadvance=17 page=0 chnl=0
+char id=112 x=52 y=31 width=16 height=25 xoffset=0 yoffset=8 xadvance=17 page=0 chnl=0
+char id=103 x=68 y=31 width=16 height=25 xoffset=0 yoffset=8 xadvance=17 page=0 chnl=0
+char id=83 x=84 y=31 width=19 height=25 xoffset=-1 yoffset=2 xadvance=19 page=0 chnl=0
+char id=81 x=103 y=31 width=23 height=25 xoffset=-1 yoffset=2 xadvance=22 page=0 chnl=0
+char id=79 x=126 y=31 width=21 height=25 xoffset=-1 yoffset=2 xadvance=20 page=0 chnl=0
+char id=71 x=147 y=31 width=20 height=25 xoffset=0 yoffset=2 xadvance=21 page=0 chnl=0
+char id=67 x=167 y=31 width=20 height=25 xoffset=0 yoffset=2 xadvance=20 page=0 chnl=0
+char id=38 x=187 y=31 width=23 height=24 xoffset=0 yoffset=3 xadvance=23 page=0 chnl=0
+char id=63 x=210 y=31 width=17 height=24 xoffset=0 yoffset=2 xadvance=18 page=0 chnl=0
+char id=53 x=227 y=31 width=19 height=24 xoffset=0 yoffset=3 xadvance=20 page=0 chnl=0
+char id=50 x=0 y=56 width=19 height=24 xoffset=0 yoffset=2 xadvance=20 page=0 chnl=0
+char id=102 x=19 y=56 width=13 height=24 xoffset=-1 yoffset=2 xadvance=10 page=0 chnl=0
+char id=100 x=32 y=56 width=16 height=24 xoffset=0 yoffset=3 xadvance=17 page=0 chnl=0
+char id=98 x=48 y=56 width=16 height=24 xoffset=0 yoffset=3 xadvance=17 page=0 chnl=0
+char id=85 x=64 y=56 width=20 height=24 xoffset=0 yoffset=3 xadvance=22 page=0 chnl=0
+char id=74 x=84 y=56 width=17 height=24 xoffset=-1 yoffset=3 xadvance=17 page=0 chnl=0
+char id=35 x=101 y=56 width=20 height=23 xoffset=0 yoffset=3 xadvance=20 page=0 chnl=0
+char id=33 x=121 y=56 width=6 height=23 xoffset=1 yoffset=3 xadvance=9 page=0 chnl=0
+char id=55 x=127 y=56 width=19 height=23 xoffset=0 yoffset=3 xadvance=20 page=0 chnl=0
+char id=52 x=146 y=56 width=21 height=23 xoffset=-1 yoffset=3 xadvance=20 page=0 chnl=0
+char id=49 x=167 y=56 width=12 height=23 xoffset=2 yoffset=3 xadvance=20 page=0 chnl=0
+char id=108 x=179 y=56 width=6 height=23 xoffset=0 yoffset=3 xadvance=8 page=0 chnl=0
+char id=107 x=185 y=56 width=17 height=23 xoffset=0 yoffset=3 xadvance=15 page=0 chnl=0
+char id=105 x=202 y=56 width=6 height=23 xoffset=0 yoffset=3 xadvance=8 page=0 chnl=0
+char id=104 x=208 y=56 width=16 height=23 xoffset=0 yoffset=3 xadvance=17 page=0 chnl=0
+char id=90 x=224 y=56 width=20 height=23 xoffset=-1 yoffset=3 xadvance=19 page=0 chnl=0
+char id=89 x=0 y=80 width=24 height=23 xoffset=-2 yoffset=3 xadvance=19 page=0 chnl=0
+char id=88 x=24 y=80 width=24 height=23 xoffset=-2 yoffset=3 xadvance=19 page=0 chnl=0
+char id=87 x=48 y=80 width=33 height=23 xoffset=-1 yoffset=3 xadvance=32 page=0 chnl=0
+char id=86 x=81 y=80 width=24 height=23 xoffset=-2 yoffset=3 xadvance=19 page=0 chnl=0
+char id=84 x=105 y=80 width=20 height=23 xoffset=-1 yoffset=3 xadvance=17 page=0 chnl=0
+char id=82 x=125 y=80 width=20 height=23 xoffset=0 yoffset=3 xadvance=21 page=0 chnl=0
+char id=80 x=145 y=80 width=19 height=23 xoffset=0 yoffset=3 xadvance=20 page=0 chnl=0
+char id=78 x=164 y=80 width=21 height=23 xoffset=0 yoffset=3 xadvance=23 page=0 chnl=0
+char id=77 x=185 y=80 width=26 height=23 xoffset=0 yoffset=3 xadvance=28 page=0 chnl=0
+char id=76 x=211 y=80 width=17 height=23 xoffset=0 yoffset=3 xadvance=17 page=0 chnl=0
+char id=75 x=228 y=80 width=22 height=23 xoffset=0 yoffset=3 xadvance=20 page=0 chnl=0
+char id=73 x=0 y=103 width=7 height=23 xoffset=0 yoffset=3 xadvance=8 page=0 chnl=0
+char id=72 x=7 y=103 width=21 height=23 xoffset=0 yoffset=3 xadvance=22 page=0 chnl=0
+char id=70 x=28 y=103 width=17 height=23 xoffset=0 yoffset=3 xadvance=17 page=0 chnl=0
+char id=69 x=45 y=103 width=16 height=23 xoffset=0 yoffset=3 xadvance=17 page=0 chnl=0
+char id=68 x=61 y=103 width=21 height=23 xoffset=0 yoffset=3 xadvance=22 page=0 chnl=0
+char id=66 x=82 y=103 width=20 height=23 xoffset=0 yoffset=3 xadvance=21 page=0 chnl=0
+char id=65 x=102 y=103 width=23 height=23 xoffset=-1 yoffset=3 xadvance=20 page=0 chnl=0
+char id=116 x=125 y=103 width=15 height=22 xoffset=-2 yoffset=5 xadvance=12 page=0 chnl=0
+char id=64 x=140 y=103 width=20 height=21 xoffset=0 yoffset=5 xadvance=21 page=0 chnl=0
+char id=59 x=160 y=103 width=7 height=21 xoffset=-1 yoffset=8 xadvance=7 page=0 chnl=0
+char id=117 x=167 y=103 width=16 height=19 xoffset=0 yoffset=8 xadvance=17 page=0 chnl=0
+char id=115 x=183 y=103 width=16 height=19 xoffset=0 yoffset=8 xadvance=16 page=0 chnl=0
+char id=111 x=199 y=103 width=16 height=19 xoffset=0 yoffset=8 xadvance=17 page=0 chnl=0
+char id=101 x=215 y=103 width=16 height=19 xoffset=0 yoffset=8 xadvance=17 page=0 chnl=0
+char id=99 x=231 y=103 width=16 height=19 xoffset=0 yoffset=8 xadvance=17 page=0 chnl=0
+char id=97 x=0 y=126 width=16 height=19 xoffset=0 yoffset=8 xadvance=17 page=0 chnl=0
+char id=62 x=16 y=126 width=16 height=18 xoffset=-1 yoffset=5 xadvance=15 page=0 chnl=0
+char id=60 x=32 y=126 width=16 height=18 xoffset=-1 yoffset=5 xadvance=15 page=0 chnl=0
+char id=58 x=48 y=126 width=7 height=18 xoffset=0 yoffset=8 xadvance=8 page=0 chnl=0
+char id=122 x=55 y=126 width=15 height=18 xoffset=-1 yoffset=8 xadvance=14 page=0 chnl=0
+char id=120 x=70 y=126 width=19 height=18 xoffset=-2 yoffset=8 xadvance=14 page=0 chnl=0
+char id=119 x=89 y=126 width=25 height=18 xoffset=-1 yoffset=8 xadvance=22 page=0 chnl=0
+char id=118 x=114 y=126 width=19 height=18 xoffset=-2 yoffset=8 xadvance=14 page=0 chnl=0
+char id=114 x=133 y=126 width=13 height=18 xoffset=1 yoffset=8 xadvance=14 page=0 chnl=0
+char id=110 x=146 y=126 width=16 height=18 xoffset=0 yoffset=8 xadvance=17 page=0 chnl=0
+char id=109 x=162 y=126 width=25 height=18 xoffset=0 yoffset=8 xadvance=27 page=0 chnl=0
+char id=43 x=187 y=126 width=18 height=17 xoffset=1 yoffset=6 xadvance=20 page=0 chnl=0
+char id=42 x=205 y=126 width=15 height=14 xoffset=2 yoffset=3 xadvance=20 page=0 chnl=0
+char id=94 x=220 y=126 width=18 height=13 xoffset=-1 yoffset=2 xadvance=15 page=0 chnl=0
+char id=39 x=238 y=126 width=6 height=12 xoffset=0 yoffset=3 xadvance=7 page=0 chnl=0
+char id=34 x=244 y=126 width=10 height=12 xoffset=0 yoffset=3 xadvance=11 page=0 chnl=0
+char id=61 x=0 y=145 width=18 height=11 xoffset=1 yoffset=9 xadvance=20 page=0 chnl=0
+char id=44 x=18 y=145 width=7 height=9 xoffset=0 yoffset=20 xadvance=8 page=0 chnl=0
+char id=126 x=25 y=145 width=19 height=8 xoffset=-1 yoffset=1 xadvance=16 page=0 chnl=0
+char id=96 x=44 y=145 width=9 height=8 xoffset=3 yoffset=3 xadvance=17 page=0 chnl=0
+char id=95 x=53 y=145 width=18 height=6 xoffset=-1 yoffset=24 xadvance=17 page=0 chnl=0
+char id=45 x=71 y=145 width=11 height=6 xoffset=-1 yoffset=14 xadvance=8 page=0 chnl=0
+char id=46 x=82 y=145 width=7 height=6 xoffset=0 yoffset=20 xadvance=8 page=0 chnl=0
View
BIN cookbook/receipt3-animating-sprites/Resources/eurostile_30.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
17 cookbook/receipt3-animating-sprites/Resources/fps_images.fnt
@@ -0,0 +1,17 @@
+info face="Consolas" size=16 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=2,2
+common lineHeight=18 base=12 scaleW=64 scaleH=64 pages=1 packed=0
+page id=0 file="fps_images.png"
+chars count=13
+char id=47 x=2 y=2 width=11 height=17 xoffset=0 yoffset=-0 xadvance=9 page=0 chnl=0 letter="/"
+char id=48 x=15 y=2 width=13 height=16 xoffset=-1 yoffset=-0 xadvance=9 page=0 chnl=0 letter="0"
+char id=56 x=30 y=2 width=12 height=16 xoffset=-1 yoffset=-0 xadvance=9 page=0 chnl=0 letter="8"
+char id=51 x=44 y=2 width=11 height=16 xoffset=0 yoffset=-0 xadvance=9 page=0 chnl=0 letter="3"
+char id=53 x=2 y=21 width=11 height=16 xoffset=0 yoffset=-0 xadvance=9 page=0 chnl=0 letter="5"
+char id=54 x=15 y=21 width=11 height=16 xoffset=0 yoffset=-0 xadvance=9 page=0 chnl=0 letter="6"
+char id=52 x=28 y=21 width=13 height=15 xoffset=-1 yoffset=-0 xadvance=9 page=0 chnl=0 letter="4"
+char id=55 x=43 y=21 width=12 height=15 xoffset=-1 yoffset=-0 xadvance=9 page=0 chnl=0 letter="7"
+char id=57 x=2 y=39 width=12 height=15 xoffset=-1 yoffset=-0 xadvance=9 page=0 chnl=0 letter="9"
+char id=49 x=16 y=39 width=11 height=15 xoffset=0 yoffset=-0 xadvance=9 page=0 chnl=0 letter="1"
+char id=50 x=29 y=39 width=11 height=15 xoffset=0 yoffset=-0 xadvance=9 page=0 chnl=0 letter="2"
+char id=46 x=42 y=39 width=7 height=8 xoffset=2 yoffset=8 xadvance=9 page=0 chnl=0 letter="."
+char id=32 x=51 y=39 width=0 height=0 xoffset=0 yoffset=132 xadvance=9 page=0 chnl=0 letter="space"
View
BIN cookbook/receipt3-animating-sprites/Resources/fps_images.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN cookbook/receipt3-animating-sprites/Resources/lightning_bolt.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN cookbook/receipt3-animating-sprites/Resources/lightning_glow.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
92 cookbook/receipt3-animating-sprites/Resources/simple_bat.plist
@@ -0,0 +1,92 @@
+<?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>texture</key>
+ <dict>
+ <key>width</key>
+ <integer>192</integer>
+ <key>height</key>
+ <integer>48</integer>
+ </dict>
+ <key>frames</key>
+ <dict>
+ <key>simple_bat_01.png</key>
+ <dict>
+ <key>x</key>
+ <integer>0</integer>
+ <key>y</key>
+ <integer>0</integer>
+ <key>width</key>
+ <integer>48</integer>
+ <key>height</key>
+ <integer>48</integer>
+ <key>offsetX</key>
+ <real>0</real>
+ <key>offsetY</key>
+ <real>0</real>
+ <key>originalWidth</key>
+ <integer>48</integer>
+ <key>originalHeight</key>
+ <integer>48</integer>
+ </dict>
+ <key>simple_bat_02.png</key>
+ <dict>
+ <key>x</key>
+ <integer>48</integer>
+ <key>y</key>
+ <integer>0</integer>
+ <key>width</key>
+ <integer>48</integer>
+ <key>height</key>
+ <integer>48</integer>
+ <key>offsetX</key>
+ <real>0</real>
+ <key>offsetY</key>
+ <real>0</real>
+ <key>originalWidth</key>
+ <integer>48</integer>
+ <key>originalHeight</key>
+ <integer>48</integer>
+ </dict>
+ <key>simple_bat_03.png</key>
+ <dict>
+ <key>x</key>
+ <integer>96</integer>
+ <key>y</key>
+ <integer>0</integer>
+ <key>width</key>
+ <integer>48</integer>
+ <key>height</key>
+ <integer>48</integer>
+ <key>offsetX</key>
+ <real>0</real>
+ <key>offsetY</key>
+ <real>0</real>
+ <key>originalWidth</key>
+ <integer>48</integer>
+ <key>originalHeight</key>
+ <integer>48</integer>
+ </dict>
+ <key>simple_bat_04.png</key>
+ <dict>
+ <key>x</key>
+ <integer>144</integer>
+ <key>y</key>
+ <integer>0</integer>
+ <key>width</key>
+ <integer>48</integer>
+ <key>height</key>
+ <integer>48</integer>
+ <key>offsetX</key>
+ <real>0</real>
+ <key>offsetY</key>
+ <real>0</real>
+ <key>originalWidth</key>
+ <integer>48</integer>
+ <key>originalHeight</key>
+ <integer>48</integer>
+ </dict>
+ </dict>
+</dict>
+</plist>
View
BIN cookbook/receipt3-animating-sprites/Resources/simple_bat.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
86 cookbook/receipt3-animating-sprites/proj.win32/Tutorial2.rc
@@ -0,0 +1,86 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#define APSTUDIO_HIDDEN_SYMBOLS
+#include "windows.h"
+#undef APSTUDIO_HIDDEN_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDR_MAINFRAME ICON "res\\Tutorial2.ico"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,1
+ PRODUCTVERSION 1,0,0,1
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904B0"
+ BEGIN
+ VALUE "CompanyName", "\0"
+ VALUE "FileDescription", "Tutorial2 Module\0"
+ VALUE "FileVersion", "1, 0, 0, 1\0"
+ VALUE "InternalName", "Tutorial2\0"
+ VALUE "LegalCopyright", "Copyright \0"
+ VALUE "OriginalFilename", "Tutorial2.exe\0"
+ VALUE "ProductName", "Tutorial2 Module\0"
+ VALUE "ProductVersion", "1, 0, 0, 1\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x0409, 0x04B0
+ END
+END
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
View
151 cookbook/receipt3-animating-sprites/proj.win32/Tutorial2.win32.vcxproj
@@ -0,0 +1,151 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{567D158D-4AB4-4756-9CE7-B6B7B2D7D931}</ProjectGuid>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <OutDir>$(SolutionDir)$(Configuration).win32\</OutDir>
+ <IntDir>$(Configuration).win32\</IntDir>
+ <LinkIncremental>true</LinkIncremental>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <OutDir>$(SolutionDir)$(Configuration).win32\</OutDir>
+ <IntDir>$(Configuration).win32\</IntDir>
+ <LinkIncremental>false</LinkIncremental>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>.;..\Classes;..\..\cocos2dx;..\..\cocos2dx\actions;..\..\cocos2dx\base_nodes;..\..\cocos2dx\cocoa;..\..\cocos2dx\effects;..\..\cocos2dx\include;..\..\cocos2dx\kazmath\include;..\..\cocos2dx\keypad_dispatcher;..\..\cocos2dx\label_nodes;..\..\cocos2dx\layers_scenes_transitions_nodes;..\..\cocos2dx\menu_nodes;..\..\cocos2dx\misc_nodes;..\..\cocos2dx\particle_nodes;..\..\cocos2dx\script_support;..\..\cocos2dx\shaders;..\..\cocos2dx\sprite_nodes;..\..\cocos2dx\support;..\..\cocos2dx\text_input_node;..\..\cocos2dx\textures;..\..\cocos2dx\tileMap_parallax_nodes;..\..\cocos2dx\touch_dispatcher;..\..\cocos2dx\platform;..\..\cocos2dx\platform\win32;..\..\cocos2dx\platform\third_party\win32;..\..\cocos2dx\platform\third_party\win32\OGLES;..\..\;..\..\CocosDenshion\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <MinimalRebuild>true</MinimalRebuild>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <DisableSpecificWarnings>4251;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <AdditionalDependencies>libcocos2d.lib;libGLESv2.lib;libBox2d.lib;libCocosDenshion.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ <ResourceCompile>
+ <Culture>0x0409</Culture>
+ <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ <Midl>
+ <MkTypLibCompatible>false</MkTypLibCompatible>
+ <TargetEnvironment>Win32</TargetEnvironment>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <HeaderFileName>Tutorial2.h</HeaderFileName>
+ <InterfaceIdentifierFileName>Tutorial2_i.c</InterfaceIdentifierFileName>
+ <ProxyFileName>Tutorial2_p.c</ProxyFileName>
+ <GenerateStublessProxies>true</GenerateStublessProxies>
+ <TypeLibraryName>$(IntDir)/Tutorial2.tlb</TypeLibraryName>
+ <DllDataFileName>
+ </DllDataFileName>
+ </Midl>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>.;..\Classes;..\..\cocos2dx;..\..\cocos2dx\actions;..\..\cocos2dx\base_nodes;..\..\cocos2dx\cocoa;..\..\cocos2dx\effects;..\..\cocos2dx\include;..\..\cocos2dx\kazmath\include;..\..\cocos2dx\keypad_dispatcher;..\..\cocos2dx\label_nodes;..\..\cocos2dx\layers_scenes_transitions_nodes;..\..\cocos2dx\menu_nodes;..\..\cocos2dx\misc_nodes;..\..\cocos2dx\particle_nodes;..\..\cocos2dx\script_support;..\..\cocos2dx\shaders;..\..\cocos2dx\sprite_nodes;..\..\cocos2dx\support;..\..\cocos2dx\text_input_node;..\..\cocos2dx\textures;..\..\cocos2dx\tileMap_parallax_nodes;..\..\cocos2dx\touch_dispatcher;..\..\cocos2dx\platform;..\..\cocos2dx\platform\win32;..\..\cocos2dx\platform\third_party\win32;..\..\cocos2dx\platform\third_party\win32\OGLES;..\..\;..\..\CocosDenshion\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <ExceptionHandling>
+ </ExceptionHandling>
+ <DebugInformationFormat>
+ </DebugInformationFormat>
+ <PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <DisableSpecificWarnings>4251;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ <AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <AdditionalDependencies>libcocos2d.lib;libGLESv2.lib;libBox2d.lib;libCocosDenshion.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ <ResourceCompile>
+ <Culture>0x0409</Culture>
+ <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ <Midl>
+ <MkTypLibCompatible>false</MkTypLibCompatible>
+ <TargetEnvironment>Win32</TargetEnvironment>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <HeaderFileName>Tutorial2.h</HeaderFileName>
+ <InterfaceIdentifierFileName>Tutorial2_i.c</InterfaceIdentifierFileName>
+ <ProxyFileName>Tutorial2_p.c</ProxyFileName>
+ <GenerateStublessProxies>true</GenerateStublessProxies>
+ <TypeLibraryName>$(IntDir)/Tutorial2.tlb</TypeLibraryName>
+ <DllDataFileName>
+ </DllDataFileName>
+ </Midl>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <None Include="..\Resources\CloseNormal.png" />
+ <None Include="..\Resources\CloseSelected.png" />
+ <None Include="..\Resources\fps_images.fnt" />
+ <None Include="..\Resources\fps_images.png" />
+ <None Include="..\Resources\HelloWorld.png" />
+ <None Include="res\Tutorial2.ico" />
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="Tutorial2.rc" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\Classes\AppDelegate.h" />
+ <ClInclude Include="..\Classes\Ch1_AnimatingSprites.h" />
+ <ClInclude Include="..\Classes\SimpleAnimObject.h" />
+ <ClInclude Include="main.h" />
+ <ClInclude Include="resource.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\Classes\AppDelegate.cpp" />
+ <ClCompile Include="..\Classes\Ch1_AnimatingSprites.cpp" />
+ <ClCompile Include="..\Classes\SimpleAnimObject.cpp" />
+ <ClCompile Include="main.cpp" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
View
71 cookbook/receipt3-animating-sprites/proj.win32/Tutorial2.win32.vcxproj.filters
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="source">
+ <UniqueIdentifier>{8287fef6-c8a8-4384-91b5-dac12fa10309}</UniqueIdentifier>
+ <Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm</Extensions>
+ </Filter>
+ <Filter Include="include">
+ <UniqueIdentifier>{8c635f68-e310-42a3-80d4-daa6865b9b6a}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl;inc</Extensions>
+ </Filter>
+ <Filter Include="resource">
+ <UniqueIdentifier>{2e12f269-2a47-40a8-a9cd-1b1ed074e311}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;jpg;jpeg;jpe;png;manifest</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="res\Tutorial2.ico">
+ <Filter>resource</Filter>
+ </None>
+ <None Include="..\Resources\CloseNormal.png">
+ <Filter>resource</Filter>
+ </None>
+ <None Include="..\Resources\HelloWorld.png">
+ <Filter>resource</Filter>
+ </None>
+ <None Include="..\Resources\fps_images.fnt" />
+ <None Include="..\Resources\fps_images.png">
+ <Filter>resource</Filter>
+ </None>
+ <None Include="..\Resources\CloseSelected.png">
+ <Filter>include</Filter>
+ </None>
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="Tutorial2.rc">
+ <Filter>resource</Filter>
+ </ResourceCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="resource.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="main.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Classes\AppDelegate.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Classes\SimpleAnimObject.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Classes\Ch1_AnimatingSprites.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="main.cpp">
+ <Filter>source</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Classes\AppDelegate.cpp">
+ <Filter>source</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Classes\SimpleAnimObject.cpp">
+ <Filter>source</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Classes\Ch1_AnimatingSprites.cpp">
+ <Filter>source</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
View
10 cookbook/receipt3-animating-sprites/proj.win32/Tutorial2.win32.vcxproj.user
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <ShowAllFiles>false</ShowAllFiles>
+ <LocalDebuggerWorkingDirectory Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)..\Resources</LocalDebuggerWorkingDirectory>
+ <LocalDebuggerWorkingDirectory Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)..\Resources</LocalDebuggerWorkingDirectory>
+ <DebuggerFlavor Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WindowsLocalDebugger</DebuggerFlavor>
+ <DebuggerFlavor Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WindowsLocalDebugger</DebuggerFlavor>
+ </PropertyGroup>
+</Project>
View
40 cookbook/receipt3-animating-sprites/proj.win32/main.cpp
@@ -0,0 +1,40 @@
+#include "main.h"
+#include "AppDelegate.h"
+#include "CCEGLView.h"
+
+USING_NS_CC;
+
+// uncomment below line, open debug console
+// #define USE_WIN32_CONSOLE
+
+int APIENTRY _tWinMain(HINSTANCE hInstance,
+ HINSTANCE hPrevInstance,
+ LPTSTR lpCmdLine,
+ int nCmdShow)
+{
+ UNREFERENCED_PARAMETER(hPrevInstance);
+ UNREFERENCED_PARAMETER(lpCmdLine);
+
+#ifdef USE_WIN32_CONSOLE
+ AllocConsole();
+ freopen("CONIN$", "r", stdin);
+ freopen("CONOUT$", "w", stdout);
+ freopen("CONOUT$", "w", stderr);
+#endif
+
+ // create the application instance
+ AppDelegate app;
+ CCEGLView& eglView = CCEGLView::sharedOpenGLView();
+ eglView.setViewName("Cookbook Receipt runs Cocos2d-x");
+ eglView.setFrameSize(480, 320);
+ // set the design resolution screen size, if you want to use Design Resoulution scaled to current screen, please uncomment next line.
+ // eglView.setDesignResolutionSize(480, 320);
+
+ int ret = CCApplication::sharedApplication().run();
+
+#ifdef USE_WIN32_CONSOLE
+ FreeConsole();
+#endif
+
+ return ret;
+}
View
13 cookbook/receipt3-animating-sprites/proj.win32/main.h
@@ -0,0 +1,13 @@
+#ifndef __MAIN_H__
+#define __MAIN_H__
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+
+// Windows Header Files:
+#include <windows.h>
+#include <tchar.h>
+
+// C RunTime Header Files
+#include "CCStdC.h"
+
+#endif // __WINMAIN_H__
View
BIN cookbook/receipt3-animating-sprites/proj.win32/res/Tutorial2.ico
Binary file not shown.
View
20 cookbook/receipt3-animating-sprites/proj.win32/resource.h
@@ -0,0 +1,20 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by Tutorial2.RC
+//
+
+#define IDS_PROJNAME 100
+#define IDR_TUTORIAL2 100
+
+#define ID_FILE_NEW_WINDOW 32771
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 201
+#define _APS_NEXT_CONTROL_VALUE 1000
+#define _APS_NEXT_SYMED_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 32775
+#endif
+#endif

0 comments on commit a54e5aa

Please sign in to comment.
Something went wrong with that request. Please try again.