How to use texture generated by TexturePacker in CocosBuilder? - cocos2d-iphone

I know it's possible to create texture by Smart Sprite feature in CocosBuilder 3.0. But it's very unstable now. So I decided to use TexturePacker to generate the texture. My .plist and .png files are generated into different folders for different resolution inside my CocosBuilder project folder like this:
The problem is only the .png files shown in CocosBuilder (I can't find the .plist file):
Of course if I move the .png and .plist file into Resources folder. Both are will be shown inside CocosBuilder. But I have no way to select correct image for different resolution any more. I don't know what wrong with it. Any idea?
Thank you so much.

I sovled the problem. Actually it's because the folder structure. The CocosBuilder doesn't recognize resources-iphone folder. So I rearranged the folder structure like this. Then everything is fine.

Related

how vtk do th zoom for jpeg reader and dicom reader

This is an example of a code of vtk to read a jpeg image http://www.vtk.org/Wiki/VTK/Examples/Cxx/IO/JPEGReader or dicom file http://www.vtk.org/Wiki/VTK/Examples/Cxx/IO/ReadDICOM ,
when I run these projects, i can zomm the image with the right button of the mouse
however, in the code there is nothing in a direct relation with zoom or something like this, so there is something inside the classes
can anyone tell me how vtk can do this zoom because i need it in another project ?
Yes, certainly there is code inside the other classes. vtkRenderWindow, vtkRenderWindowInteractor, and vtkRenderer are all referenced by that sample. You can trace down the zooming code through those. https://github.com/Kitware/VTK/tree/master/Rendering/Core

where to find code blocks Sfml image resources

I'm using code blocks with sfml and besides it looking ugly, I'm not sure where to store images. I have to select the exact path by putting it in the project folder in the file system. How do i add images?
Say that your project was in
C:\Users\Me\Documents\MyProj
Then then putting the images in this folder would make them visible to SFML/codeblocks when using only the image name.
If you had an image called image.png then the full path to the image would be
C:\Users\Me\Documents\MyProj\image.png
To get the image into your program you must include
#include <SFML/Graphics.hpp>
And create a texture
sf::Texture Texture1;
And then you can assign this image like
Texture1.loadFromFile("C:\Users\Me\Documents\MyProj\image.png"); //Full path
Texture1.loadFromFile("image.png"); //Relative path
Next you create a sprite
sf::Sprite MySprite
And assign the texture to it
MySprite.setTexture(Texture1);
Finally to draw in the window use
window.draw(MySprite);

Qt rendering an image and showing it

I have a small app that renders an image. It's in .ppm format and opens nicely in Mac's Xee image viewer. The image is created in the default project folder.
However, the user doesn't know where the image is after it is rendered and I would like to open it automatically or perhaps offer where to save the image before it is created.
That is the first problem. The second problem is .ppm - it's not opened by default on Windows, you need Irfan Viewer or something alike.
Is there a way to solve both those problems easily in Qt? For instance, the image is created where the user wants and my app displays it in that ppm format without using some other software? And If a user wants to reopen the image, I should probably make it possible, as well.
I am not a Qt, nor a C++ developer so I am struggling a bit with this, but I have to do it.
Thanks in advance for the tips and advices.
If you convert your image to a QImage (if it's not one already), you can specify where and in what format to save it when calling the QImage::save method.

Render a vector graphic (.svg) in C++

My and a friend are working on a 2D game where the graphics will be .svg files and we will scale them appropriately either by rasterizing them first, or rendering them directly on a surface (which still would require rasterization at some point).
The problem is, I've been looking all day to find a library that will allow me to take an .svg file and eventually get it to render in allegro. As far as I know, it would involve rasterization into some sort of format that allegro can read and then allegro could render the "flattened" image.
So what are some C++ libraries I could use for taking an .SVG file and "flattening" it so I can render it? The library obviously needs to support scaling too so I can scale the vector graphic then rasterize it.
I'm using Windows and Visual C++ Express 2010.
I've tried Cairo, but it only allows writing of .svg files and doesn't allow you to read the .svg file. I've also looked into librsvg which works with Cario, but I was having a lot of trouble getting it to work properly on Windows (because it has loads of GNOME dependencies). If you have any guides for getting these to work (on Windows) that would be great too.
The wxsvg library allows loading and manipulating SVG files. Qt also has an SVG module.
I'm coming a little late to the conversation, but I would suggest you to look at Nano SVG, an extremely lightweight svg renderer that doesn't need cairo/libsvg. I got nanosvg compiled and working in a couple of hours. It's very basic, but it gets the job done.
https://github.com/sammycage/lunasvg is a nice svg parsing, rendering and manipulating library. It is written with pure c++
SVG++ library provides advanced support for SVG reading, so that rendering SVG with allegro can be implemented in reasonable time.
I have recently put together an SVG renderer library in C++:
https://github.com/igagis/svgren
It uses AGG for rendering to off-screen surface.
Supports gradients and all kind of shapes.
Personally, I using NanoSVG in my Simple Viewer GL. It's allowing me easy to load and rasterize SVG images in few lines of code. But this library has weak SVG support.
With the help of nanosvg and many other c++ svg parsers, adding svg rendering capability to your application should be trivial. The recipe is as follows: svg parser + vector rendering library = trivial svg rendering. The vector rendering library can be cairo and a number of other libraries (nanovg comes to mind, as well as a number of other vg libraries). Here's an example of how to support svg rendering with cairo + fltk + nanosvg combo. Now, all the svg parsers, as well as cairo itself, along with other renderers, have bugs/shortcomings, but basic svg support should never present a problem.
I was looking for a real quick way to render SVG file in a Windows OS based MFC project.
In that case, Microsoft Browser Web Browser ActiveX Control is found to be an ideal solution.
And here is the result of loading SVG file using the Browser control.

How to run .gif file in cocos2d

Is it possible to run .gif file in cocos2d for iphone
CCSpriteSheet works really well for animating with spritesheets, you'll need a way to generate the spritesheet from the animated gif.
Read this.
I assume you mean an animated GIF. If so, no, not directly, but you could extract the frames and run them using any of the usual animation classes.