• 大小: 40.83MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-07-29
  • 语言: Python
  • 标签: cocos2dx  

资源简介

使用cocos2d-x 3.8.1版本,内含客户端和服务端源码,服务端用python 2.7.5开发,还有很多功能没有完成,想要学习的同学可以下载下来参考

资源截图

代码片段和文件信息

#include “AppDelegate.h“
#include “Scene/SceneManager.h“
#include “Tools/PromptBox/PromptBox.h“
#include “Tools/CsvUtils/CsvUtils.h“
#include “Tools/WebSocketManager/WebSocketManager.h“

USING_NS_CC;

static cocos2d::Size designResolutionSize = cocos2d::Size(800 450);
static cocos2d::Size smallResolutionSize = cocos2d::Size(480 320);
static cocos2d::Size mediumResolutionSize = cocos2d::Size(1024 768);
static cocos2d::Size largeResolutionSize = cocos2d::Size(2048 1536);

AppDelegate::AppDelegate() {
CC_SAFE_RETAIN(SceneManager::getInstance());
CC_SAFE_RETAIN(PromptBox::getInstance());
CC_SAFE_RETAIN(CsvUtils::getInstance());
CC_SAFE_RETAIN(WebSocketManager::getInstance());
}

AppDelegate::~AppDelegate() 
{
CC_SAFE_RELEASE(SceneManager::getInstance());
CC_SAFE_RELEASE(PromptBox::getInstance());
CC_SAFE_RELEASE(CsvUtils::getInstance());
CC_SAFE_RELEASE(WebSocketManager::getInstance());
}

//if you want a different contextjust modify the value of glContextAttrs
//it will takes effect on all platforms
void AppDelegate::initGLContextAttrs()
{
    //set OpenGL context attributionsnow can only set six attributions:
    //redgreenbluealphadepthstencil
    GLContextAttrs glContextAttrs = {8 8 8 8 24 8};

    GLView::setGLContextAttrs(glContextAttrs);
}

// If you want to use packages manager to install more packages 
// don‘t modify or remove this function
static int register_all_packages()
{
    return 0; //flag for packages manager
}

bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    auto director = Director::getInstance();
    auto glview = director->getOpenGLView();
    if(!glview) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)
        glview = GLViewImpl::createWithRect(“Battle_Of_Balls“ Rect(0 0 designResolutionSize.width designResolutionSize.height));
#else
        glview = GLViewImpl::create(“Battle_Of_Balls“);
#endif
        director->setOpenGLView(glview);
    }

    // turn on display FPS
    director->setDisplayStats(false);

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

    // Set the design resolution
    glview->setDesignResolutionSize(designResolutionSize.width designResolutionSize.height ResolutionPolicy::NO_BORDER);
//glview->setframeSize(800 450);

    Size frameSize = glview->getframeSize();
    // if the frame‘s height is larger than the height of medium size.
    //if (frameSize.height > mediumResolutionSize.height)
    //{        
    //    director->setContentScaleFactor(MIN(largeResolutionSize.height/designResolutionSize.height largeResolutionSize.width/designResolutionSize.width));
    //}
    //// if the frame‘s height is larger than the height of small size.
    //else if (frameSize.height > smallResolutionSize.height)
    //{        
    //    director->setContentScaleFactor(MIN(mediumResolutionSize.height/

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-03-08 22:09  BattleOfBalls\
     目录           0  2017-03-08 22:04  BattleOfBalls\Classes\
     文件        4096  2016-12-19 22:28  BattleOfBalls\Classes\AppDelegate.cpp
     文件         987  2016-11-09 14:37  BattleOfBalls\Classes\AppDelegate.h
     目录           0  2017-03-08 22:00  BattleOfBalls\Classes\Entity\
     文件         615  2016-11-29 23:36  BattleOfBalls\Classes\Entity\Bean.cpp
     文件         229  2016-11-26 21:34  BattleOfBalls\Classes\Entity\Bean.h
     文件         247  2016-11-25 23:31  BattleOfBalls\Classes\Entity\Entity.cpp
     文件         300  2017-03-08 21:51  BattleOfBalls\Classes\Entity\Entity.h
     文件       16878  2017-03-08 21:51  BattleOfBalls\Classes\Entity\Player.cpp
     文件        2177  2017-03-08 21:51  BattleOfBalls\Classes\Entity\Player.h
     文件        4729  2017-01-10 21:48  BattleOfBalls\Classes\Entity\PlayerDivision.cpp
     文件        1381  2017-01-10 21:48  BattleOfBalls\Classes\Entity\PlayerDivision.h
     文件         637  2016-12-19 22:40  BattleOfBalls\Classes\Entity\Prick.cpp
     文件         235  2016-11-26 21:34  BattleOfBalls\Classes\Entity\Prick.h
     文件        1244  2017-01-09 18:11  BattleOfBalls\Classes\Entity\Spore.cpp
     文件         333  2017-01-09 18:11  BattleOfBalls\Classes\Entity\Spore.h
     目录           0  2017-03-08 22:00  BattleOfBalls\Classes\Header\
     文件        1964  2017-03-08 21:51  BattleOfBalls\Classes\Header\AppMacros.h
     文件         295  2016-12-20 21:22  BattleOfBalls\Classes\Header\Common.h
     文件         309  2017-03-08 21:51  BattleOfBalls\Classes\Header\GameModeType.h
     文件        1419  2017-03-08 21:51  BattleOfBalls\Classes\Header\MessageType.h
     文件        1172  2016-11-14 21:36  BattleOfBalls\Classes\HelloWorldScene.cpp
     文件         481  2016-11-11 21:16  BattleOfBalls\Classes\HelloWorldScene.h
     目录           0  2017-03-08 22:00  BattleOfBalls\Classes\Scene\
     目录           0  2017-03-08 22:00  BattleOfBalls\Classes\Scene\EnterScene\
     文件        3522  2017-03-08 21:51  BattleOfBalls\Classes\Scene\EnterScene\EnterScene.cpp
     文件         669  2017-03-08 21:51  BattleOfBalls\Classes\Scene\EnterScene\EnterScene.h
     目录           0  2017-03-08 22:00  BattleOfBalls\Classes\Scene\GameScene\
     文件        4846  2017-01-09 09:25  BattleOfBalls\Classes\Scene\GameScene\Datalayer.cpp
     文件         720  2017-03-08 21:51  BattleOfBalls\Classes\Scene\GameScene\Datalayer.h
............此处省略541个文件信息

评论

共有 条评论