c++ - Render cycle in cocos2d-x -
i have game engine written my team, it's component based. has logic components , visual components. in visual components there function named updatevisual(delta)
, drawn there.
for example, let's take physic ball entity in world:
class logicballcomponent { // ... }; class visualballcomponent { sfml::texture mballtexture; void updatevisual(float) { mballtexture.translate(...); globaldisplaymanager::instance().draw(mballtexture); } };
globaldisplaymanager
returns window representation creates gl-states, etc. (sf::renderwindow in sfml). system easy integrate.
now need make android-game using engine. i've chosen cocos2d-x use window creation, rendering, fonts, resources etc.
there way job:
class ball : public clayer { bool ball::init() { csprite* sprite = csprite::create(...); this->addchild(sprite, 0); // [!] } };
and don't know how use in way. there such possibility?
you should check out function "void ccdisplaylinkdirector::mainloop(void)", main loop of coco2d-x rendering engine.
coco2d-x provides wrappers periodic calling loop. in ios should check function startmainloop of ccdirectorcaller.mm in platform/ios.
Comments
Post a Comment