Coder Social home page Coder Social logo

kestrelm / creature_cocos2dx Goto Github PK

View Code? Open in Web Editor NEW
10.0 3.0 5.0 2.07 MB

Cocos2d-x Runtimes for Creature

License: Apache License 2.0

Objective-C 0.02% Objective-C++ 0.13% C++ 90.22% CMake 0.06% C 9.57%
creature spine cocos2dx cocos2d-x android gamedev engine indie runtime plugin

creature_cocos2dx's People

Contributors

kestrelm avatar null3rr0r avatar rh101 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

creature_cocos2dx's Issues

std::bad_cast on gcc5.3 and Linux

I'm trying to get a simple test working using Creature Pack on Cocos2d-x runtime on a Linux machine using GCC 5.3. Unfortunately, it throws std::bad_cast.

Adapted code from: http://www.kestrelmoon.com/creaturedocs/Game_Engine_Runtimes_And_Integration/Cocos2d-x_Runtimes%20.html

    // CreaturePack Demo, shows you how to load a Creature Pack character in cocos2d-x

    // First, create the CreaturePackLoader
    auto packFilename = CCFileUtils::getInstance()->fullPathForFilename("naser_character_data.creature_pack");
    auto packLoader = CreaturePackRenderer::createPackLoader(packFilename);

    // Now create the renderer for CreaturePack
    auto packRenderer =
        CreaturePackRenderer::Renderer::create(
            packLoader.get(),
            CCTextureCache::getInstance()->addImage("naser_character_img.png"));
    packRenderer->setScale(120.0f);
    packRenderer->setPosition(Vec2(visibleSize.width / 2 + origin.x, visibleSize.height / 2 + origin.y));

    this->addChild(packRenderer, 1);

    // Set Animation settings
    auto playerObj = packRenderer->getPlayerObj();
    playerObj->blendToAnimation("idle", 0.2f);
    playerObj->isLooping = true;
    playerObj->isPlaying = true;
    packRenderer->setPlaybackSpeed(30.0f);

Runtime output from Qt Creator:

Starting /home/babaei/NaserCompany/build-NaserTest-GCC_X64-Default/bin/MyGame...
Ready for GLSL
Ready for OpenGL 2.0
libpng warning: iCCP: known incorrect sRGB profile
terminate called after throwing an instance of 'std::bad_cast'
  what():  std::bad_cast
The program has unexpectedly finished.
/home/babaei/NaserCompany/build-NaserTest-GCC_X64-Default/bin/MyGame crashed.

I managed to track it down to line 210 from CreaturePackRenderer.cpp:

	// Helper function to create a CreaturePackLoader from a full filepath
	std::shared_ptr<CreaturePackLoader> createPackLoader(const std::string & fullpath)
	{
		// open the file:
        std::basic_ifstream<uint8_t> file(fullpath, std::ios::binary);

		// read the data:
        auto raw_bytes = std::vector<uint8_t>((std::istreambuf_iterator<uint8_t>(file)),
            std::istreambuf_iterator<uint8_t>());

        return std::shared_ptr<CreaturePackLoader>(new CreaturePackLoader(raw_bytes));
	}

It's probably std::istreambuf_iterator which throws and I don't have a clue why. Tried this on Cocos2d-x 3.14.1.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.