Skip to content
This repository has been archived by the owner on Mar 11, 2021. It is now read-only.

Commit

Permalink
Merge branch 'master' of https://github.com/mono/CocosSharp into text…
Browse files Browse the repository at this point in the history
…field
  • Loading branch information
kjpou1 committed Aug 7, 2015
2 parents 2edf434 + 9cee316 commit 0b23e1f
Show file tree
Hide file tree
Showing 67 changed files with 772 additions and 110 deletions.
2 changes: 1 addition & 1 deletion MonoGame
3 changes: 3 additions & 0 deletions TestWin8Phone/TestWin8Phone.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,9 @@
<Compile Include="..\tests\tests\classes\tests\LabelTestNew\LabelFNTUNICODELanguages.cs">
<Link>classes\tests\LabelTestNew\LabelFNTUNICODELanguages.cs</Link>
</Compile>
<Compile Include="..\tests\tests\classes\tests\LabelTestNew\LabelFSTextureView.cs">
<Link>classes\tests\LabelTestNew\LabelFSTextureView.cs</Link>
</Compile>
<Compile Include="..\tests\tests\classes\tests\LabelTestNew\LabelSFAlignmentTest.cs">
<Link>classes\tests\LabelTestNew\LabelSFAlignmentTest.cs</Link>
</Compile>
Expand Down
4 changes: 4 additions & 0 deletions src/CocosSharp.iOS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<MtouchLink>None</MtouchLink>
<MtouchDebug>True</MtouchDebug>
<MtouchUseArmv7>false</MtouchUseArmv7>
<NoWarn>1591</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<DebugType>none</DebugType>
Expand All @@ -39,6 +40,7 @@
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<DefineConstants>IPHONE;IOS;GLES;OPENGL;MONOGAME</DefineConstants>
<MtouchUseArmv7>false</MtouchUseArmv7>
<NoWarn>1591</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
<DebugSymbols>True</DebugSymbols>
Expand All @@ -53,6 +55,7 @@
<MtouchDebug>True</MtouchDebug>
<MtouchUseArmv7>false</MtouchUseArmv7>
<DocumentationFile>bin\iPhone\Debug\CocosSharp.XML</DocumentationFile>
<NoWarn>1591</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<DebugType>none</DebugType>
Expand All @@ -64,6 +67,7 @@
<DefineConstants>IPHONE;IOS;GLES;OPENGL;MONOGAME</DefineConstants>
<MtouchUseArmv7>false</MtouchUseArmv7>
<DocumentationFile>bin\iPhone\Release\CocosSharp.XML</DocumentationFile>
<NoWarn>1591</NoWarn>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
Expand Down
9 changes: 8 additions & 1 deletion src/sprite_nodes/CCSprite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,14 @@ protected internal CCSize UntrimmedSizeInPixels
return untrimmedSizeInPixels;
}

set { untrimmedSizeInPixels = value; }
set
{
if (untrimmedSizeInPixels != value)
{
untrimmedSizeInPixels = value;
texQuadDirty = true;
}
}
}

protected internal CCV3F_C4B_T2F_Quad Quad
Expand Down
3 changes: 3 additions & 0 deletions testWin8Store/TestWin8Store.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,9 @@
<Compile Include="..\tests\tests\classes\tests\LabelTestNew\LabelFNTUNICODELanguages.cs">
<Link>classes\tests\LabelTestNew\LabelFNTUNICODELanguages.cs</Link>
</Compile>
<Compile Include="..\tests\tests\classes\tests\LabelTestNew\LabelFSTextureView.cs">
<Link>classes\tests\LabelTestNew\LabelFSTextureView.cs</Link>
</Compile>
<Compile Include="..\tests\tests\classes\tests\LabelTestNew\LabelSFAlignmentTest.cs">
<Link>classes\tests\LabelTestNew\LabelSFAlignmentTest.cs</Link>
</Compile>
Expand Down
Binary file modified tests/iOSContent/Content/fonts/A Damn Mess-26.xnb
Binary file not shown.
Binary file modified tests/iOSContent/Content/fonts/Abberancy-26.xnb
Binary file not shown.
Binary file modified tests/iOSContent/Content/fonts/Abduction-26.xnb
Binary file not shown.
Binary file modified tests/iOSContent/Content/fonts/Arial.xnb
Binary file not shown.
Binary file modified tests/iOSContent/Content/fonts/MarkerFelt-16.xnb
Binary file not shown.
Binary file modified tests/iOSContent/Content/fonts/MarkerFelt-18.xnb
Binary file not shown.
Binary file modified tests/iOSContent/Content/fonts/MarkerFelt-22.xnb
Binary file not shown.
Binary file modified tests/iOSContent/Content/fonts/MarkerFelt-32.xnb
Binary file not shown.
Binary file modified tests/iOSContent/Content/fonts/MarkerFelt-Thin-12.xnb
Binary file not shown.
Binary file modified tests/iOSContent/Content/fonts/MarkerFelt-Thin-18.xnb
Binary file not shown.
Binary file modified tests/iOSContent/Content/fonts/Paint Boy-26.xnb
Binary file not shown.
Binary file modified tests/iOSContent/Content/fonts/Schwarzwald Regular-26.xnb
Binary file not shown.
Binary file modified tests/iOSContent/Content/fonts/Scissor Cuts-26.xnb
Binary file not shown.
Binary file modified tests/iOSContent/Content/fonts/arial-12.xnb
Binary file not shown.
Binary file modified tests/iOSContent/Content/fonts/arial-16.xnb
Binary file not shown.
Binary file modified tests/iOSContent/Content/fonts/arial-18.xnb
Binary file not shown.
Binary file modified tests/iOSContent/Content/fonts/arial-20.xnb
Binary file not shown.
Binary file modified tests/iOSContent/Content/fonts/arial-22.xnb
Binary file not shown.
Binary file modified tests/iOSContent/Content/fonts/arial-24.xnb
Binary file not shown.
Binary file not shown.
Binary file modified tests/iOSContent/Content/fonts/arial-26.xnb
Binary file not shown.
Binary file modified tests/iOSContent/Content/fonts/arial-28.xnb
Binary file not shown.
Binary file modified tests/iOSContent/Content/fonts/arial-30.xnb
Binary file not shown.
Binary file modified tests/iOSContent/Content/fonts/arial-32.xnb
Binary file not shown.
Binary file modified tests/iOSContent/Content/fonts/arial-34.xnb
Binary file not shown.
Binary file modified tests/iOSContent/Content/fonts/arial-38.xnb
Binary file not shown.
Binary file modified tests/iOSContent/Content/fonts/arial-50.xnb
Binary file not shown.
Binary file modified tests/iOSContent/Content/fonts/arial-64.xnb
Binary file not shown.
Binary file added tests/iOSContent/Content/fonts/boundsTestFont.xnb
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified tests/iOSContent/Content/fonts/debugfont.xnb
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added tests/tests/Content/fonts/debugcompressed.xnb
Binary file not shown.
Binary file added tests/tests/Content/fonts/debuguncompressed.xnb
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\classes\tests\LabelTestNew\LabelFSTextureView.cs">
<Link>classes\tests\LabelTestNew\LabelFSTextureView.cs</Link>
</Compile>
<Compile Include="..\classes\tests\LabelTestNew\LabelSystemFontColorAndOpacity.cs">
<Link>classes\tests\LabelTestNew\LabelSystemFontColorAndOpacity.cs</Link>
</Compile>
Expand Down
2 changes: 2 additions & 0 deletions tests/tests/classes/tests/LabelTestNew/AtlasTestSceneNew.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,11 @@ public static CCLayer restartAtlasAction()
() => new LabelSFContentSizeRatios(),
() => new LabelSystemFont168(),
() => new LabelSystemFontRenderTexture(),

#if !WINDOWS_PHONE8
() => new LabelFNTFromHTTP(),
#endif
() => new LabelSFTextureView(),
};

public static CCLayer createAtlasLayer(int index)
Expand Down
115 changes: 115 additions & 0 deletions tests/tests/classes/tests/LabelTestNew/LabelFSTextureView.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
using System;
using CocosSharp;

namespace tests
{
public class LabelSFTextureView : AtlasDemoNew
{
CCNode spriteFontNode;

public LabelSFTextureView()
{
Color = new CCColor3B(128, 128, 128);
Opacity = 255;


}

public override void OnEnter ()
{
base.OnEnter ();

var origin = Layer.VisibleBoundsWorldspace.Size;

var label1 = new CCLabel(string.Empty, "debuguncompressed", 0, CCLabelFormat.SpriteFont);

var texture = label1.TextureAtlas != null ? label1.TextureAtlas.Texture : null;

if (texture != null) {
spriteFontNode = new CCSprite (texture);
spriteFontNode.Scale = 2;
}
else
{
spriteFontNode = new CCLabel("Texture can not be loaded", "arial", 24, CCLabelFormat.SpriteFont);
}
//spriteFontNode.Color = CCColor3B.Magenta;
spriteFontNode.Position = origin.Center;


AddChild (spriteFontNode);

var itemUncompressed = new CCMenuItemLabel(new CCLabel("Uncompressed", "fonts/arial", 24, CCLabelFormat.SpriteFont));
var itemCompressed = new CCMenuItemLabel(new CCLabel("Compressed", "fonts/arial", 24, CCLabelFormat.SpriteFont));
itemUncompressed.AnchorPoint = CCPoint.AnchorMiddleLeft;
itemCompressed.AnchorPoint = CCPoint.AnchorMiddleLeft;
var mi1 = new CCMenuItemToggle(OnToggle, itemUncompressed, itemCompressed);
var menu = new CCMenu(mi1);

AddChild(menu);
menu.Position = VisibleBoundsWorldspace.Left();
}

void OnToggle(object sender)
{
var toggle = sender as CCMenuItemToggle;
if (toggle == null)
return;

var origin = Layer.VisibleBoundsWorldspace.Size;
spriteFontNode.RemoveFromParent (true);

switch(toggle.SelectedIndex)
{
case 0:
var label1 = new CCLabel (string.Empty, "debuguncompressed", 0, CCLabelFormat.SpriteFont);

var texture = label1.TextureAtlas != null ? label1.TextureAtlas.Texture : null;

if (texture != null) {
spriteFontNode.RemoveFromParent (true);
spriteFontNode = new CCSprite (texture);
spriteFontNode.Scale = 2;
} else {
spriteFontNode = new CCLabel ("Texture can not be loaded", "arial", 24, CCLabelFormat.SpriteFont);
}
break;
case 1:
label1 = new CCLabel (string.Empty, "debugcompressed", 0, CCLabelFormat.SpriteFont);

texture = label1.TextureAtlas != null ? label1.TextureAtlas.Texture : null;

if (texture != null) {
spriteFontNode.RemoveFromParent (true);
spriteFontNode = new CCSprite (texture);
spriteFontNode.Scale = 2;
} else {
spriteFontNode = new CCLabel ("Texture can not be loaded", "arial", 24, CCLabelFormat.SpriteFont);
}
break;

}

AddChild (spriteFontNode);
//spriteFontNode.Color = CCColor3B.Magenta;
spriteFontNode.Position = origin.Center;


}

public override string Title
{
get {
return "SpriteFont TextureAtlas";
}
}

public override string Subtitle
{
get {
return string.Empty;
}
}
}
}

85 changes: 82 additions & 3 deletions tests/tests/classes/tests/SpriteTest/SpriteSubclass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,10 @@ public override string Subtitle
public SpriteSubclass()
{
CCSpriteFrameCache.SharedSpriteFrameCache.AddSpriteFrames("animations/ghosts.plist");
CCSpriteBatchNode aParent = new CCSpriteBatchNode("animations/ghosts");

// MySprite1
sprite = MySprite1.Create("father.gif");
aParent.AddChild(sprite);
AddChild(aParent);
AddChild(sprite);

// MySprite2
sprite2 = new MySprite2("Images/grossini");
Expand All @@ -86,4 +84,85 @@ public override void OnEnter()

#endregion Setup content
}


public class SpriteUntrimmedSizeInPixels : SpriteTestDemo
{

// Create new CCSprite to access the protected property UntrimmedSizeInPixels
class MySprite3 : CCSprite
{

public MySprite3(string fileName): base(fileName)
{ }

public CCSize UntrimmedSizeInPixels
{
get { return base.UntrimmedSizeInPixels; }
set
{
base.UntrimmedSizeInPixels = value;
}
}
}


MySprite3 sprite3;

#region Properties

public override string Title
{
get { return "Sprite subclass"; }
}

public override string Subtitle
{
get { return "Testing UntrimmedSizeInPixels\ntouch and drag on the screen\nto see sprite resize."; }
}

#endregion Properties


#region Constructors

public SpriteUntrimmedSizeInPixels()
{
// MySprite3
sprite3 = new MySprite3("Images/grossini");
AddChild(sprite3);

// Register Touch Event
var touchListener = new CCEventListenerTouchAllAtOnce();
touchListener.OnTouchesMoved = OnTouchesMoved;

AddEventListener(touchListener);
}

#endregion Constructors


#region Setup content

public override void OnEnter()
{
base.OnEnter();
CCSize windowSize = Layer.VisibleBoundsWorldspace.Size;
sprite3.Position = windowSize.Center;
}

#endregion Setup content

void OnTouchesMoved(List<CCTouch> touches, CCEvent touchEvent)
{
foreach (CCTouch touch in touches)
{
var delta = -touch.Delta;
var newWidth = sprite3.UntrimmedSizeInPixels.Width + delta.X;
var newHeight = sprite3.UntrimmedSizeInPixels.Height + delta.Y;
var newSize = new CCSize(newWidth, newHeight);
sprite3.UntrimmedSizeInPixels = newSize;
}
}
}
}
Loading

0 comments on commit 0b23e1f

Please sign in to comment.