public void Properties()
        {
            #region ...

            SPTextField tf = new SPTextField("World");
            tf.Text = "Hello " + tf.Text + "!";
            tf.FontName = "Arial";
            tf.FontSize = 30.0f;
            tf.HorizontalAlignment = SPHorizontalAlignment.Right;
            tf.VerticalAlignment = SPVerticalAlignment.Bottom;
            tf.Border = true;
            tf.Color = SPColor.Fuchsia;
            tf.Kerning = false;
            SPRectangle tb = tf.TextBounds;

            Assert.True(tf.Text == "Hello World!");
            Assert.True(tf.FontName == "Arial");
            Assert.True(tf.FontSize == 30.0f);
            Assert.True(tf.HorizontalAlignment == SPHorizontalAlignment.Right);
            Assert.True(tf.VerticalAlignment == SPVerticalAlignment.Bottom);
            Assert.True(tf.Border);
            Assert.True(tf.Color == SPColor.Fuchsia);
            Assert.False(tf.Kerning);
            Assert.False(tb.IsEmpty);

            #endregion
        }
        public void Constructors()
        {
            #region ...
            SPTextField t1 = new SPTextField(200.0f, 100.0f, "Hello World!", "Arial", 30.0f, SPColor.Red);
            SPTextField t2 = new SPTextField(140.0f, 50.0f, "Hello");
            SPTextField t3 = new SPTextField("World");

            Assert.True(t1.Handle != IntPtr.Zero);
            Assert.True(t2.Handle != IntPtr.Zero);
            Assert.True(t3.Handle != IntPtr.Zero);
            #endregion
        }
        public void RegisterBitmapFont()
        {
            #region ...

            string fontName = SPTextField.RegisterBitmapFont("Media/desyrel.fnt");

            Assert.True(fontName == "Desyrel");

            SPTextField t1 = new SPTextField(200.0f, 100.0f, "Hello World!", fontName, SPTextField.NativeFontSize, SPTextField.DefaultFontColor);

            Assert.True(t1.FontName == fontName);

            t1.Dispose();
            SPTextField.UnregisterBitmapFont(fontName);

            #endregion
        }
Example #4
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            Console.WriteLine("finished loading");

            RectangleF frame = UIScreen.MainScreen.Bounds;

            // create a new window instance based on the screen size
            window = new UIWindow(frame);

            //SPAudioEngine.StartWithCategory(Sparrow.SPAudioSessionCategory.AmbientSound);
            SPStage.SupportHighResolutions = true; // use @2x textures on suitable hardware
            SPStage.DoubleResolutionsOnPad = true; // use @2x on iPad 1+2, @4x on iPad 3

            // create sparrow view
            sparrowView = new SPView(frame);
            sparrowView.MultipleTouchEnabled = true;
            sparrowView.FrameRate = 30;

            // create a root view controller
            rootViewController = new UIViewController();
            rootViewController.View = sparrowView;

            // set root view controller
            window.RootViewController = rootViewController;

            // create a stage
            SPStage stage = new SPStage(frame.Size.Width, frame.Size.Height);
            stage.Color = 0x2000a0;
            sparrowView.Stage = stage;

            // create and add our hello world text field to the stage
            SPTextField text = new SPTextField(frame.Size.Width, 50.0f, "Hello World!", "Helvetica", 30.0f, SPColor.White);
            text.Y = (frame.Size.Height - 50.0f) / 2.0f; // vertical center
            stage.Add(text);

            // make the window visible
            window.MakeKeyAndVisible();

            return true;
        }