View Full Version : Is there a function to draw an unfilled rectangle
ianatwork
31-10-2008, 11:09 AM
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 ?
vicvegax
31-10-2008, 12:09 PM
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;
ianatwork
31-10-2008, 01:42 PM
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.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.