I trying to make an empty CCSprite then I want to hand drawing on it using touch controls.
But, I don't have an idea how make it and don't know it's possible.
So, PLS help me or give me some advice.
Thanks
I wrote a demo program for CCRenderTexture which shows you how to draw sprites (or whatever you want) with touches:
Hi You can use CCRenderTexture example from Cocos2d for drawing..
Check out this link http://www.cocos2d-iphone.org/forum/topic/8474
Related
I am trying to implement a help screen in my cocos2d game, using cocos2d version 2.0. My screen will have a title bar ("Help") at the top and then the rest of the screen below that is where I want to put a scrolling help section. Ideally I would be able to put both text and images into this help window.
The problem is that cocos2d does not have any functionality like UIScrollView, and from what I have seen doing Google searches, every custom solution I have found seems to have problems with various bugs popping up on various devices.
I have tried these solutions thus far:
CCScrollLayer: http://www.cocos2d-iphone.org/forum/topic/17118/page/3
Scrolling CCNode: http://tonyngo.net/2011/11/scrolling-ccnode-in-cocos2d/
CCScrollView: http://bitbattalion.com/2011/09/uikit-uiscrollview-and-cocos2d/
The closest thing I got to work was embedding a UITextView but that seemed to randomly crash after a few scrolls so it seems unreliable to me.
Does anyone know of a good simple robust solution to this problem? It seems like it should be straightforward but it isn't.
I recommend that you make new class say:(HelpViewClass) and implement it with an UIScrollView and add whatever you want to add on UIScrollView and then you can use this as a child to your layer.
Steps
Make a class - inherited with UIView
Add UIScrollView to the View.
Add Your components to it.
Add this UIView to the HelpLayer.
You can add any UIKit component to the cocos2d Layer by using this
[[[CCDirector sharedDirector] view] addSubView:scrollView];
Note : Remove all UI component when you go back from this HelpLayer.
I think this may help you !
Some times textures disappear from sprites. I have a sprite that appears with white color and it should have a texture on it and a label that should have a text in it an it appears with black color. The labels are subclasses of sprite so this problem is related to Sprites. Could some one tell me what is the problem ? Did some one meet this bug to in Cococs2D on Android ? Thank's !
I had such a problem when I was doing navigation from "outside" of cocos2d i.e. i relied on Android's native back button's callback to change scenes. Apparently this callback doesn't work on the same thread as cocos and causes this problem (maybe something with WeakReferences in the TextureCache). Hope it helps :)
Are you using pvr? When I tried using pvr I was getting what sounds like the same issues. I switched to png and it fixed the problem for me.
i need to create GTK GUI with image and transparent label (darker) that is placed over the image. The first problem is overlapping. I tried Gtk::Table and Gtk::Fixed container but it behaves strangely. The second problem is transparency. I would like to use CSS styles or transparent background image. Is there anybody who can help me posting some sources or examples? Thanks
You could subclass GtkWidget, or GtkDrawingArea since I think it will be faster than the altenatives. But you could use GtkOverlay, plus GtkImage and GtkLabel to acomplish what you're looking for.
gtk3-demo app that comes with Gtk+-3.0 give some examples of how to use GtkOverlay.
Maybe you could give a look to clutter-gtk ? You can do nice things with it.
how would i go about capturing my computer's screen with SDL? is this possible with SDL? i wanted to try something like applying a surface to the main renderer (if that makes any sense either) and then call:
SDL_SaveBMP(back_buffer, "screen.png");
how would i do what i want to do if it is possible? has anyone done this before?
This cannot be done. What you are describing is a platform dependent operation which is not implemented by SDL.
I hope this helps: Try to create a new surface by combining all the surfaces you want to render into one( by using getpixel() and putpixel() functions -you man need to make them yourself- ), then SDL_SaveBMP( newsurface,"name.bmp") ( I personally don't know if SaveBMP can save .png files )
I am working on a game which would take touch gestures as inputs. Now, i would like to display the path/gesture as the user draws it. Can someone please tell me how to do this in cocos2d?
I tried to override the draw method and used ccDrawPoint(). But the point just keeps following the touch. I guess this is because the previous drawing is getting overwritten.
Can you tell me where i am going wrong here or suggest a better way to implement this?
i found a solution with CCRenderTexture sample test in cocos2d. Though i could not find enough documentation on it, but the sample code is enough for a start.