Home > other >  For help, questions about vs2015 and cocoStudio3.1
For help, questions about vs2015 and cocoStudio3.1

Time:09-24

Small white one, according to the tutorial on CocoStudio made a game of the initial, then on the project of VS2015 changed code, want to replace HelloWorld picture, which is import in vs. The CSB file, modify the code, the program can run, but is a black screen, screen does not display properly, to find a number of ways, has not solved, please god to give directions, tell the solution, thank you!




This is the code
H file

# pragma once
# # ifndef __Login_SCENE_H__
# define __Login_SCENE_H__

# include "cocos2d. H"

The class Login: public cocos2d: : Layer
{
Public:
The static cocos2d: : Scene * createScene ();

Virtual bool init ();

//a selector that callback
Void menuCloseCallback (cocos2d: : Ref * pSender);

};
CREATE_FUNC (Login);

# endif//__Login_SCENE_H__



The CPP file

# include "LoginScene. H"
# include "SimpleAudioEngine. H"
# include "cocostudio/cocostudio. H"
# include "UI/CocosGUI. H"

USING_NS_CC;

Using the namespace cocostudio: : timeline;

Scene * Login: : createScene ()
{
//'scene' is an autorelease object
Auto scene=scene: : create ();

//'layer' is an autorelease object
Auto layer=Login: : create ();

//add layer as a child to scene
Scene - & gt; AddChild (layer);

//return the scene
Return the scene;
}

//on "init" you need to initialize your instance
Bool Login: : init ()
{
//////////////////////////////
//1. Super init first
if (! Layer: : init ())
{
return false;
}

Auto pNode=CSLoader: : createNode (" MainScene. The CSB ");
Auto rootNode=CSLoader: : createNode (" LoginScene. The CSB ");
This - & gt; AddChild (pNode);
This - & gt; AddChild (rootNode);

return true;
}


Void Login: : menuCloseCallback (Ref * pSender)
{
//Close the cocos2d - x game scene and quit the application
Director: : getInstance () - & gt; The end ();

# if (CC_TARGET_PLATFORM==CC_PLATFORM_IOS)
exit(0);
# endif

/* To navigate back To native iOS screen (if present) without quitting the application, do not use Director: : getInstance () - & gt; End () and exit (0) as given above, home trigger a custom event created in RootViewController. Mm as below */

//EventCustom customEndEvent (" game_scene_close_event ");
//_eventDispatcher - & gt; DispatchEvent (& amp; CustomEndEvent);


}


  • Related