changeset 150:e147c07e41cb

Add dmDrawBox3D() and dmFillBox3D().
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 06 Oct 2012 03:30:48 +0300
parents c2bf01e180a3
children 8708b0354eb8
files dmgfx.c dmlib.h
diffstat 2 files changed, 16 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/dmgfx.c	Sat Oct 06 00:46:19 2012 +0300
+++ b/dmgfx.c	Sat Oct 06 03:30:48 2012 +0300
@@ -109,7 +109,17 @@
 }
 
 
-void dmDrawBox3D(SDL_Surface *screen, int x0, int y0, int x1, int y1, Uint32 bgcol, Uint32 ucol, Uint32 dcol)
+void dmDrawBox3D(SDL_Surface *screen, int x0, int y0, int x1, int y1, Uint32 ucol, Uint32 dcol)
+{
+    dmDrawHLine(screen, x0    , x1 - 1, y0, ucol);
+    dmDrawHLine(screen, x0 + 1, x1    , y1, dcol);
+
+    dmDrawVLine(screen, y0    , y1 - 1, x0, ucol);
+    dmDrawVLine(screen, y0 + 1, y1    , x1, dcol);
+}
+
+
+void dmFillBox3D(SDL_Surface *screen, int x0, int y0, int x1, int y1, Uint32 bgcol, Uint32 ucol, Uint32 dcol)
 {
     SDL_Rect rc;
 
@@ -119,9 +129,5 @@
     rc.h = y1 - y0 - 1;
     SDL_FillRect(screen, &rc, bgcol);
 
-    dmDrawHLine(screen, x0    , x1 - 1, y0, ucol);
-    dmDrawHLine(screen, x0 + 1, x1    , y1, dcol);
-
-    dmDrawVLine(screen, y0    , y1 - 1, x0, ucol);
-    dmDrawVLine(screen, y0 + 1, y1    , x1, dcol);
+    dmDrawBox3D(screen, x0, y0, x1, y1, ucol, dcol);
 }
--- a/dmlib.h	Sat Oct 06 00:46:19 2012 +0300
+++ b/dmlib.h	Sat Oct 06 03:30:48 2012 +0300
@@ -295,7 +295,10 @@
 void       dmFillRect(SDL_Surface *screen, int x0, int y0, int x1, int y1, const Uint32 col);
 void       dmDrawHLine(SDL_Surface *screen, int x0, int x1, int yc, const Uint32 col);
 void       dmDrawVLine(SDL_Surface *screen, int y0, int y1, int xc, const Uint32 col);
-void       dmDrawBox3D(SDL_Surface *screen, int x0, int y0, int x1, int y1, Uint32 bgcol, Uint32 ucol, Uint32 dcol);
+
+void       dmDrawBox3D(SDL_Surface *screen, int x0, int y0, int x1, int y1, Uint32 ucol, Uint32 dcol);
+void       dmFillBox3D(SDL_Surface *screen, int x0, int y0, int x1, int y1, Uint32 bgcol, Uint32 ucol, Uint32 dcol);
+
 
 static inline void dmClearSurface(SDL_Surface *screen, const Uint32 col)
 {