public GamePage() { InitializeComponent(); m_this = this; PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled; Loaded += new RoutedEventHandler(Page_Loaded); // Get the content manager from the application contentManager = (Application.Current as App).Content; filledPathPolygons[0] = new VertexPositionColor[55000]; filledPathPolygons[1] = new VertexPositionColor[55000]; textStrings[0] = new TextString[2000]; textStrings[1] = new TextString[2000]; bitmaps[0] = new Texture2D[2000]; bitmaps[1] = new Texture2D[2000]; // Create a timer for this page timer = new GameTimer(); timer.UpdateInterval = TimeSpan.FromTicks(333333); timer.Update += OnUpdate; timer.Draw += OnDraw; // Use the LayoutUpdate event to know when the page layout has completed so we can // create the UIElementRenderer LayoutUpdated += new EventHandler(XNARendering_LayoutUpdated); }
public static void NOPH_Graphics_drawTextAngle(int c_graphics, int c_text, int x, int y, int flags, int angle) { try { int font_size = currFontSize - 5; String text = NBidi.NBidi.LogicalToVisual(CRunTime.charPtrToString(c_text)).Replace(illegalChar1, ' ').Replace(illegalChar2, ' '); Microsoft.Xna.Framework.Color color = Microsoft.Xna.Framework.Color.FromNonPremultiplied(curr_color.R, curr_color.G, curr_color.B, curr_color.A); GamePage gamePage = GamePage.get(); TextString textString = new TextString(text, font_size, x, y, angle, color); gamePage.textStrings[gamePage.whichPolygonAndTextAndBitmapArrayIsInWork][gamePage.textStringWorkIndex++] = textString; } catch (Exception) { // ignore exception for not stopping the map from beging drawn } return; //// mre.Reset(); //int copy_c_text, copy_x, copy_y, copy_flags, copy_angle; //copy_c_text = c_text; copy_x = x; copy_y = y; copy_flags = flags; copy_angle = angle; //System.Windows.Media.Color curr_pen = curr_color; ////todomt2 - what about flags? //System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() => //{ // if (copy_angle == 0) // { // TextBlock tb = new TextBlock(); // tb.FontFamily = new FontFamily("FreeSans"); // tb.FontSize = font_size; // tb.FontStyle = FontStyles.Normal; // tb.Foreground = new SolidColorBrush(curr_pen); // // Align to Right // tb.FlowDirection = FlowDirection.RightToLeft; // tb.Text = text; // //Logger.log("Draw Text: " + text); // // Fix location of upper notification. for some reason the C code is sending x values that are outside the canvas... // if (copy_y == 67) // { // copy_x -= 32; // } // // Fix location of the steet name. for some reason the C code is sending x values that are outside the canvas... // if ( // ((copy_y == 472) && GamePage.get().IsPhoneLandscape()) || // ((copy_y == 792) && !GamePage.get().IsPhoneLandscape()) // ) // { // copy_x -= 37; // } // // End fix // tb.SetValue(Canvas.LeftProperty, (double)(copy_x + tb.ActualWidth)); // tb.SetValue(Canvas.TopProperty, (double)(copy_y - tb.ActualHeight + 5 )); // next_canvas.Children.Add(tb); // } // else // { // TextBlock tb = new TextBlock(); // tb.FontFamily = new FontFamily("FreeSans"); // tb.FontSize = font_size; // tb.FontStyle = FontStyles.Normal; // tb.Foreground = new SolidColorBrush(curr_pen); // tb.SetValue(Canvas.LeftProperty, (double)(copy_x));// - (tb.ActualWidth / 2))); // tb.SetValue(Canvas.TopProperty, (double)(copy_y - tb.ActualHeight - 20.0)); // tb.Text = text; // RotateTransform rt = new RotateTransform(); // rt.Angle = copy_angle; // tb.RenderTransform = rt; // next_canvas.Children.Add(tb); // } // //mre.Set(); //}); ////mre.WaitOne(); }