Is there a way to curve text/labels in Cocos2d? - ios

Here is an example of what I would like to achieve.
Is there a way to "transform" a label in Cocos2d and obtain a curved text? I do not find any property in the CCLabelBMFont class that seem to allow this.
Any suggestion wellcome.
Rason for asking: I would prefer not to use pre-generated (with Photoshop or GIMP) text images. Hence I am looking for an answer to this problem and not to an alternative method.

One of the moderators of the Cocos2D forum has replied to me in their forum and it doesn't seem possible. Here is the link to the discussion on the forum, but as far as I can tell there is no solution (In my opinion it would require having implemented a draw call in the labels that blends the pixtures according to the new image matrix resulting from bending the original label image and as far as I can understand CCLabelBMFont does not seem to support this - and I am not sure that is easily possible to do so as the class does not derive from CCSprite but it may be in some other way that I do not know at the moment).

Related

How do I Display Select Pixels of an Image Using Swift?

I'm trying to define pixels of an image based on their color code, and display them on command. I've been researching this and can't seem to find information on the subject, I've mostly been pointed towards "Animations" and "Core Image Filters" which isn't quite what I'm looking for. Any information on the subject is much appreciated.
https://github.com/jjxtra/DRColorPicker
try this sample code of a color picker. one of the views is a plane of continuous colors and is probably what you want. apple has good source code and the swift book is great for avoiding bad questions. you have to watch it as a beginer.too many simple questions on this site and they will block you from asking more.

iOS custom image crop using paths

I need to implement a custom image crop on iOS and I can't seem to be able to find a technology that will allow me to do that easily. The goal is to have an interface as follows:
The idea is to have some sort of path or something around the face that the user can "nudge" around with their finger. Is there a library for this?
I have played a bit with UIBezierPaths, but I don't see how they can be edited after being stroked.
The best that I can come up with is having the user manually draw a line around the face, but then the line wouldn't be editable.
Please help! Does anyone know of a solution for this? I am in a bind and need to provide my client with a solution.

Is it possible to change texture hue programatically in Spritekit project?

I am interested in to how change hue of the texture in efficient way ? I am experimenting to create space dust which will change it's color every few seconds with nice, smooth transition from one color to another.
I find this possible in few ways:
Using core image like in this example. But I don't know how will this work in combination with Spritekit...
Using particle emitters to create space dust and change color of particles over time using particleColorSequnece property.
And easy one that came up on my mind , while playing with Photoshop, which is using two same, but differently colored images, one over another, and changing the opacity of the topmost one.
This gives me the effect I want, and actually looks fabulous, but is there any better way ? Maybe using SKTexture? In this particular case, I just need to change from one color to another , but what would be an efficient way to do this when multiple changes are required one after another ? This way, my third example requires additional images...
Here is the link which most closely describe what I am trying to accomplish. Just look how space dust changes its color overtime(from dark blue to purple and later to green or orange). I suppose this is done programatically... I would like to ask moderators to remove a link if it is not suitable to post it here. Thanks!
It is kind of a hard questions to answer and is rather subjective, however...
I personally would do the Emitter Node approach, because it seems like it is built for the type of use you are looking for and could have some cool effects trailing behind.
With that being said you specifically asked about changing the hue and colorBlendFactor might be what you are really looking for. I don't have a great link for it, but this might get you pointed in the right direction. You can see how they are blending colors to get the desired result.
Your solution with changing the alpha of two separate colors doesn't sound like a bad approach either.
Hopefully that helps and good luck =)

How to check intersection of two images that aren't rectangular?

New user to the site, but I have used it in the past so I felt it best to ask my question here, for the best chance of getting a response.
What I'm dealing with is one object, this being the sprite for my latest app, which I need to check for when it comes in to contact with another object, in this case, a tunnel which will curve.
Now, I'm aware of CGRectIntersectsRect, however I can't see that being helpful, as if I've got 2 UIImages, that being the top and bottom of a "mountain", and said pieces curving, there's no doubt that the sprite would touch the "rectangle".
What I need is something to trigger when the sprite hits the actual wall, however my limited knowledge of Objective-C isn't helping my case.
I imagine someone out there will know what I can do to resolve this, as for all I know it could be a simple solution.
Thank you in advance everyone!
First, I'd probably not build these basic pieces yourself. For iOS 7, you can use SpriteKit, which is built-in. If you want to support older versions of iOS, look at cocos2d (it's good for iOS 7, too).
But to the question, one approach for detecting arbitrary overlaps is to draw both objects into a buffer and check if there are any overlapping pixels (for instance, by drawing one in in pure red, and another in pure green, and then looking for pixels that have both). For a discussion of how to do this kind of thing in Core Graphics, see Clipping a CGRect to a CGPath, which provides sample code for the simplest version (checking for the intersection of a rectangle and curve), but the same approach can be used more generally. Note that this drawing can get expensive if you're doing it constantly, so usually you first check whether the bounding rectangles overlap. That tells you whether it's even worth the trouble to look closer.
But first I'd look at SpriteKit.

Stretching a UIImage across the length of a UIBezierPath

What I basically need to achieve is a Fruit Ninja - style "slash" effect, where the "slash" trails the user's touch and follows the shape of the user's gesture, and is thinner the longer the distance the user has swiped.
The simplest way to achieve this seemed to be to collect all the points the user passes through in a UIBezierPath, and "stretch" an image through the length of the BezierPath. This would achieve the kind of "trailing" effect I was looking for and also ensure that the line is thinner if the distance travelled is longer.
However I can't seem to find a way to actually implement this. Is this even possible?
Alternatives? Thanks.
P.S: This is for a low-medium priority section of a regular app and not a game, so I would like to avoid having go down to OpenGL and spend a lot of time to achieve this (with completely custom drawing, etc). Something at the SDK level would be preferred, and if that's not possible at all, we'll just figure out a different UI.
Thanks!
For pretty easy-to-use stretching teqhniques of images/views you could look into
https://github.com/hfossli/AGGeometryKit/
I recommend trying to draw using CoreGraphics. See this link
http://www.effectiveui.com/blog/2011/12/02/how-to-build-a-simple-painting-app-for-ios/
Okay. Maybe you can use this.
https://github.com/hfossli/AGDraw
Just something I wrote a while ago. Hit clear and try to draw something (clear will toggle between two types of strokes). You'll see the width of the penstroke will increase with the velocity you use.. I guess that fits your need. If you fix some bugs, please make a pull request. You are free to use the code, but I will add a MIT license later.

Resources