Exemplo n.º 1
0
        public int DrawRect(SDL_Rect rect, Color color)
        {
            SDL_SetRenderDrawColor(_rendererPointer, color);
            int rValue = SDL_RenderDrawRect(_rendererPointer, ref rect);

            SDL_SetRenderDrawColor(_rendererPointer, DrawColor);
            return(rValue);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Draws a line from the <paramref name="start"/><see cref="Vector2"/> to the <paramref
 /// name="end"/><see cref="Vector2"/> with the <see cref="SDL_Color"/><paramref
 /// name="color"/>. Automatically switches back to the <see cref="SDL_Color"/> set in <see
 /// cref="DrawColor"/> after the line is drawn.
 /// </summary>
 /// <param name="start">The start vector.</param>
 /// <param name="end">The end vector.</param>
 /// <param name="color">The color of the line.</param>
 public void DrawLine(Vector2 start, Vector2 end, Color color)
 {
     SDL_SetRenderDrawColor(_rendererPointer, color);
     SDL_RenderDrawLine(_rendererPointer, (int)start.X, (int)start.Y, (int)end.X, (int)end.Y);
     SDL_SetRenderDrawColor(_rendererPointer, DrawColor);
 }
Exemplo n.º 3
0
        /// <summary>
        /// Set window size in characters
        /// </summary>
        /// <param name="W">Width in chars</param>
        /// <param name="H">Height in chars</param>
        public static void SetSize(int W, int H)
        {
            CartConsole.W = W;
            CartConsole.H = H;
            SDL.SDL_SetWindowSize(Wind, W * CharW, H * CharH);
            CharCount = W * H;

            char[] OTEXT = TEXT;
            TEXT = new char[CharCount];

            CONCLR[] OFORE_C = FORE_C, OBACK_C = BACK_C;
            FORE_C = new CONCLR[CharCount];
            BACK_C = new CONCLR[CharCount];

            DIRTY = new bool[CharCount];

            if (OTEXT != null && OFORE_C != null && OBACK_C != null) {
                int L = Math.Min(TEXT.Length, OTEXT.Length);
                for (int i = 0; i < L; i++) {
                    TEXT[i] = OTEXT[i];
                    FORE_C[i] = OFORE_C[i];
                    BACK_C[i] = OBACK_C[i];
                    DIRTY[i] = true;
                }
            }
        }