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 - asea19

Pages: [1]
1
Support / Re: Trouble getting sprite dimensions
« on: February 15, 2013, 01:14:36 am »
Thanks!  That fixed it. 

2
Support / Re: Trouble getting sprite dimensions
« on: February 14, 2013, 10:48:46 pm »
Quote
With the tk2dCamera, there is no camera scale applied - it is the camera that is tweaked to get stuff to fit / moved around and so on.

Interesting. When I add a resolution override on the tk2d Camera inspector, it looks like it is scaling all of the sprites.  That is why I assumed this.  Still a bit confused as to what you mean. 

So, regarding the scale in the sprite inspector.  You are right.  It is not 1,1,1.  It is actually .15.  I assume this has to do with how I am loading the sprites.  I am loading them at runtime and used this thread as a guide on how to do that: http://unikronsoftware.com/2dtoolkit/forum/index.php/topic,1058.msg5282.html#msg5282

Could you glance at this and see what I might be doing wrong?  Thanks again. 

Code: [Select]
var gameObj:GameObject;
var tk_spr:tk2dSprite;
var tempTexture:Texture2D;

tempTexture = Resources.Load( "Textures/MENUS/"+spr_str, Texture2D );
var tSize:Rect = new Rect(0, 0, tempTexture.width, tempTexture.height);
var tAnch:Vector2 = new Vector2(0, tempTexture.height);

gameObj = tk2dSprite.CreateFromTexture( tempTexture, tk2dRuntime.SpriteCollectionSize.Explicit( tempTexture.width, tempTexture.height ), tSize, tAnch );
gameObj.name = spr_str.ToString();
gameObj.layer = LayerMask.NameToLayer("MENU");
tk_spr = gameObj.GetComponent(tk2dSprite);   
tk_spr.collection.transform.parent = gameObj.transform;
tk_spr.pixelPerfect = true;
      

BTW, I printed out tempTexture.width and tempTexture.height and they are the accurate pixel dimensions of the incoming texture.

3
Support / Trouble getting sprite dimensions
« on: February 14, 2013, 08:50:22 pm »
Hi, do GetBounds() and GetUntrimmedBounds() return the width and height of a sprite before or after the camera scales things?  Or neither?  I am using the tk2d camera and I have native resolution set to 1136x640 with a resolution override with wdith and height set to -1, Auto Scale set to Fit Visible and Fit Mode set to Center. 

After inspecting the output of these functions on a sprite that is 352 x 107 pixels.  here is what is returned: 'Center: (624.8, 189.9, 0.0), Extents: (624.8, 189.9, 0.0)' .  I am a bit confused!  I see the proportion is about 1.75 of the actual sprite's dimensions.  Is there any significance to this number?  I just need to get the pixel dimensions of the sprite after scaling has occurred so I can position them relatively within the viewport.  Any suggestions?  Thanks!

4
Support / Re: in-game menus and memory management
« on: February 14, 2013, 08:41:07 pm »
Hi, thanks for your suggestion.  I have implemented something like this and so far so good.

5
Support / in-game menus and memory management
« on: February 03, 2013, 11:09:14 pm »
Hi,

I love your software.  I am putting together a menu and GUI with it now and had a question about an approach to creating menus that are easily accessible from the game with little transition time.  I am concerned the impact on memory when having all the 2d assets in the scene(deactivated) during the gameplay.

For example for the player selection screen, it will have a background image(1136X640) and a character portrait(640x640) placed in front of the background, and a few other small buttons and textfields.  There are 8 possible characters.  I would like the user to be able to access this menu fairly quickly from within the game. So, I'm wondering, for memory management purposes on mobile devices, what do you suggest?  Should I place all of the images visually in my scene and activate/deactivate them when needed?  Or, should I place them all in my resources folder and load/unload them when needed.  I have seen the loading/unloading can be pretty ugly on mobile, but I am also concerned about having all these images hanging around in memory in the background while my game is running.  I appreciate the help!

Pages: [1]