Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - TwistedSage

Pages: [1]
1
Support / Get width of screen/camera
« on: January 08, 2015, 08:42:02 pm »
I’m using tk2dCamera.Instance.ScreenExtents.width to try to know when I placed objects off screen.
But it’s not quite working as expected. Do I need to use something else or are there any gotchas?

Thanks in advance

Odin

2
Support / Re: Issue when using font , shows a strange border around font
« on: December 22, 2014, 07:04:04 pm »
So if I need to downsample I need to up the space between the chars. Funny thing is I realised this just after I wrote this post. Thanks :)

3
Support / Re: Issue when using font , shows a strange border around font
« on: December 22, 2014, 06:33:58 pm »
I have the same problem but it’s not the texture override. My font have been scaled so maybe that’s why?

4
Support / Re: How to get pixel width of textmesh
« on: December 17, 2014, 02:28:56 pm »
That took care of the sliced sprite issue. I multiplied x by 1.5f because it was a bit too tight.
But that sorta worked before. The real problem is how I place them next to each other.
It's in BuildSentence.cs in the function BuildWordInMesh.

Again thank for all your help. Best support ever when this is working please allow me to send you a present ;)

Regards

Odin

5
Support / Re: How to get pixel width of textmesh
« on: December 17, 2014, 07:24:17 am »
Thanks. Can you perhaps show me in the repo case? Even though I apply the scale they are still not moved far enough and I can't see a pattern in how. It's not like it's always half their size they're moved (because the are centered). It's really weird.
Thanks a lot for your kind help so far ;)

/Odin

6
Support / Re: How to get pixel width of textmesh
« on: December 16, 2014, 06:14:06 pm »
Here is an example. Toolkit.cs adds the border. BuildSentence tries to place each word in a string after the other :)

Thanks in advance

Odin

7
Support / Re: How to get pixel width of textmesh
« on: December 16, 2014, 03:42:32 pm »
Haha yeah. You wouldn't think I've been programming for 25 years ;)
Maybe I don't understand the sliced sprite. Should it be border size (2 pixels) and just 1 pixel in the middle. Or can it be any size anf then adjusted somewhere? Because right now my sliced sprite is 100x100. Will this throw it off? And do I need to specify it somewhere?

Best regards

Odin

8
Support / Re: How to get pixel width of textmesh
« on: December 14, 2014, 09:08:59 pm »
Pixels per meter is 1 in the sprite collection.
My sliced sprite is 100x100 with 2 pixel border. I have a hard time adding the background and getting the size.

As you can see from below code I kinda hacked it to work, but of course now I need to add boxes exactly after each other and this fails.

If at all you have the time, I would appreciate some pointers. Main issue is probably if the sliced sprite is 100x100 with a 2 pixel border how do I make it fit the size of my text mesh?

Thanks in advance

Odin

Code: [Select]
public static void AddBackground(GameObject textObject)
{
// Instantiate object
GameObject instance = Instantiate(Resources.Load("Borderback", typeof(GameObject))) as GameObject;

// Get camera
Camera cam = tk2dCamera.Instance.camera;
instance.transform.position = textObject.transform.position;
instance.transform.position = new Vector3 (instance.transform.position.x-10, instance.transform.position.y-6, 1);
instance.transform.parent = textObject.transform;
Bounds extends = textObject.GetComponent<tk2dTextMesh>().GetEstimatedMeshBoundsForString(textObject.GetComponent<tk2dTextMesh>().text);
Vector2 oldDims = instance.GetComponent<tk2dSlicedSprite> ().dimensions;
//Debug.Log (oldDims.x);
float extendsWidth = (extends.extents.x);
Debug.Log (extendsWidth);
float mulFac = 1.0f;
if (textObject.GetComponent<tk2dTextMesh>().text.Length < 3)
{
instance.transform.position = new Vector3 (instance.transform.position.x-12, instance.transform.position.y, 1);
mulFac = 1.5f;
}
instance.GetComponent<tk2dSlicedSprite> ().dimensions = new Vector2 ((73 * (extendsWidth / oldDims.x)+10)*mulFac , extends.extents.y*1.5f);
}

9
Support / Re: How to get pixel width of textmesh
« on: December 14, 2014, 04:02:13 pm »
Ahh that's probably it. Where do I find pixels per world unit?

Thanks in advance
Odin

10
Support / Re: How to get pixel width of textmesh
« on: December 12, 2014, 04:50:01 pm »
Basically I'm just asking for the best way to add a background and a border to at text mesh :)

11
Support / Re: How to get pixel width of textmesh
« on: December 12, 2014, 04:43:56 pm »
Also. I have a 2 pixel border but it disappears at certain scales. Is it too small?

12
Support / How to get pixel width of textmesh
« on: December 12, 2014, 04:14:10 pm »
Hi. I tried the GetEstimatedMeshBoundsForString, but it's not really working for me.
I want to add a scaled sliced sprite as a border for the text, so I need to scale it up by the size of the text mesh.
But so far no luck :)

Thanks in advance

Odin Jensen

13
Support / Can't edit 2D box collider on 2D toolkit sprites
« on: December 10, 2014, 07:34:02 am »
Hi. I have this problem that I want to have multiple box colliders to drag other sprites to their specific areas within another sprite.
But when I click edit box collider I can't edit it, like on regular Unity2D sprites.
Is this possible? Or is there a workaround?

Thanks in advance

Odin Jensen

14
Support / Re: Is it possible to detect sub-word inside textmesh on touch?
« on: December 10, 2014, 07:32:03 am »
I just split it up and added a TextMesh for each with a 2D box collider. That worked fine. But your suggestions are cool as well thanks :)

15
Support / Is it possible to detect sub-word inside textmesh on touch?
« on: December 09, 2014, 10:07:59 am »
Well. Header says it all. I need to split a sentence in words and have each word be "touchable".
I could do it in code, dynamically creating textmesh'es, but I was wondering if there is an easy way to do this?

Thanks in advance

Odin

Pages: [1]