当前位置: 首页>>代码示例>>C#>>正文


C# Cube.FillRect方法代码示例

本文整理汇总了C#中Sifteo.Cube.FillRect方法的典型用法代码示例。如果您正苦于以下问题:C# Cube.FillRect方法的具体用法?C# Cube.FillRect怎么用?C# Cube.FillRect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sifteo.Cube的用法示例。


在下文中一共展示了Cube.FillRect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DrawTo

 /// <summary>
 /// Draws to the specified cube at the specified position.
 /// </summary>
 /// <param name='position'>
 /// Position (from bottom left).
 /// </param>
 /// <param name='cube'>
 /// Cube.
 /// </param>
 public override void DrawTo(Int2 position, Cube cube)
 {
     base.DrawTo(position, cube);
     switch (id)
     {
     case 0:
         cube.FillRect(new Color(128,128,255), Cube.SCREEN_WIDTH/2, Cube.SCREEN_HEIGHT/2-10, 1, 20);
         break;
     case 1:
         cube.FillRect(new Color(128,128,255), Cube.SCREEN_WIDTH/2-4, Cube.SCREEN_HEIGHT/2-10, 1, 20);
         cube.FillRect(new Color(128,128,255), Cube.SCREEN_WIDTH/2+4, Cube.SCREEN_HEIGHT/2-10, 1, 20);
         break;
     }
 }
开发者ID:dennispr,项目名称:Reunion,代码行数:23,代码来源:Player.cs

示例2: OnTilt

        private void OnTilt(Cube cube, Cube.Side direction)
        {
            switch (direction)
            {
                case Cube.Side.TOP:
                    cube.FillRect(new Color(0, 200, 0), 54, 54, 20, 20); // increasingly dark green
                    break;

                case Cube.Side.BOTTOM:
                    cube.FillRect(new Color(0, 150, 0), 54, 54, 20, 20);
                    break;

                case Cube.Side.LEFT:
                    cube.FillRect(new Color(0, 100, 0), 54, 54, 20, 20);
                    break;

                case Cube.Side.RIGHT:
                    cube.FillRect(new Color(0, 50, 0), 54, 54, 20, 20);
                    break;
                default:
                    cube.FillRect(Color.White, 54, 54, 20, 20); // extremely light green
                    break;
            }

            cube.Paint();
        }
开发者ID:veatchje,项目名称:Siftables-477,代码行数:26,代码来源:CubeTestApp.cs

示例3: DisplayMessage

        public static void DisplayMessage(Cube c, String msg, SiftColor color)
        {
            ImageSurface sr = new ImageSurface (Format.ARGB32, 128, 128);
            Cairo.Context context = new Cairo.Context (sr);

            context.Color = new Cairo.Color (0, 0, 0, 0);
            context.Paint ();
            Pango.Layout pango = Pango.CairoHelper.CreateLayout (context);

            pango.FontDescription = Pango.FontDescription.FromString ("Arial 16");
            pango.Alignment = Alignment.Center;
            pango.Wrap = WrapMode.WordChar;
            pango.Width = 128 * 1016;
            pango.SetText (msg);

            context.Color = color.ToCairo ();
            int pWidth = 0, pHeight = 0;
            pango.GetPixelSize (out pWidth, out pHeight);
            Log.Debug ("pango Pixel size: " + pWidth + "x" + pHeight);

            context.MoveTo (0, 64 - (pHeight / 2));
            CairoHelper.ShowLayout (context, pango);
            sr.Flush ();
            byte[] data = sr.Data;

            for (int i = 0, x = 0, y = 0; i < data.Length; i += 4, x++) {
                if (x >= 128) {
                    x = 0;
                    y++;
                }
                byte b = data [i],
                g = data [i + 1],
                r = data [i + 2],
                a = data [i + 3];
                if (a != 0 || r != 0 || g != 0 || b != 0) {
                    SiftColor sc = new SiftColor (r, g, b);
                    c.FillRect (sc.ToSifteo (), x, y, 1, 1);
                } else {
                    // we ignore it
                }
            }
            ((IDisposable)context).Dispose ();
            ((IDisposable)pango).Dispose ();
            ((IDisposable)sr).Dispose ();
        }
开发者ID:raabmar,项目名称:The-Tangibles,代码行数:45,代码来源:TextDisplayer.cs

示例4: HighlightFailCube

 private void HighlightFailCube(Cube cube)
 {
     cube.FillRect(new Color(204, 0, 0), 0, 0, Cube.SCREEN_WIDTH, _cubeHighlightWidth); // top red
     cube.FillRect(new Color(204, 0, 0), 0, Cube.SCREEN_HEIGHT - _cubeHighlightWidth, Cube.SCREEN_WIDTH,
                   _cubeHighlightWidth); // bottom red
     cube.FillRect(new Color(204, 0, 0), 0, 0, _cubeHighlightWidth, Cube.SCREEN_HEIGHT); // left red
     cube.FillRect(new Color(204, 0, 0), Cube.SCREEN_WIDTH - _cubeHighlightWidth, 0, _cubeHighlightWidth,
                   Cube.SCREEN_HEIGHT); // right red
     cube.Paint();
 }
开发者ID:veatchje,项目名称:Siftables-477,代码行数:10,代码来源:SimonSaysApp.cs

示例5: HighlightCube

        private void HighlightCube(Cube cube)
        {
            Color highlight = Color.White;

            cube.FillRect(highlight, 0, 0, Cube.SCREEN_WIDTH, _cubeHighlightWidth); // top red
            cube.FillRect(highlight, 0, Cube.SCREEN_HEIGHT - _cubeHighlightWidth, Cube.SCREEN_WIDTH,
                          _cubeHighlightWidth); // bottom red
            cube.FillRect(highlight, 0, 0, _cubeHighlightWidth, Cube.SCREEN_HEIGHT); // left red
            cube.FillRect(highlight, Cube.SCREEN_WIDTH - _cubeHighlightWidth, 0, _cubeHighlightWidth,
                          Cube.SCREEN_HEIGHT); // right red
            cube.Paint();
        }
开发者ID:veatchje,项目名称:Siftables-477,代码行数:12,代码来源:SimonSaysApp.cs

示例6: OnShake

 private void OnShake(Cube cube)
 {
     Random rand = new Random();
     cube.FillRect(new Color(rand.Next(0, 256), rand.Next(0, 256), rand.Next(0, 256)), 54, 54, 20, 20);
     cube.Paint();
 }
开发者ID:veatchje,项目名称:Siftables-477,代码行数:6,代码来源:CubeTestApp.cs

示例7: OnFlip

 private void OnFlip(Cube cube, bool newOrientationIsUp)
 {
     cube.FillRect(new Color(0, 0, 255), 54, 54, 20, 20); // blue
     cube.Paint();
 }
开发者ID:veatchje,项目名称:Siftables-477,代码行数:5,代码来源:CubeTestApp.cs

示例8: blitColors

        /// <summary>
        /// Blits the colors.
        /// </summary>
        /// <param name='cube'>
        /// A Cube.
        /// </param>
        /// <param name='colors'>
        /// The colors to paint to the cube.
        /// </param>
        /// <param name='lastColorsSent'>
        /// Can be null.  If provided the cube only updates the changed colors.
        /// </param>
        /// <param name='rect'>
        /// Update area.
        /// </param>
        private void blitColors(Cube cube,
			Sifteo.Color [,] colors, 
			Sifteo.Color [,] lastColorsSent,
			Rectangle rect)
        {
            Sifteo.Color lastSentColor = Sifteo.Color.Mask;
            bool changedOnly = lastColorsSent != null;

            int lastStart = 0;
            int length = 0;
            int fillRects = 0;
            if (changedOnly) {
                //only set the changed colors
                //but try to reduce sets by writing in lines once
                //you find a single pixel that needs changed.
                for (int i =rect.Left; i <rect.Right; i++) {
                    length = -1;
                    for (int j=rect.Top; j< rect.Bottom; j++) {
                        Sifteo.Color c = colors [i, j];

                        //is this is different than the last color sent to this position?
                        bool newColorToImage = c.Data != lastColorsSent [i, j].Data;

                        //are we already making a line of this color?
                        bool sameColorInLine = length > -1 && c.Data == lastSentColor.Data;

                        if (newColorToImage && !sameColorInLine) {
                            //are we already sending some data?
                            if (length > -1) {
                                fillRects++;
                                cube.FillRect (lastSentColor, i, lastStart, 1, length);
                            }
                            //start here for the next color
                            lastStart = j;
                            length = 1;
                            lastSentColor = c;

                        } else if (sameColorInLine) {
                            length++;
                        } else {
                            if (length > -1) {
                                fillRects++;
                                cube.FillRect (lastSentColor, i, lastStart, 1, length);
                            }
                            //not a new color, not a line. nothing going on
                            length = -1;
                        }
                    }
                    if (length > -1) {
                        fillRects++;
                        cube.FillRect (lastSentColor, i, lastStart, 1, length);
                    }
                }
                totalFilLRects += fillRects;
            } else {
                Sifteo.Color background = Sifteo.Color.Black;

                //if we don't have any last sent colors
                //fill the background with the most frequent color
                byte mostFrequent = getMostFrequentColor (colors, rect);
                Sifteo.Color color = getColor (colors, mostFrequent);
                background = color;
                lastSentColor = color;
                cube.FillRect (color, rect.Left, rect.Top, rect.Right, rect.Bottom);

                for (int i =rect.Left; i <rect.Right; i++) {
                    length = -1;
                    for (int j=rect.Top; j< rect.Bottom; j++) {
                        Sifteo.Color c = colors [i, j];

                        //are we already making a line of this color?
                        bool sameColorInLine = length > -1 && c.Data == lastSentColor.Data;
                        bool newColor = c.Data != lastSentColor.Data;

                        //start a line if this is not the background color.
                        //and we did not already start a line.
                        if ((newColor || lastSentColor.Data != background.Data) && !sameColorInLine) {
                            if (length > -1) {
                                cube.FillRect (lastSentColor, i, lastStart, 1, length);
                                fillRects++;
                            }
                            lastStart = j;
                            length = 1;
                            lastSentColor = c;
                        } else if (sameColorInLine) {
//.........这里部分代码省略.........
开发者ID:cdesch,项目名称:ThreeCardMonte,代码行数:101,代码来源:CubeImageHelper.cs

示例9: DrawCarita

		// In this method, we draw "HELLO WORLD" to the display of a cube using
		// rects.
		private void DrawCarita(Cube cube2) {

			Color color = new Color(255, 145, 0);

			//eyes
			cube2.FillRect(color, 50, 50, 23, 22);
			cube2.FillRect(color, 90, 50, 23, 22);

			Color color2 = new Color(10, 10, 0);

			cube2.FillRect(color2, 60, 80, 50, 10);




		}
开发者ID:trinkermedia,项目名称:HelloWorldSifteo,代码行数:18,代码来源:HelloSifteoApp.cs

示例10: DrawHelloWorld

    // In this method, we draw "HELLO WORLD" to the display of a cube using
    // rects.
    private void DrawHelloWorld(Cube cube) {

      Color color = new Color(255, 145, 0);

			//eyes
			cube.FillRect(color, 50, 50, 23, 22);
			cube.FillRect(color, 90, 50, 23, 22);

	  Color color2 = new Color(255, 100, 0);

			cube.FillRect(color2, 60, 80, 50, 10);

			//browns
			cube.FillRect(color2, 50, 40, 23, 5);
			cube.FillRect(color2, 90, 40, 23, 5);



    }
开发者ID:trinkermedia,项目名称:HelloWorldSifteo,代码行数:21,代码来源:HelloSifteoApp.cs

示例11: DrawTo

 /// <summary>
 /// Draws to the specified cube at the specified position.
 /// </summary>
 /// <param name='position'>
 /// Position (from bottom left).
 /// </param>
 /// <param name='cube'>
 /// Cube.
 /// </param>
 public virtual void DrawTo(Int2 position, Cube cube)
 {
     cube.FillRect(new Color(255, 128, 128), position.x, position.y, pixelSize.x, pixelSize.y);
 }
开发者ID:dennispr,项目名称:Reunion,代码行数:13,代码来源:Character.cs

示例12: DrawHelloWorld

    // In this method, we draw "HELLO WORLD" to the display of a cube using
    // rects.
    private void DrawHelloWorld(Cube cube) {

			Color color = new Color(255, 145, 0);

			// Draw the word "HELLO" to the cube's display.
			cube.FillRect(color, 1, 97, 23, 22);
			cube.FillRect(color, 5, 109, 6, 6);
			cube.FillRect(color, 14, 109, 6, 6);

			cube.FillRect(color, 5, 101, 15, 4);
			cube.FillRect(color, 8, 101, 3, 4);


    }
开发者ID:trinkermedia,项目名称:HelloWorldSifteo,代码行数:16,代码来源:HelloSifteoApp2.cs

示例13: DrawTo

        /// <summary>
        /// Draws to the supplied cube.
        /// </summary>
        /// <param name='cube'>
        /// The cube to which the room should be drawn.
        /// </param>
        public void DrawTo(Cube cube)
        {
            // draw the background
            cube.FillScreen(bgColor);

            // draw the center
            cube.FillRect(passageColor, segmentSize, segmentSize, segmentSize, segmentSize);

            // draw open passages
            for (int i=0; i<entryStates.Length; i++)
            {
                if (entryStates[i] == EntryState.Closed) continue;
                int x=segmentSize, y=segmentSize;
                switch ((Cube.Side)i)
                {
                case Cube.Side.BOTTOM:
                    y = 2*segmentSize;
                    break;
                case Cube.Side.LEFT:
                    x = 0;
                    break;
                case Cube.Side.RIGHT:
                    x = 2*segmentSize;
                    break;
                case Cube.Side.TOP:
                    y = 0;
                    break;
                }
                cube.FillRect(passageColor, x, y, segmentSize, segmentSize);
            }

            // paint the cube
            cube.Paint();
        }
开发者ID:dennispr,项目名称:Reunion,代码行数:40,代码来源:MazeRoom.cs

示例14: printChar

        public void printChar(Cube cube, char c, int x, int y)
        {
            switch (c) {
            case 'A':   //Draw A
                cube.FillRect (mColor, x, y + 2 - mTextH, 2, mTextH - 2);
                cube.FillRect (mColor, x + 2, y - mTextH, mTextW - 2, 2);
                cube.FillRect (mColor, x + 2, y - mTextH / 2, mTextW, 2);
                cube.FillRect (mColor, x + mTextW, y + 2 - mTextH, 2, mTextH - 2);
                break;
            case 'B':  //Draw B
                cube.FillRect (mColor, x, y - mTextH, 2, mTextH);
                cube.FillRect (mColor, x, y - mTextH / 2, mTextW, 2);
                cube.FillRect (mColor, x + mTextW, y + 2 - mTextH, 2, mTextH / 2 - 2);
                cube.FillRect (mColor, x + mTextW, y + 2 - mTextH / 2, 2, mTextH / 2 - 4);
                cube.FillRect (mColor, x + 2, y - 2, mTextW - 2, 2);
                cube.FillRect (mColor, x + 2, y - mTextH, mTextW - 2, 2);
                break;
            case 'C': //Draw C
                cube.FillRect (mColor, x, y + 2 - mTextH, 2, mTextH - 4);
                cube.FillRect (mColor, x + 2, y - 2, mTextW, 2);
                cube.FillRect (mColor, x + 2, y - mTextH, mTextW, 2);
                break;
            case 'D': //Draw D
                cube.FillRect (mColor, x, y - mTextH, 2, mTextH);
                cube.FillRect (mColor, x + mTextW, y + 2 - mTextH, 2, mTextH - 4);
                cube.FillRect (mColor, x + 2, y - 2, mTextW - 2, 2);
                cube.FillRect (mColor, x + 2, y - mTextH, mTextW - 2, 2);
                break;
            case 'E': //Draw E
                cube.FillRect (mColor, x, y - mTextH, 2, mTextH);
                cube.FillRect (mColor, x + 2, y - mTextH, mTextW, 2);
                cube.FillRect (mColor, x + 2, y - 2 - mTextH / 2, mTextW / 2, 2);
                cube.FillRect (mColor, x + 2, y - 2, mTextW, 2);
                break;
            case 'F': //Draw F
                cube.FillRect (mColor, x, y - mTextH, 2, mTextH);
                cube.FillRect (mColor, x + 2, y - mTextH, mTextW, 2);
                cube.FillRect (mColor, x + 2, y - 2 - mTextH / 2, mTextW / 2, 2);
                break;
            case 'G': //Draw G
                cube.FillRect (mColor, x, y + 2 - mTextH, 2, mTextH - 4);
                cube.FillRect (mColor, x + mTextW, y - 2 - mTextH / 3, 2, mTextH / 3);
                cube.FillRect (mColor, x + mTextW, y - 4 - 3 * mTextH / 4, 2, mTextH / 4);
                cube.FillRect (mColor, x + mTextW / 2, y - mTextH / 2, mTextW / 2 + 4, 2);
                cube.FillRect (mColor, x + 2, y - 2, mTextW - 2, 2);
                cube.FillRect (mColor, x + 2, y - mTextH, mTextW - 2, 2);
                break;
            case 'H': //Draw H
                cube.FillRect (mColor, x, y - mTextH, 2, mTextH);
                cube.FillRect (mColor, x + 2, y - mTextH / 2, mTextW, 2);
                cube.FillRect (mColor, x + mTextW, y - mTextH, 2, mTextH);
                break;
            case 'I':  //Draw I
                cube.FillRect (mColor, x + mTextW / 2, y - mTextH, 2, mTextH);
                cube.FillRect (mColor, x + 2, y - mTextH, mTextW - 2, 2);
                cube.FillRect (mColor, x + 2, y - 2, mTextW - 2, 2);
                break;
            case 'J': //Draw J
                cube.FillRect (mColor, x + mTextW, y - 2 - mTextH, 2, mTextH);
                cube.FillRect (mColor, x + mTextW / 2, y - mTextH, mTextW / 2, 2);
                cube.FillRect (mColor, x + 2, y - 2, mTextW - 2, 2);
                cube.FillRect (mColor, x, y - 2 - mTextH / 4, 2, mTextH / 4);
                break;
            case 'K': //Draw K
                cube.FillRect (mColor, x, y - mTextH, 2, mTextH);
                cube.FillRect (mColor, x + 2, y - 2 - mTextH / 2, 2, 2);
                cube.FillRect (mColor, x + 4, y - mTextH / 2, 2, mTextH / 4);
                cube.FillRect (mColor, x + 4, y - 3 * mTextH / 4, 2, mTextH / 4 - 2);
                cube.FillRect (mColor, x + 6, y - mTextH, 2, mTextH / 4);
                cube.FillRect (mColor, x + 6, y - mTextH / 4, 2, mTextH / 4);
                break;
            case 'L':  //Draw L
                cube.FillRect (mColor, x, y - mTextH, 2, mTextH);
                cube.FillRect (mColor, x + 2, y - 2, mTextW - 2, 2);

                break;

            case 'M':  //Draw M
                cube.FillRect (mColor, x, y - mTextH, 2, mTextH);
                cube.FillRect (mColor, x + 2, y - mTextH, mTextW, 2);
                cube.FillRect (mColor, x + mTextW / 2, y - mTextH, 2, mTextH);
                cube.FillRect (mColor, x + mTextW, y - mTextH, 2, mTextH);
                break;

            case 'N':  //Draw N
                cube.FillRect (mColor, x, y - mTextH, 2, mTextH);
                cube.FillRect (mColor, x + 2, y + 2 - mTextH, 2, 2);
                cube.FillRect (mColor, x + 4, y + 4 - mTextH, (mTextW - 5) / 2, (mTextH - 5) / 2);
                cube.FillRect (mColor, x - 4 + mTextW, y - 4 - (mTextH - 5) / 2, (mTextW - 5) / 2, (mTextH - 5) / 2);
                cube.FillRect (mColor, x - 2 + mTextW, y - 4, 2, 2);
                cube.FillRect (mColor, x + mTextW, y - mTextH, 2, mTextH);
                break;

            case 'O':  //Draw O
                cube.FillRect (mColor, x, y - mTextH, 2, mTextH);
                cube.FillRect (mColor, x + mTextW, y - mTextH, 2, mTextH);
                cube.FillRect (mColor, x + 2, y - 2, mTextW, 2);
                cube.FillRect (mColor, x + 2, y - mTextH, mTextW, 2);
                break;

//.........这里部分代码省略.........
开发者ID:raabmar,项目名称:The-Tangibles,代码行数:101,代码来源:TextDisplayer.cs

示例15: HighlightSuccessCube

 private void HighlightSuccessCube(Cube cube)
 {
     cube.FillRect(new Color(153, 255, 0), 0, 0, Cube.SCREEN_WIDTH, _cubeHighlightWidth); // top green
     cube.FillRect(new Color(153, 255, 0), 0, Cube.SCREEN_HEIGHT - _cubeHighlightWidth, Cube.SCREEN_WIDTH,
                   _cubeHighlightWidth); // bottom green
     cube.FillRect(new Color(153, 255, 0), 0, 0, _cubeHighlightWidth, Cube.SCREEN_HEIGHT); // left green
     cube.FillRect(new Color(153, 255, 0), Cube.SCREEN_WIDTH - _cubeHighlightWidth, 0, _cubeHighlightWidth,
                   Cube.SCREEN_HEIGHT); // right green
     cube.Paint();
 }
开发者ID:veatchje,项目名称:Siftables-477,代码行数:10,代码来源:SimonSaysApp.cs


注:本文中的Sifteo.Cube.FillRect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。