當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。