Esempio n. 1
0
 void InternalChangeTextFormat(TextFormat e)
 {
     InternalTextField.defaultTextFormat = e;
     InternalTextField.setTextFormat(e);
 }
Esempio n. 2
0
        public MySprite1()
        {
            this.stage.scaleMode = StageScaleMode.NO_SCALE;

            var app = new MultitouchTransform.ApplicationCanvas();

            Func<TouchEvent, Movable> ToMovable =
                e =>
                {

                    var k = this.labels.Keys.ToArray();
                    var i = -1;

                    foreach (var item in k)
                    {
                        i++;

                        if (item == e.touchPointID)
                            break;
                    }

                    return app.Movables[i];
                };


            app.AttachToContainer(this);

            this.labelFormat = new TextFormat();
            labelFormat.color = 0xACF0F2;
            labelFormat.font = "Helvetica";
            labelFormat.size = 11;

            this.dotCount = 0;

            this.dotsLeft = new TextField();
            this.dotsLeft.width = 300;
            this.dotsLeft.defaultTextFormat = this.labelFormat;
            this.dotsLeft.x = 3;
            this.dotsLeft.y = 0;
            this.stage.addChild(this.dotsLeft);
            this.updateDotsLeft();


            Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;

            this.graphics.beginFill(0x7f0000);
            this.graphics.drawRect(0, 0, DefaultWidth, DefaultHeight);

            // not interested in stage are we
            var u = app.ToSprite();

            u.touchBegin +=
                e =>
                {
                    if (this.dotCount == Multitouch.maxTouchPoints)
                        return;

                    //var dot = this.getCircle();
                    //dot.x = e.stageX;
                    //dot.y = e.stageY;
                    //this.stage.addChild(dot);
                    //dot.startTouchDrag(e.touchPointID, true);
                    //this.dots[e.touchPointID] = dot;

                    //++this.dotCount;

                    var label = this.getLabel(e.stageX + ", " + e.stageY);
                    label.x = 3;
                    label.y = this.dotCount * LABEL_SPACING;
                    this.stage.addChild(label);
                    this.labels[e.touchPointID] = label;

                    this.updateDotsLeft();
                };

            u.touchMove +=
                e =>
                {
                    var label = this.labels[e.touchPointID];


                    ToMovable(e).MoveTo(e.stageX, e.stageY);

                    label.text = (e.touchPointID + ": " + e.stageX + ", " + e.stageY);
                };

            u.touchEnd +=
                e =>
                {
                    //var dot = this.dots[e.touchPointID];
                    var label = this.labels[e.touchPointID];

                    //this.stage.removeChild(dot);
                    this.stage.removeChild(label);

                    //this.dots.Remove(e.touchPointID);
                    this.labels.Remove(e.touchPointID);

                    --this.dotCount;

                    this.updateDotsLeft();
                };
        }
Esempio n. 3
0
        protected void prepare()
        {
            stage.align = StageAlign.TOP_LEFT;
            //stage.quality 	= StageQuality.LOW;

            txtMain = new TextField();
            tfNormal = new TextFormat();
            tfNormal.font = "Verdana";
            tfNormal.align = TextFormatAlign.LEFT;
            tfNormal.size = 10;
            tfNormal.color = 0xffffff;
            txtMain.defaultTextFormat = tfNormal;
            txtMain.autoSize = "left";
            txtMain.appendText("0");

            moveSpeed = 0.2;
            rotSpeed = 0.12;
            texWidth = 256;
            texHeight = 256;
            posX = 22;
            posY = 11.5;
            dirX = -1;
            dirY = 0;
            planeX = 0;
            planeY = 0.66;
            w = 320;
            h = 240;
            time = getTimer();
            setWorldMap();

            //floorVals = new[] {
            //    80,40,26.6666666666667,20,16,13.3333333333333,11.4285714285714,10,8.88888888888889,8,7.27272727272727,6.66666666666667,6.15384615384615,5.71428571428571,5.33333333333333,5,4.70588235294118,4.44444444444444,4.21052631578947,4,3.80952380952381,3.63636363636364,3.47826086956522,3.33333333333333,3.2,3.07692307692308,2.96296296296296,2.85714285714286,2.75862068965517,2.66666666666667,2.58064516129032,2.5,2.42424242424242,2.35294117647059,2.28571428571429,2.22222222222222,2.16216216216216,2.10526315789474,2.05128205128205,2,
            //1.95121951219512,1.9047619047619,1.86046511627907,1.81818181818182,1.77777777777778,1.73913043478261,1.70212765957447,1.66666666666667,1.63265306122449,1.6,1.56862745098039,1.53846153846154,1.50943396226415,1.48148148148148,1.45454545454545,1.42857142857143,1.40350877192982,1.37931034482759,1.35593220338983,1.33333333333333,1.31147540983607,1.29032258064516,1.26984126984127,1.25,1.23076923076923,1.21212121212121,1.19402985074627,1.17647058823529,1.15942028985507,1.14285714285714,1.12676056338028,1.11111111111111,1.0958904109589,1.08108108108108,1.06666666666667,1.05263157894737,1.03896103896104,1.02564102564103,1.0126582278481 };

            time = getTimer();
            counter = 0;

            ZBuffer = new double[0];

            screen = new BitmapData(w, h, false, 0x0);
            screenImage = new Bitmap();
            screenImage.bitmapData = screen;

            addChild(screenImage);
            addChild(txtMain);

            this.enterFrame += render;

            //addEventListener(Event.ENTER_FRAME, render);

        }
Esempio n. 4
0
 /// <summary>
 /// Applies the text formatting that the format parameter specifies to the specified text in a text field.
 /// </summary>
 public void setTextFormat(TextFormat format)
 {
 }
Esempio n. 5
0
 /// <summary>
 /// Applies the text formatting that the format parameter specifies to the specified text in a text field.
 /// </summary>
 public void setTextFormat(TextFormat format, int beginIndex)
 {
 }
Esempio n. 6
0
        public MySprite1()
        {
            this.labelFormat = new TextFormat();
            labelFormat.color = 0xACF0F2;
            labelFormat.font = "Helvetica";
            labelFormat.size = 11;

            this.dotCount = 0;

            this.dotsLeft = new TextField();
            this.dotsLeft.width = 300;
            this.dotsLeft.defaultTextFormat = this.labelFormat;
            this.dotsLeft.x = 3;
            this.dotsLeft.y = 0;
            this.stage.addChild(this.dotsLeft);
            this.updateDotsLeft();

            // Error	1	'ScriptCoreLib.ActionScript.flash.ui.Multitouch.inputMode' is not supported by the language	Y:\jsc.svn\examples\actionscript\MultitouchExample\MultitouchExample\Components\MySprite1.cs	35	24	MultitouchExample
            Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;

            this.stage.touchBegin +=
                e =>
                {
                    if (this.dotCount == Multitouch.maxTouchPoints) return;
			        var dot = this.getCircle();
			        dot.x = e.stageX;
			        dot.y = e.stageY;
			        this.stage.addChild(dot);
			        dot.startTouchDrag(e.touchPointID, true);
			        this.dots[e.touchPointID] = dot;
			
			        ++this.dotCount;

			        var label = this.getLabel(e.stageX + ", " + e.stageY);
			        label.x = 3;
			        label.y = this.dotCount * LABEL_SPACING;
			        this.stage.addChild(label);
			        this.labels[e.touchPointID] = label;

			        this.updateDotsLeft();
                };

            this.stage.touchMove +=
                e =>
                {
                    var label = this.labels[e.touchPointID];
			        label.text = (e.stageX + ", " + e.stageY);
                };

            this.stage.touchEnd +=
                e =>
                {
                    var dot = this.dots[e.touchPointID];
			        var label = this.labels[e.touchPointID];
			
			        this.stage.removeChild(dot);
			        this.stage.removeChild(label);
			
			        this.dots.Remove(e.touchPointID);
			        this.labels.Remove(e.touchPointID);
			
			        --this.dotCount;

			        this.updateDotsLeft();
                };
        }