mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
Draw rectangles with lines.
Change-Id: I257ea485e67d2cc1c2ad5f9405fe507f3f4d00f1
This commit is contained in:
@@ -46,21 +46,13 @@ static void clear_trig_menu() {
|
||||
}
|
||||
|
||||
static void print_trig_menu() {
|
||||
{
|
||||
KDRect r;
|
||||
r.x = SCREEN_WIDTH / 4 - 1;
|
||||
r.y = SCREEN_HEIGHT / 4 - 1;
|
||||
r.width = SCREEN_WIDTH / 2 + 2;
|
||||
r.height = SCREEN_HEIGHT / 2 + 2;
|
||||
KDFillRect(r, 0xFF);
|
||||
}
|
||||
{
|
||||
KDRect r;
|
||||
r.x = SCREEN_WIDTH / 4;
|
||||
r.y = SCREEN_HEIGHT / 4;
|
||||
r.width = SCREEN_WIDTH / 2;
|
||||
r.height = SCREEN_HEIGHT / 2;
|
||||
KDFillRect(r, 0x00);
|
||||
KDDrawRect(r, 0xff);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,5 +24,6 @@ typedef struct {
|
||||
extern KDRect KDRectZero;
|
||||
|
||||
void KDFillRect(KDRect rect, KDColor color);
|
||||
void KDDrawRect(KDRect rect, KDColor color);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -12,3 +12,27 @@ void KDFillRect(KDRect rect, KDColor color) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void KDDrawRect(KDRect rect, KDColor color) {
|
||||
KDPoint p1, p2;
|
||||
p1.x = rect.x;
|
||||
p1.y = rect.y;
|
||||
p2.x = rect.x;
|
||||
p2.y = rect.y + rect.height;
|
||||
for (int i = 0; i<rect.width; i++) {
|
||||
KDSetPixel(p1, color);
|
||||
KDSetPixel(p2, color);
|
||||
p1.x++;
|
||||
p2.x++;
|
||||
}
|
||||
p1.x = rect.x;
|
||||
p1.y = rect.y;
|
||||
p2.x = rect.x + rect.width;
|
||||
p2.y = rect.y;
|
||||
for (int i = 0; i<rect.height; i++) {
|
||||
KDSetPixel(p1, color);
|
||||
KDSetPixel(p2, color);
|
||||
p1.y++;
|
||||
p2.y++;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user