Results 1 to 3 of 3

Thread: Is there a function to draw an unfilled rectangle

  1. #1

    Is there a function to draw an unfilled rectangle

    Using SDL, is there a function to draw an unfilled rectangle ? The areas that my sprites can walk are defined by rectangles and it would be a handy debug solution to draw these rectangles on the screen. I can then see if I have defined the areas correctly and that the sprites are allowed in the correct areas. If there isn't an appropriate command, does anyone have a code snippet to draw a rect line by line ?

  2. #2

    Is there a function to draw an unfilled rectangle

    hi guy... try this...

    //Top Line
    rect.x = left;
    rect.y = top;
    rect.w = width;
    rect.h = 1;

    //Left line
    rect.x = left;
    rect.y = top;
    rect.w = 1;
    rect.h = height;

    //Bottom line
    rect.x = left;
    rect.y = height;
    rect.w = width;
    rect.h = 1;

    //Right line
    rect.x = width;
    rect.y = top;
    rect.w = 1;
    rect.h = height;

  3. #3

    Is there a function to draw an unfilled rectangle

    I've found the "DrawLine" function in the sdlutils.pas file and I've used this to manually draw the rectangle. It may be a good idea to add this function to the pas file for others to use.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •