I would like to know if there is a way to make CCSprites load faster without using sprite sheets. The main reason I want to avoid sprite sheets is because my images are very large so using .pvr.ccz sprite sheets more than doubles my resources folder to over 40MB and I haven't even added the sprite sheets for the iPhone5.
Related
I'm working on a stream overlay that extracts information out of a game (flight simulator) and displays it on the screen. Right now I'm using Qt in conjunction with a *.html to render the overlay. It is all working really well, however I wanted to add some customization options for the users of my overlay software and I figured the best way would be to render the Overlay in QML.
The main part of the overlay is a row that contains around 8 "elements" that display the relevant data.
One thing that should be customized is the order of the elements in the row. But I really have no idea how to implement this feature. I've seen a few posts and tutorials on how to customize the order in a View using the DelegateModel. However right now it's not a view but QML Components inserted in a RowLayout due to the fact that they are all different components (e.g. some of the images are actually animated for which I'm using a component that uses Canvas2D to draw the images). I guess I could figure out a way to store those elements in a model using the Loader Component to display the content in QML. But even then I'm not entirely sure how to store and restore the order of the elements. As far as I can tell the DelegateModel only changes the View and not the underlying model.
Any suggestion or best practice to accomplish my goal would be highly appreciated.
I'm searching for docs on cocos2dx website and on google but i couldn't find any. The problem is, when I load a csb file from cocostudio, it loads all the nodes and its resources etc... it makes the texture memory so high. I would like to know if there is a method or solution for loading only selected nodes from a scene file of cocostudio.
thanks!
I had the same kind of problem, and it stems from trying to make one scene contain everything you need. I decided to split my components into layers, which are then loaded by their own components when needed.
As an example. In my Main Scene I have an inventory tray, a building area and a custom buttons panel. I split all of these into separate layers. InventoryTray.csb, BuildingArea.csb, ButtonPanel.csb and have them all seperate in code as well, one object to load each of the layouts. Overall my code is a lot more maintainable since each class just has a few lines of code in it.
This way I can load my inventory tray up, and not load my buttons panel until the user "needs" to interact with it. The same goes for fancy pause menu's that might include animations and assets that may take up more texture memory. Create it as a separate layer and load it when you need to.
I hope this helps, I never found the cocostudio scenes useful, for anything other than my menu system, since each of the menu scenes that I've built (so far) has been self-contained.
You can try get a component of the .csb:
auto node = CSLoader::createNode("MainScene/MainScene.csb");
node->getComponent("Star_GameButton")->setEnabled(false);
You need the name of your component ,that is on the porperties on cocos Studio
I am starter in cocos2d-x.I have multiple sprites of arms legs eyes etc.i want to create a single sprite ,suppose a human out of it who has arms,legs,eyes,head,body etc.How to do it..As i have to animate them and make the human walking and also i have to kill it on touch.Any one here please tell me the logic in cocos2d-x using c++
CocosBuilder can be used for assembling the body parts. By laying down each sprite to its own layer, you can also animate them, create different animations for walking, dying.
Tutorials :
http://www.raywenderlich.com/23996/introduction-to-cocosbuilder
http://www.plungeinteractive.com/blog/2012/10/29/using-cocosbuilder-on-cocos2d-x-games/
There is another way of using it.We can use cocostudio also and export the file as JSON
Refer to this link
http://upyun.cocimg.com/CocoStudio/helpdoc/v1.0.0.0/en/index.html
I am sorry for the terrible description of this question. I am making a game where the user has to try and through a football through a moving tire. I have the game set up with a single scene & layer and I am wondering how to implement options for having different background images, tires, and footballs to choose from. I don't expect someone to explain to me how to code my game. I want to have specific objects for the different background images. Like, for instance, a prison background image would have a metal tire, different football, and have certain objects be flying through the scene while attempting to throw the football through the tire. Should I create a separate scene & layer for each background image & its corresponding sprites or is there a better way to go about this. All I am asking is for someone to point me to some example code or a project that does something similar. SORRY for the long post
If you are willing to keep everything in just one png (background + moving sprites) and use a CCSpriteBatchNode you can easily keep the rects of the elements equal for all the different settings and just load a different file.
Otherwise just have a set of files and use same CGRect, it shouldn't be hard at all..
I've been using label to display images. I'd like to be able to click and create a bounding box then be able to drag the cursor to move around in the image. What would I need to do this? Thanks.
I'm not 100% sure I understand what you are trying to do, but I think the QGraphicsScene is what you are looking for. You can (among many other things):
Render images (QGraphicsPixmapItem, for example)
Change the zoom level when rendering the scene on a QGraphicsView.
Select things using a "rubber band"
Move items around with the mouse (see QGraphicsItem::ItemIsMovable)
etc.
You may need to get familiar with Qt's graphics view framework.