internal void CreateDrawHelper() { // World to NDC transform float height; height = (DrawViewHeight / DrawViewWidth) * RequestedWorldWidth; Vector2 min, max; min = new Vector2(RequestedWorldMin.X, RequestedWorldMin.Y); max = new Vector2((min.X + RequestedWorldWidth), (min.Y + height)); Vector2 size = max - min; Vector2 center = min + (size * 0.5f); m_WorldBound.Center = center; m_WorldBound.Width = size.X; m_WorldBound.Height = size.Y; if (null == m_DrawHelper) { m_DrawHelper = new XNACS1LibDrawHelper(m_GraphicsManager.GraphicsDevice, Content, m_WorldBound, m_FontManager, new Vector2(XNACS1_AppWindowWidth, XNACS1_AppWindowHeight)); XNACS1Primitive.SetDrawHelper(m_DrawHelper); } else { // update the transformation matrices m_DrawHelper.SetTransformationMatrices(m_WorldBound, new Vector2(XNACS1_AppWindowWidth, XNACS1_AppWindowHeight)); } }
public FontManager(GraphicsDevice graphicsDevice, Microsoft.Xna.Framework.Content.ContentManager content, int appWinHeight) { m_LabelColor = Color.Red; m_TopEchoColor = Color.Black; m_BottomEchoColor = Color.Black; ComputeFontPositions(appWinHeight); m_LabelFont = null; m_EchoFont = null; m_DrawHelper = null; const String path1 = @"Resources/Fonts/Arial"; const String path2 = @"Content/Resources/Fonts/Arial"; String usePath = null; #if WINDOWS_PHONE usePath = path2; #else if (File.Exists(string.Concat(path1, ".xnb"))) usePath = path1; else if (File.Exists(string.Concat(path2, ".xnb"))) usePath = path2; #endif if (null!=usePath) { m_LabelFont = content.Load<SpriteFont>(usePath); m_EchoFont = content.Load<SpriteFont>(usePath); Vector2 spaceSize = m_EchoFont.MeasureString(" "); m_SpaceFillerWidth = spaceSize.X; } }
public FontManager(GraphicsDevice graphicsDevice, Microsoft.Xna.Framework.Content.ContentManager content, int appWinHeight) { mContentManager = content; m_LabelColor = Color.Red; m_TopEchoColor = Color.Black; m_BottomEchoColor = Color.Black; ComputeFontPositions(appWinHeight); m_DefaultFont = null; m_DrawHelper = null; const String path1 = @"Resources/Fonts/"; const String path2 = @"Content/Resources/Fonts/"; #if WINDOWS_PHONE mUsePath = path2; #else if (File.Exists(string.Concat(path1, kDefaultFont, ".xnb"))) { mUsePath = path1; } else if (File.Exists(string.Concat(path2, kDefaultFont, ".xnb"))) { mUsePath = path2; } #endif if (null != mUsePath) { String usePath = string.Concat(mUsePath, kDefaultFont); m_DefaultFont = LoadFont(kDefaultFont); } }
internal static void Draw(XNACS1Primitive p, XNACS1LibDrawHelper dh) { OBB2D a = new OBB2D(p); dh.DrawLineSegments(a.m_Corner[0], a.m_Corner[1]); dh.DrawLineSegments(a.m_Corner[1], a.m_Corner[2]); dh.DrawLineSegments(a.m_Corner[2], a.m_Corner[3]); dh.DrawLineSegments(a.m_Corner[3], a.m_Corner[0]); }
internal static void SetDrawHelper(XNACS1LibDrawHelper h) { sm_DrawHelper = h; }
public void SetDrawHelper(XNACS1LibDrawHelper d) { m_DrawHelper = d; }