diff -r 0000000000000000000000000000000000000000 -r 3f237427b92697cdb5993e2c227695d7d2c18cdc Speech Bubble Sample.sln --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Speech Bubble Sample.sln Sun May 20 21:14:33 2012 -0500 @@ -0,0 +1,24 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speech Bubble Sample", "Speech Bubble Sample\Speech Bubble Sample\Speech Bubble Sample.csproj", "{2EC2FBBF-180A-44BE-B435-8EC6D3603FAC}" +EndProject +Project("{96E2B04D-8817-42C6-938A-82C39BA4D311}") = "Speech Bubble SampleContent", "Speech Bubble Sample\Speech Bubble SampleContent\Speech Bubble SampleContent.contentproj", "{42EFDDF3-9584-47B1-ADDC-A7E721C912FD}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x86 = Debug|x86 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2EC2FBBF-180A-44BE-B435-8EC6D3603FAC}.Debug|x86.ActiveCfg = Debug|x86 + {2EC2FBBF-180A-44BE-B435-8EC6D3603FAC}.Debug|x86.Build.0 = Debug|x86 + {2EC2FBBF-180A-44BE-B435-8EC6D3603FAC}.Release|x86.ActiveCfg = Release|x86 + {2EC2FBBF-180A-44BE-B435-8EC6D3603FAC}.Release|x86.Build.0 = Release|x86 + {42EFDDF3-9584-47B1-ADDC-A7E721C912FD}.Debug|x86.ActiveCfg = Debug|x86 + {42EFDDF3-9584-47B1-ADDC-A7E721C912FD}.Release|x86.ActiveCfg = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff -r 0000000000000000000000000000000000000000 -r 3f237427b92697cdb5993e2c227695d7d2c18cdc Speech Bubble Sample/Speech Bubble Sample/Game.ico Binary file Speech Bubble Sample/Speech Bubble Sample/Game.ico has changed diff -r 0000000000000000000000000000000000000000 -r 3f237427b92697cdb5993e2c227695d7d2c18cdc Speech Bubble Sample/Speech Bubble Sample/Game1.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Speech Bubble Sample/Speech Bubble Sample/Game1.cs Sun May 20 21:14:33 2012 -0500 @@ -0,0 +1,107 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Audio; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.GamerServices; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; +using Microsoft.Xna.Framework.Media; + +namespace Speech_Bubble_Sample +{ + /// + /// This is the main type for your game + /// + public class Game1 : Microsoft.Xna.Framework.Game + { + GraphicsDeviceManager graphics; + SpriteBatch spriteBatch; + + SpeechBubble _bubble1; + SpeechBubble _bubble2; + SpeechBubble _bubble3; + + public Game1() + { + graphics = new GraphicsDeviceManager(this); + Content.RootDirectory = "Content"; + + graphics.PreferredBackBufferWidth = 1024; + graphics.PreferredBackBufferHeight = 768; + + } + + /// + /// Allows the game to perform any initialization it needs to before starting to run. + /// This is where it can query for any required services and load any non-graphic + /// related content. Calling base.Initialize will enumerate through any components + /// and initialize them as well. + /// + protected override void Initialize() + { + // TODO: Add your initialization logic here + + base.Initialize(); + } + + /// + /// LoadContent will be called once per game and is the place to load + /// all of your content. + /// + protected override void LoadContent() + { + // Create a new SpriteBatch, which can be used to draw textures. + spriteBatch = new SpriteBatch(GraphicsDevice); + + _bubble1 = new SpeechBubble(Content, 150, new Vector2(50, 50), new string[] { "This is a test", "This is only a test", "More text follows..." }, true); + _bubble2 = new SpeechBubble(Content, 150, new Vector2(250, 250), new string[] { "This is a test", "This is only a test", "Nothing here" },false, PointerType.Left); + _bubble3 = new SpeechBubble(Content, 150, new Vector2(150, 450), new string[] { "Another test", "Still testing", "More follows..." }, true, PointerType.Right); + + } + + /// + /// UnloadContent will be called once per game and is the place to unload + /// all content. + /// + protected override void UnloadContent() + { + // TODO: Unload any non ContentManager content here + } + + /// + /// Allows the game to run logic such as updating the world, + /// checking for collisions, gathering input, and playing audio. + /// + /// Provides a snapshot of timing values. + protected override void Update(GameTime gameTime) + { + // Allows the game to exit + if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) + this.Exit(); + + Console.WriteLine(gameTime.ElapsedGameTime.TotalMilliseconds.ToString()); + + + base.Update(gameTime); + } + + /// + /// This is called when the game should draw itself. + /// + /// Provides a snapshot of timing values. + protected override void Draw(GameTime gameTime) + { + GraphicsDevice.Clear(Color.CornflowerBlue); + + spriteBatch.Begin(); + _bubble1.Draw(spriteBatch); + _bubble2.Draw(spriteBatch); + _bubble3.Draw(spriteBatch); + spriteBatch.End(); + + base.Draw(gameTime); + } + } +} diff -r 0000000000000000000000000000000000000000 -r 3f237427b92697cdb5993e2c227695d7d2c18cdc Speech Bubble Sample/Speech Bubble Sample/GameThumbnail.png Binary file Speech Bubble Sample/Speech Bubble Sample/GameThumbnail.png has changed diff -r 0000000000000000000000000000000000000000 -r 3f237427b92697cdb5993e2c227695d7d2c18cdc Speech Bubble Sample/Speech Bubble Sample/Program.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Speech Bubble Sample/Speech Bubble Sample/Program.cs Sun May 20 21:14:33 2012 -0500 @@ -0,0 +1,21 @@ +using System; + +namespace Speech_Bubble_Sample +{ +#if WINDOWS || XBOX + static class Program + { + /// + /// The main entry point for the application. + /// + static void Main(string[] args) + { + using (Game1 game = new Game1()) + { + game.Run(); + } + } + } +#endif +} + diff -r 0000000000000000000000000000000000000000 -r 3f237427b92697cdb5993e2c227695d7d2c18cdc Speech Bubble Sample/Speech Bubble Sample/Properties/AssemblyInfo.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Speech Bubble Sample/Speech Bubble Sample/Properties/AssemblyInfo.cs Sun May 20 21:14:33 2012 -0500 @@ -0,0 +1,34 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Speech Bubble Sample")] +[assembly: AssemblyProduct("Speech Bubble Sample")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2012")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. Only Windows +// assemblies support COM. +[assembly: ComVisible(false)] + +// On Windows, the following GUID is for the ID of the typelib if this +// project is exposed to COM. On other platforms, it unique identifies the +// title storage container when deploying this assembly to the device. +[assembly: Guid("b3a59db5-7dff-4350-a7f9-5a5640a5b12e")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("1.0.0.0")] \ No newline at end of file diff -r 0000000000000000000000000000000000000000 -r 3f237427b92697cdb5993e2c227695d7d2c18cdc Speech Bubble Sample/Speech Bubble Sample/Speech Bubble Sample.csproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Speech Bubble Sample/Speech Bubble Sample/Speech Bubble Sample.csproj Sun May 20 21:14:33 2012 -0500 @@ -0,0 +1,129 @@ + + + + {2EC2FBBF-180A-44BE-B435-8EC6D3603FAC} + {6D335F3A-9D43-41b4-9D22-F6F17C4BE596};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Debug + x86 + WinExe + Properties + Speech_Bubble_Sample + Speech Bubble Sample + v4.0 + Client + v4.0 + Windows + Reach + d78511a3-e053-45c3-a5cb-b0a85c48d76c + Game + Game.ico + GameThumbnail.png + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + + + true + full + false + bin\x86\Debug + DEBUG;TRACE;WINDOWS + prompt + 4 + true + false + x86 + false + + + pdbonly + true + bin\x86\Release + TRACE;WINDOWS + prompt + 4 + true + false + x86 + true + + + + + + + + + + + + + + + + + + + + + + + true + + + + + Speech_Bubble_SampleContent + Content + + + + + False + Microsoft .NET Framework 4 Client Profile %28x86 and x64%29 + true + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 3.5 SP1 + false + + + False + Windows Installer 3.1 + true + + + False + Microsoft XNA Framework Redistributable 4.0 + true + + + + + + \ No newline at end of file diff -r 0000000000000000000000000000000000000000 -r 3f237427b92697cdb5993e2c227695d7d2c18cdc Speech Bubble Sample/Speech Bubble Sample/SpeechBubble.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Speech Bubble Sample/Speech Bubble Sample/SpeechBubble.cs Sun May 20 21:14:33 2012 -0500 @@ -0,0 +1,144 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Audio; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; + +namespace Speech_Bubble_Sample +{ + public enum PointerType + { + None, + Left, + Right + } + + public class SpeechBubble + { + private int _width; + + private Vector2 _location; + + private string[] _text; + + private SpriteFont _font; + + //bubble textures + private Texture2D _bottomBorder; + private Texture2D _interior; + private Texture2D _leftBorder; + private Texture2D _leftBottomCorner; + private Texture2D _leftTopCorner; + private Texture2D _rightBorder; + private Texture2D _rightBottomCorner; + private Texture2D _rightTopCorner; + private Texture2D _topBorder; + + private bool _more; + private Texture2D _moreGraphic; + + private PointerType _pointerType; + private Texture2D _pointer; + + public SpeechBubble(ContentManager content, int width, Vector2 location, string[] text, bool more = false, PointerType pointerType = PointerType.None) + { + _font = content.Load("font"); + + _bottomBorder = content.Load("bottomBorder"); + _interior = content.Load("interior"); + _leftBorder = content.Load("leftBorder"); + _leftBottomCorner = content.Load("leftBottomCorner"); + _leftTopCorner = content.Load("leftTopCorner"); + _rightBorder = content.Load("rightBorder"); + _rightBottomCorner = content.Load("rightBottomCorner"); + _rightTopCorner = content.Load("rightTopCorner"); + _topBorder = content.Load("topBorder"); + + _moreGraphic = content.Load("more"); + + _pointer = content.Load("pointer"); + + _location = location; + _width = width; + + _text = text; + + _more = more; + + _pointerType = pointerType; + } + + public void Draw(SpriteBatch sb) + { + //top + sb.Draw(_leftTopCorner, _location, Color.White); + sb.Draw(_topBorder, new Rectangle((int)_location.X + _leftTopCorner.Width, (int)_location.Y, _width - _leftTopCorner.Width * 2, _leftTopCorner.Height), Color.White); + sb.Draw(_rightTopCorner, _location + new Vector2(_width - _rightTopCorner.Width, 0), Color.White); + + //lines + for (int i = 0; i < _text.Length + (_more ? 1 : 0); i++) + { + sb.Draw(_leftBorder, new Vector2(_location.X, _location.Y + _leftTopCorner.Height + (i * _leftBorder.Height)), Color.White); + sb.Draw(_interior, new Rectangle((int)_location.X + _leftBorder.Width, + (int)_location.Y + _leftTopCorner.Height + (i * _leftBorder.Height), + _width - _leftBorder.Width * 2, + _leftBorder.Height), + Color.White); + sb.Draw(_rightBorder, new Vector2(_location.X + _width - _rightBorder.Width, _location.Y + _leftTopCorner.Height + (i * _leftBorder.Height)), Color.White); + + //leave space for more graphic if necessary + if (i < _text.Length) + sb.DrawString(_font, _text[i], new Vector2((int)_location.X + _leftBorder.Width, (int)_location.Y + _leftTopCorner.Height + (i * _leftBorder.Height)), Color.Black); + } + + + //bottom + sb.Draw(_leftBottomCorner, _location + new Vector2(0, _leftTopCorner.Height + (_text.Length + (_more ? 1 : 0)) * _leftBorder.Height), Color.White); + + switch(_pointerType) + { + case PointerType.Left: + { + sb.Draw(_pointer, _location + new Vector2(_leftBottomCorner.Width, _leftTopCorner.Height + (_text.Length + (_more ? 1 : 0)) * _leftBorder.Height), Color.White); + + sb.Draw(_bottomBorder, new Rectangle((int)_location.X + _leftBorder.Width + _pointer.Width, + (int)_location.Y + _leftTopCorner.Height + (_text.Length + (_more ? 1 : 0)) * _leftBorder.Height, + _width - _leftBorder.Width - _pointer.Width - _rightBorder.Width, + _bottomBorder.Height), + Color.White); + + break; + } + case PointerType.Right: + { + sb.Draw(_bottomBorder, new Rectangle((int)_location.X + _leftBorder.Width, + (int)_location.Y + _leftTopCorner.Height + (_text.Length + (_more ? 1 : 0)) * _leftBorder.Height, + _width - _leftBorder.Width - _pointer.Width - _rightBorder.Width, + _bottomBorder.Height), + Color.White); + + sb.Draw(_pointer, _location + new Vector2(_width - _pointer.Width - _rightBorder.Width, _leftTopCorner.Height + (_text.Length + (_more ? 1 : 0)) * _leftBorder.Height), Color.White); + + break; + } + case PointerType.None: + { + sb.Draw(_bottomBorder, new Rectangle((int)_location.X + _leftBorder.Width, + (int)_location.Y + _leftTopCorner.Height + (_text.Length + (_more ? 1 : 0)) * _leftBorder.Height, + _width - _leftBorder.Width - _rightBorder.Width, + _bottomBorder.Height), + Color.White); + + break; + } + } + + sb.Draw(_rightBottomCorner, _location + new Vector2(_width - _rightBottomCorner.Width, _leftTopCorner.Height + (_text.Length + (_more ? 1 : 0)) * _leftBorder.Height), Color.White); + + if (_more) + sb.Draw(_moreGraphic, new Vector2(_location.X + _width - _rightBorder.Width - _moreGraphic.Width, _location.Y + _leftTopCorner.Height + (_text.Length * _leftBorder.Height)), Color.White); + } + } +} diff -r 0000000000000000000000000000000000000000 -r 3f237427b92697cdb5993e2c227695d7d2c18cdc Speech Bubble Sample/Speech Bubble SampleContent/Speech Bubble SampleContent.contentproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Speech Bubble Sample/Speech Bubble SampleContent/Speech Bubble SampleContent.contentproj Sun May 20 21:14:33 2012 -0500 @@ -0,0 +1,108 @@ + + + + {42EFDDF3-9584-47B1-ADDC-A7E721C912FD} + {96E2B04D-8817-42c6-938A-82C39BA4D311};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Debug + x86 + Library + Properties + v4.0 + v4.0 + bin\$(Platform)\$(Configuration) + Content + + + x86 + + + x86 + + + Speech_Bubble_SampleContent + + + + + + + + + + + + bottomborder + TextureImporter + TextureProcessor + + + interior + TextureImporter + TextureProcessor + + + leftborder + TextureImporter + TextureProcessor + + + leftbottomcorner + TextureImporter + TextureProcessor + + + lefttopcorner + TextureImporter + TextureProcessor + + + rightborder + TextureImporter + TextureProcessor + + + rightbottomcorner + TextureImporter + TextureProcessor + + + righttopcorner + TextureImporter + TextureProcessor + + + topborder + TextureImporter + TextureProcessor + + + + + font + FontDescriptionImporter + FontDescriptionProcessor + + + + + more + TextureImporter + TextureProcessor + + + + + pointer + TextureImporter + TextureProcessor + + + + + \ No newline at end of file diff -r 0000000000000000000000000000000000000000 -r 3f237427b92697cdb5993e2c227695d7d2c18cdc Speech Bubble Sample/Speech Bubble SampleContent/bottomborder.png Binary file Speech Bubble Sample/Speech Bubble SampleContent/bottomborder.png has changed diff -r 0000000000000000000000000000000000000000 -r 3f237427b92697cdb5993e2c227695d7d2c18cdc Speech Bubble Sample/Speech Bubble SampleContent/font.spritefont --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Speech Bubble Sample/Speech Bubble SampleContent/font.spritefont Sun May 20 21:14:33 2012 -0500 @@ -0,0 +1,60 @@ + + + + + + + Segoe UI Mono + + + 8 + + + 0 + + + true + + + + + + + + + + + + ~ + + + + diff -r 0000000000000000000000000000000000000000 -r 3f237427b92697cdb5993e2c227695d7d2c18cdc Speech Bubble Sample/Speech Bubble SampleContent/interior.png Binary file Speech Bubble Sample/Speech Bubble SampleContent/interior.png has changed diff -r 0000000000000000000000000000000000000000 -r 3f237427b92697cdb5993e2c227695d7d2c18cdc Speech Bubble Sample/Speech Bubble SampleContent/leftborder.png Binary file Speech Bubble Sample/Speech Bubble SampleContent/leftborder.png has changed diff -r 0000000000000000000000000000000000000000 -r 3f237427b92697cdb5993e2c227695d7d2c18cdc Speech Bubble Sample/Speech Bubble SampleContent/leftbottomcorner.png Binary file Speech Bubble Sample/Speech Bubble SampleContent/leftbottomcorner.png has changed diff -r 0000000000000000000000000000000000000000 -r 3f237427b92697cdb5993e2c227695d7d2c18cdc Speech Bubble Sample/Speech Bubble SampleContent/lefttopcorner.png Binary file Speech Bubble Sample/Speech Bubble SampleContent/lefttopcorner.png has changed diff -r 0000000000000000000000000000000000000000 -r 3f237427b92697cdb5993e2c227695d7d2c18cdc Speech Bubble Sample/Speech Bubble SampleContent/more.png Binary file Speech Bubble Sample/Speech Bubble SampleContent/more.png has changed diff -r 0000000000000000000000000000000000000000 -r 3f237427b92697cdb5993e2c227695d7d2c18cdc Speech Bubble Sample/Speech Bubble SampleContent/pointer.png Binary file Speech Bubble Sample/Speech Bubble SampleContent/pointer.png has changed diff -r 0000000000000000000000000000000000000000 -r 3f237427b92697cdb5993e2c227695d7d2c18cdc Speech Bubble Sample/Speech Bubble SampleContent/rightborder.png Binary file Speech Bubble Sample/Speech Bubble SampleContent/rightborder.png has changed diff -r 0000000000000000000000000000000000000000 -r 3f237427b92697cdb5993e2c227695d7d2c18cdc Speech Bubble Sample/Speech Bubble SampleContent/rightbottomcorner.png Binary file Speech Bubble Sample/Speech Bubble SampleContent/rightbottomcorner.png has changed diff -r 0000000000000000000000000000000000000000 -r 3f237427b92697cdb5993e2c227695d7d2c18cdc Speech Bubble Sample/Speech Bubble SampleContent/righttopcorner.png Binary file Speech Bubble Sample/Speech Bubble SampleContent/righttopcorner.png has changed diff -r 0000000000000000000000000000000000000000 -r 3f237427b92697cdb5993e2c227695d7d2c18cdc Speech Bubble Sample/Speech Bubble SampleContent/topborder.png Binary file Speech Bubble Sample/Speech Bubble SampleContent/topborder.png has changed