diff --git a/.gitignore b/.gitignore
index cb14a6d..d361258 100644
--- a/.gitignore
+++ b/.gitignore
@@ -30,3 +30,4 @@ thirdparty/libpng-1.6.37/.deps/
capture/
*~
+*.user
diff --git a/master.pro b/master.pro
new file mode 100644
index 0000000..78ac7da
--- /dev/null
+++ b/master.pro
@@ -0,0 +1,40 @@
+#
+# Roo/E, the Kangaroo Punch Portable GUI Toolkit
+# Copyright (C) 2022 Scott Duensing
+#
+# http://kangaroopunch.com
+#
+#
+# This file is part of Roo/E.
+#
+# Roo/E is free software: you can redistribute it and/or modify it under the
+# terms of the GNU Affero General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option)
+# any later version.
+#
+# Roo/E is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Roo/E. If not, see .
+#
+
+
+TEMPLATE = subdirs
+CONFIG *= ORDERED
+
+SUBDIRS = \
+ roo-e \
+ test
+
+OTHER_FILES = \
+ .gitattributes \
+ .gitignore \
+ agpl-3.0.txt \
+ LICENSE \
+ build.sh \
+ Makefile.djgpp \
+ test.sh \
+ test.conf
diff --git a/roo-e/roo-e.pro b/roo-e/roo-e.pro
index 0878924..e38466c 100644
--- a/roo-e/roo-e.pro
+++ b/roo-e/roo-e.pro
@@ -22,11 +22,14 @@
#
-TEMPLATE = app
-CONFIG -= app_bundle
-CONFIG -= qt
-CONFIG += console
-CONFIG += c99
+TEMPLATE = lib
+CONFIG -= \
+ app_bundle \
+ qt
+CONFIG += \
+ console \
+ c99 \
+ staticlib
CONFIG += BACKEND_SDL2
#CONFIG += BACKEND_DJGPP
@@ -87,13 +90,9 @@ SOURCES += \
src/gui/widgets/scroll.c \
src/gui/widgets/vscroll.c \
src/gui/wmwindow.c \
- src/main.c \
src/platform/djgpp.c \
src/platform/sdl2.c
-OTHER_FILES += \
- $$PWD/../LICENSE
-
BACKEND_SDL2 {
DEFINES += BACKEND_SDL2
LIBS += \
@@ -102,10 +101,5 @@ BACKEND_SDL2 {
BACKEND_DJGPP {
DEFINES += BACKEND_DJGPP
- OTHER_FILES += \
- $$PWD/../build.sh \
- $$PWD/../Makefile.djgpp \
- $$PWD/../test.sh \
- $$PWD/../test.conf
}
diff --git a/roo-e/src/gui/widgets/frame.c b/roo-e/src/gui/widgets/frame.c
index 47e39ef..604dd45 100644
--- a/roo-e/src/gui/widgets/frame.c
+++ b/roo-e/src/gui/widgets/frame.c
@@ -118,17 +118,6 @@ static void framePaint(struct WidgetS *widget, ...) {
SurfaceT *t = surfaceGet();
PointT o;
PointT w;
- uint16_t x;
- uint16_t x2;
- uint16_t y;
- uint16_t i;
- unsigned char ul;
- unsigned char ur;
- unsigned char ll;
- unsigned char lr;
- unsigned char h;
- unsigned char v;
- unsigned char s[2];
if (widgetDirtyGet(widget)) {
widgetDirtySet(widget, 0);
@@ -140,66 +129,13 @@ static void framePaint(struct WidgetS *widget, ...) {
} else {
w.x = fontWidthGet(f->font);
w.y = fontHeightGet(f->font);
- if (f->flags & FRAME_SINGLE) {
- // Single line frame.
- ul = 218;
- ur = 191;
- ll = 192;
- lr = 217;
- h = 196;
- v = 179;
- } else {
- // Double line frame.
- ul = 201;
- ur = 187;
- ll = 200;
- lr = 188;
- h = 205;
- v = 186;
- }
-
- fontColorSet(GUI_BLACK, GUI_LIGHTGRAY);
- fontModsEnabledSet(1);
- s[1] = 0;
-
- // Top line.
- x = f->base.r.x;
- y = f->base.r.y;
- s[0] = ul;
- fontRender((char *)s, x, y);
- x += w.x;
- s[0] = h;
- for (i=0; ichars.x - 2; i++) {
- fontRender((char *)s, x, y);
- x += w.x;
- }
- x2 = x;
- s[0] = ur;
- fontRender((char *)s, x, y);
- // Title (this incurs some overdraw).
- if (f->title) {
- fontRender(f->title, f->base.r.x + (w.x * 2), y);
- }
- // Middle lines.
- x = f->base.r.x;
- y += w.y;
- s[0] = v;
- for (i=0; ichars.y - 2; i++) {
- fontRender((char *)s, x, y);
- fontRender((char *)s, x2, y);
- y += w.y;
- }
- // Bottom line.
- s[0] = ll;
- fontRender((char *)s, x, y);
- x += w.x;
- s[0] = h;
- for (i=0; ichars.x - 2; i++) {
- fontRender((char *)s, x, y);
- x += w.x;
- }
- s[0] = lr;
- fontRender((char *)s, x, y);
+ surfaceBoxHighlight(
+ f->base.r.x + (w.x * 0.5), f->base.r.y + (w.y * 0.5),
+ f->base.r.x + f->base.r.w - (w.x * 0.5), f->base.r.y + f->base.r.h - (w.y * 0.5),
+ (f->flags & FRAME_RAISED) ? GUI_WHITE : GUI_BLACK,
+ (f->flags & FRAME_RAISED) ? GUI_BLACK : GUI_WHITE
+ );
+ if (f->title) fontRender(f->title, f->base.r.x + (w.x * 2), f->base.r.y);
}
// Move the contents to 0,0 to draw it into it's own surface.
diff --git a/roo-e/src/gui/widgets/frame.h b/roo-e/src/gui/widgets/frame.h
index 8bafb35..b707c01 100644
--- a/roo-e/src/gui/widgets/frame.h
+++ b/roo-e/src/gui/widgets/frame.h
@@ -30,10 +30,10 @@
#include "../gui.h"
-#define FRAME_NONE 0
-#define FRAME_SINGLE 1
-#define FRAME_DOUBLE 2
-#define FRAME_FONT 4 // User will provide font to use.
+#define FRAME_NONE 0
+#define FRAME_RAISED 1
+#define FRAME_DROPPED 2
+#define FRAME_FONT 4 // User will provide font to use.
typedef struct FrameS {
diff --git a/roo-e/src/platform/sdl2.c b/roo-e/src/platform/sdl2.c
index cb7f5ef..12b8804 100644
--- a/roo-e/src/platform/sdl2.c
+++ b/roo-e/src/platform/sdl2.c
@@ -132,7 +132,7 @@ void platformShutdown(void) {
uint8_t platformStartup(int16_t width, int16_t height, int16_t depth) {
- SDL_PixelFormatEnum pixelFormat;
+ SDL_PixelFormatEnum pixelFormat = SDL_PIXELFORMAT_ARGB8888;
(void)depth;
diff --git a/roo-e/src/main.c b/test/src/main.c
similarity index 84%
rename from roo-e/src/main.c
rename to test/src/main.c
index 0a52515..68d8e6b 100644
--- a/roo-e/src/main.c
+++ b/test/src/main.c
@@ -36,18 +36,17 @@ int main(int argc, char *argv[]) {
RadioT *r = NULL;
FrameT *f = NULL;
- // frame
// layout
- // listbox
+ // canvas
+ // timer
// textbox
+ // listbox
// up/down
// terminal
- // timer
// msgbox
-
(void)argc;
memoryStartup(argv[0]);
@@ -69,7 +68,7 @@ int main(int argc, char *argv[]) {
c = checkboxCreate("Checkbox", 0);
widgetAdd(W(w), 20, 80, W(c));
- f = frameCreate("Frame", 310, 60, FRAME_SINGLE);
+ f = frameCreate("Frame", 310, 90, FRAME_DROPPED);
widgetAdd(W(w), 20, 110, W(f));
r = radioCreate("Radio 1", 0, 1);
@@ -79,21 +78,12 @@ int main(int argc, char *argv[]) {
r = radioCreate("Radio 3", 0, 0);
widgetAdd(W(f), 200, 5, W(r));
- /*
- r = radioCreate("Radio 1", 0, 1);
- widgetAdd(W(w), 20, 110, W(r));
- r = radioCreate("Radio 2", 0, 0);
- widgetAdd(W(w), 120, 110, W(r));
- r = radioCreate("Radio 3", 0, 0);
- widgetAdd(W(w), 220, 110, W(r));
-
r = radioCreate("Radio A", 1, 0);
- widgetAdd(W(w), 20, 140, W(r));
+ widgetAdd(W(f), 0, 35, W(r));
r = radioCreate("Radio B", 1, 1);
- widgetAdd(W(w), 120, 140, W(r));
+ widgetAdd(W(f), 100, 35, W(r));
r = radioCreate("Radio C", 1, 0);
- widgetAdd(W(w), 220, 140, W(r));
- */
+ widgetAdd(W(f), 200, 35, W(r));
}
guiRun();
guiShutdown();
diff --git a/test/test.pro b/test/test.pro
new file mode 100644
index 0000000..c7df217
--- /dev/null
+++ b/test/test.pro
@@ -0,0 +1,45 @@
+#
+# Roo/E, the Kangaroo Punch Portable GUI Toolkit
+# Copyright (C) 2022 Scott Duensing
+#
+# http://kangaroopunch.com
+#
+#
+# This file is part of Roo/E.
+#
+# Roo/E is free software: you can redistribute it and/or modify it under the
+# terms of the GNU Affero General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option)
+# any later version.
+#
+# Roo/E is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Roo/E. If not, see .
+#
+
+
+TEMPLATE = app
+CONFIG -= \
+ app_bundle \
+ qt
+CONFIG += \
+ console \
+ c99
+
+DESTDIR = $$OUT_PWD/bin
+
+INCLUDEPATH += \
+ $$PWD/../roo-e/src \
+ $$PWD/../shared \
+ $$PWD/src
+
+SOURCES += \
+ src/main.c
+
+LIBS += \
+ $$PWD/../build-master-debug/roo-e/bin/libroo-e.a \
+ -lSDL2