FillRect() public method

public FillRect ( System.Color color, int x, int y, int width, int height ) : void
color System.Color
x int
y int
width int
height int
return void
Beispiel #1
0
 /// <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;
     }
 }
Beispiel #2
0
        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();
        }
Beispiel #3
0
        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 ();
        }
Beispiel #4
0
 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();
 }
Beispiel #5
0
        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();
        }
Beispiel #6
0
 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();
 }
Beispiel #7
0
 private void OnFlip(Cube cube, bool newOrientationIsUp)
 {
     cube.FillRect(new Color(0, 0, 255), 54, 54, 20, 20); // blue
     cube.Paint();
 }
        /// <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) {
                            length++;
                        } else {
                            lastSentColor = c;
                            length = -1;
                        }
                    }
                    if (length > -1) {
                        fillRects++;
                        cube.FillRect (lastSentColor, i, lastStart, 1, length);
                    }
                }
                totalFilLRects += fillRects;

            }
        }
		// 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);




		}
    // 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);



    }
Beispiel #11
0
 /// <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);
 }
    // 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);


    }
Beispiel #13
0
        /// <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();
        }
Beispiel #14
0
        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;

            case 'P': //Draw P
                cube.FillRect (mColor, x, y - mTextH, 2, mTextH);
                cube.FillRect (mColor, x + mTextW, y + 2 - mTextH, 2, mTextH / 2 - 2);
                cube.FillRect (mColor, x + 2, y - mTextH, mTextW - 2, 2);
                cube.FillRect (mColor, x + 2, y - mTextH / 2, mTextW - 2, 2);
                    //cube.FillRect(mColor, x + mTextW, y - mTextH/2, 2, mTextH/2);
                break;
            case 'Q': //Draw Q
                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);
                cube.FillRect (mColor, x - 4 + mTextW, y - mTextH / 2, 2, mTextH / 4);
                cube.FillRect (mColor, x - 2 + mTextW, y - mTextH / 4, 2, mTextH / 4);
                break;
            case 'R': //Draw R
                cube.FillRect (mColor, x, y - mTextH, 2, mTextH);
                cube.FillRect (mColor, x + mTextW, y + 2 - mTextH, 2, mTextH / 2 - 2);
                cube.FillRect (mColor, x + 2, y - mTextH, mTextW - 2, 2);
                cube.FillRect (mColor, x + 2, y - mTextH / 2, mTextW - 2, 2);
                cube.FillRect (mColor, x - 2 + mTextW, y - mTextH / 2, 2, mTextH / 4);
                cube.FillRect (mColor, x + mTextW, y - mTextH / 4, 2, mTextH / 4);
                break;
            case 'S': //Draw S
                cube.FillRect (mColor, x + 2, y - mTextH, mTextW - 2, 2);
                cube.FillRect (mColor, x, y + 2 - mTextH, 2, mTextH / 2 - 4);
                cube.FillRect (mColor, x + 2, y - mTextH / 2 - 2, mTextW - 4, 2);
                cube.FillRect (mColor, x + mTextW - 2, y - mTextH / 2, 2, mTextH / 2 - 2);
                cube.FillRect (mColor, x, y - 2, mTextW - 2, 2);
                break;
            case 'T': //Draw T
                cube.FillRect (mColor, x + mTextW / 2 - 1, y - mTextH, 2, mTextH);
                cube.FillRect (mColor, x, y - mTextH, mTextW, 2);
                break;
            case 'U': //Draw U
                cube.FillRect (mColor, x, y - mTextH, 2, mTextH - 2);
                cube.FillRect (mColor, x + mTextW, y - mTextH, 2, mTextH - 2);
                cube.FillRect (mColor, x + 2, y - 2, mTextW - 2, 2);
                break;
            case 'V': //Draw V
                cube.FillRect (mColor, x - 4 + mTextW / 2, y - mTextH, 2, mTextH - 4);
                cube.FillRect (mColor, x - 2 + mTextW / 2, y - 4, 2, 2);
                cube.FillRect (mColor, x + mTextW / 2, y - 2, 2, 2);
                cube.FillRect (mColor, x + 2 + mTextW / 2, y - 4, 2, 2);
                cube.FillRect (mColor, x + 4 + mTextW / 2, y - mTextH, 2, mTextH - 4);
                break;
            case 'W': //Draw W
                cube.FillRect (mColor, x, y - mTextH, 2, y);
                cube.FillRect (mColor, x + 2, y - 2, mTextW, 2);
                cube.FillRect (mColor, x + mTextW / 2, y - mTextH / 2, 2, mTextH / 2);
                cube.FillRect (mColor, x + mTextW, y - mTextH, 2, y);
                break;

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

                cube.FillRect (mColor, x - 4 + mTextW / 2, y + 4 - mTextH / 2, 2, mTextH / 2 - 4);
                cube.FillRect (mColor, x - 2 + mTextW / 2, y + 2 - mTextH / 2, 2, 2);

                cube.FillRect (mColor, x + 2 + mTextW / 2, y + 2 - mTextH / 2, 2, 2);
                cube.FillRect (mColor, x + 4 + mTextW / 2, y + 4 - mTextH / 2, 2, mTextH / 2 - 4);

                break;
            case 'Y': //Draw Y
                cube.FillRect (mColor, x - 4 + mTextW / 2, y - mTextH, 2, mTextH / 2 - 2);
                cube.FillRect (mColor, x - 2 + mTextW / 2, y - 2 - mTextH / 2, 2, 2);
                cube.FillRect (mColor, x + mTextW / 2, y - mTextH / 2, 2, mTextH / 2);
                cube.FillRect (mColor, x + 2 + mTextW / 2, y - 2 - mTextH / 2, 2, 2);
                cube.FillRect (mColor, x + 4 + mTextW / 2, y - mTextH, 2, mTextH / 2 - 2);
                break;
            case 'Z': //Draw Z
                cube.FillRect (mColor, x, y - mTextH, mTextW, 2);
                cube.FillRect (mColor, x - 2 + mTextW, y + 2 - mTextH, 2, 2);
                cube.FillRect (mColor, x - 4 + mTextW, y + 4 - mTextH, (mTextW - 5) / 2, (mTextH - 5) / 2 - 2);
                    // cube.FillRect(mColor, x - 6 + mTextW, y + 4 - mTextH, 2, 2);
                cube.FillRect (mColor, x + 4, y - 4 - (mTextH - 5) / 2, (mTextW - 5) / 2, (mTextH - 5) / 2 - 4);
                cube.FillRect (mColor, x + 2, y - 2 - (mTextH - 5) / 2, (mTextW - 5) / 2, (mTextH - 5) / 2 - 2);
                cube.FillRect (mColor, x, y - 4, 2, 2);
                cube.FillRect (mColor, x, y - 2, mTextW, 2);
                break;
            case '0': //Draw 0
                cube.FillRect (mColor, x, y + 2 - mTextH, 2, mTextH - 4);
                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 '1': //Draw 1
                cube.FillRect (mColor, x + mTextW / 2, y - mTextH, 2, mTextH);
                cube.FillRect (mColor, x - 2 + mTextW / 2, y - mTextH, 2, 2);
                cube.FillRect (mColor, x + 2, y - 2, mTextW - 2, 2);
                break;
            case '2': //Draw 2
                cube.FillRect (mColor, x, y - mTextH, mTextW - 2, 2);
                cube.FillRect (mColor, x + mTextW - 2, y + 2 - mTextH, 2, mTextH / 2 - 4);
                cube.FillRect (mColor, x + 2, y - mTextH / 2 - 2, mTextW - 4, 2);
                cube.FillRect (mColor, x, y - mTextH / 2, 2, mTextH / 2 - 2);
                cube.FillRect (mColor, x + 2, y - 2, mTextW - 4, 2);
                break;
            case '3': //Draw 3
                cube.FillRect (mColor, x - 2 + mTextW, y + 2 - mTextH, 2, mTextH - 4);
                cube.FillRect (mColor, x, y - mTextH, mTextW - 2, 2);
                cube.FillRect (mColor, x - 2 + mTextW / 2, y - mTextH / 2, mTextW / 2, 2);
                cube.FillRect (mColor, x, y - 2, mTextW - 2, 2);
                break;
            case '4': //Draw 4
                cube.FillRect (mColor, x, y - mTextH, 2, mTextH / 2);
                cube.FillRect (mColor, x + 2, y - mTextH / 2, mTextW, 2);
                cube.FillRect (mColor, x - 2 + mTextW, y - mTextH, 2, mTextH);
                break;
            case '5': //Draw 5
                cube.FillRect (mColor, x, y - mTextH, mTextW, 2);
                cube.FillRect (mColor, x, y + 2 - mTextH, 2, mTextH / 2 - 4);
                cube.FillRect (mColor, x + 2, y - mTextH / 2 - 2, mTextW - 4, 2);
                cube.FillRect (mColor, x + mTextW - 2, y - mTextH / 2, 2, mTextH / 2 - 2);
                cube.FillRect (mColor, x, y - 2, mTextW - 2, 2);
                break;
            case '6': //Draw 6
                cube.FillRect (mColor, x + 2, y - mTextH, mTextW - 2, 2);
                cube.FillRect (mColor, x, y + 2 - mTextH, 2, mTextH - 4);
                cube.FillRect (mColor, x + 2, y - mTextH / 2 - 2, mTextW - 4, 2);
                cube.FillRect (mColor, x + mTextW - 2, y - mTextH / 2, 2, mTextH / 2 - 2);
                cube.FillRect (mColor, x + 2, y - 2, mTextW - 4, 2);
                break;
            case '7': //Draw 7
                cube.FillRect (mColor, x - 2 + mTextW, y - mTextH, 2, mTextH);
                cube.FillRect (mColor, x, y - mTextH, mTextW - 2, 2);
                break;
            case '8': //Draw 8
                cube.FillRect (mColor, x, y + 2 - mTextH, 2, mTextH - 4);
                cube.FillRect (mColor, x - 2 + mTextW, y + 2 - mTextH, 2, mTextH - 4);
                cube.FillRect (mColor, x + 2, y - 1 - mTextH / 2, mTextW - 4, 2);
                cube.FillRect (mColor, x + 2, y - 2, mTextW - 4, 2);
                cube.FillRect (mColor, x + 2, y - mTextH, mTextW - 4, 2);
                break;
            case '9': //Draw 9
                cube.FillRect (mColor, x - 2 + mTextW, y + 2 - mTextH, 2, mTextH - 2);
                cube.FillRect (mColor, x, y + 2 - mTextH, 2, mTextH / 2 - 2);
                cube.FillRect (mColor, x + 2, y - mTextH, mTextW - 4, 2);
                cube.FillRect (mColor, x + 2, y - mTextH / 2, mTextW - 4, 2);
                break;
            default:
                Log.Debug ("c is: " + c + " let's but a space instead");
                break;
            }
        }
Beispiel #15
0
 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();
 }
Beispiel #16
0
 public void PrintColorOnCube(Cube c, Sifteo.Color color)
 {
     c.FillRect(color, x, y, w, h);
 }
        private void ChangeCubeImg(Cube cube, Fraction fraction, Color color)
        {
            cube.FillScreen(color);

            //            _imageSourceNum = fraction.GetNumerator() + ".png";
            //            _imageSourceDen = fraction.GetDenominator() + ".png";
            switch (fraction.GetNumerator())
            {
                case 1:
                    _imageSourceNum = "1.png";
                    break;
                case 2:
                    _imageSourceNum = "2.png";
                    break;
                case 3:
                    _imageSourceNum = "3.png";
                    break;
                case 4:
                    _imageSourceNum = "4.png";
                    break;
                case 5:
                    _imageSourceNum = "5.png";
                    break;
                case 6:
                    _imageSourceNum = "6.png";
                    break;
                case 7:
                    _imageSourceNum = "7.png";
                    break;
                case 8:
                    _imageSourceNum = "8.png";
                    break;
                case 9:
                    _imageSourceNum = "9.png";
                    break;
                case 10:
                    _imageSourceNum = "10.png";
                    break;
            }

            switch (fraction.GetDenominator())
            {
                case 1:
                    _imageSourceDen = "1.png";
                    break;
                case 2:
                    _imageSourceDen = "2.png";
                    break;
                case 3:
                    _imageSourceDen = "3.png";
                    break;
                case 4:
                    _imageSourceDen = "4.png";
                    break;
                case 5:
                    _imageSourceDen = "5.png";
                    break;
                case 6:
                    _imageSourceDen = "6.png";
                    break;
                case 7:
                    _imageSourceDen = "7.png";
                    break;
                case 8:
                    _imageSourceDen = "8.png";
                    break;
                case 9:
                    _imageSourceDen = "9.png";
                    break;
                case 10:
                    _imageSourceDen = "10.png";
                    break;
            }

            cube.Image(_imageSourceNum, _cubeX, _cubeYNum, _sourceX, _sourceY, _width, _height, _scale,
                       _rotation);
            cube.Image(_imageSourceDen, _cubeX, _cubeYDen, _sourceX, _sourceY, _width, _height, _scale,
                       _rotation);
            cube.FillRect(Color.Black, _cubeX, _cubeYDen - 10, 65, 10);
            cube.Paint();
        }