Project split into static library and test program.
This commit is contained in:
parent
353ebfb68e
commit
a81d3406e0
8 changed files with 113 additions and 107 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -30,3 +30,4 @@ thirdparty/libpng-1.6.37/.deps/
|
||||||
capture/
|
capture/
|
||||||
|
|
||||||
*~
|
*~
|
||||||
|
*.user
|
||||||
|
|
40
master.pro
Normal file
40
master.pro
Normal file
|
@ -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 <https://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
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
|
|
@ -22,11 +22,14 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
TEMPLATE = app
|
TEMPLATE = lib
|
||||||
CONFIG -= app_bundle
|
CONFIG -= \
|
||||||
CONFIG -= qt
|
app_bundle \
|
||||||
CONFIG += console
|
qt
|
||||||
CONFIG += c99
|
CONFIG += \
|
||||||
|
console \
|
||||||
|
c99 \
|
||||||
|
staticlib
|
||||||
|
|
||||||
CONFIG += BACKEND_SDL2
|
CONFIG += BACKEND_SDL2
|
||||||
#CONFIG += BACKEND_DJGPP
|
#CONFIG += BACKEND_DJGPP
|
||||||
|
@ -87,13 +90,9 @@ SOURCES += \
|
||||||
src/gui/widgets/scroll.c \
|
src/gui/widgets/scroll.c \
|
||||||
src/gui/widgets/vscroll.c \
|
src/gui/widgets/vscroll.c \
|
||||||
src/gui/wmwindow.c \
|
src/gui/wmwindow.c \
|
||||||
src/main.c \
|
|
||||||
src/platform/djgpp.c \
|
src/platform/djgpp.c \
|
||||||
src/platform/sdl2.c
|
src/platform/sdl2.c
|
||||||
|
|
||||||
OTHER_FILES += \
|
|
||||||
$$PWD/../LICENSE
|
|
||||||
|
|
||||||
BACKEND_SDL2 {
|
BACKEND_SDL2 {
|
||||||
DEFINES += BACKEND_SDL2
|
DEFINES += BACKEND_SDL2
|
||||||
LIBS += \
|
LIBS += \
|
||||||
|
@ -102,10 +101,5 @@ BACKEND_SDL2 {
|
||||||
|
|
||||||
BACKEND_DJGPP {
|
BACKEND_DJGPP {
|
||||||
DEFINES += BACKEND_DJGPP
|
DEFINES += BACKEND_DJGPP
|
||||||
OTHER_FILES += \
|
|
||||||
$$PWD/../build.sh \
|
|
||||||
$$PWD/../Makefile.djgpp \
|
|
||||||
$$PWD/../test.sh \
|
|
||||||
$$PWD/../test.conf
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -118,17 +118,6 @@ static void framePaint(struct WidgetS *widget, ...) {
|
||||||
SurfaceT *t = surfaceGet();
|
SurfaceT *t = surfaceGet();
|
||||||
PointT o;
|
PointT o;
|
||||||
PointT w;
|
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)) {
|
if (widgetDirtyGet(widget)) {
|
||||||
widgetDirtySet(widget, 0);
|
widgetDirtySet(widget, 0);
|
||||||
|
@ -140,66 +129,13 @@ static void framePaint(struct WidgetS *widget, ...) {
|
||||||
} else {
|
} else {
|
||||||
w.x = fontWidthGet(f->font);
|
w.x = fontWidthGet(f->font);
|
||||||
w.y = fontHeightGet(f->font);
|
w.y = fontHeightGet(f->font);
|
||||||
if (f->flags & FRAME_SINGLE) {
|
surfaceBoxHighlight(
|
||||||
// Single line frame.
|
f->base.r.x + (w.x * 0.5), f->base.r.y + (w.y * 0.5),
|
||||||
ul = 218;
|
f->base.r.x + f->base.r.w - (w.x * 0.5), f->base.r.y + f->base.r.h - (w.y * 0.5),
|
||||||
ur = 191;
|
(f->flags & FRAME_RAISED) ? GUI_WHITE : GUI_BLACK,
|
||||||
ll = 192;
|
(f->flags & FRAME_RAISED) ? GUI_BLACK : GUI_WHITE
|
||||||
lr = 217;
|
);
|
||||||
h = 196;
|
if (f->title) fontRender(f->title, f->base.r.x + (w.x * 2), f->base.r.y);
|
||||||
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; i<f->chars.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; i<f->chars.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; i<f->chars.x - 2; i++) {
|
|
||||||
fontRender((char *)s, x, y);
|
|
||||||
x += w.x;
|
|
||||||
}
|
|
||||||
s[0] = lr;
|
|
||||||
fontRender((char *)s, x, y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move the contents to 0,0 to draw it into it's own surface.
|
// Move the contents to 0,0 to draw it into it's own surface.
|
||||||
|
|
|
@ -30,10 +30,10 @@
|
||||||
#include "../gui.h"
|
#include "../gui.h"
|
||||||
|
|
||||||
|
|
||||||
#define FRAME_NONE 0
|
#define FRAME_NONE 0
|
||||||
#define FRAME_SINGLE 1
|
#define FRAME_RAISED 1
|
||||||
#define FRAME_DOUBLE 2
|
#define FRAME_DROPPED 2
|
||||||
#define FRAME_FONT 4 // User will provide font to use.
|
#define FRAME_FONT 4 // User will provide font to use.
|
||||||
|
|
||||||
|
|
||||||
typedef struct FrameS {
|
typedef struct FrameS {
|
||||||
|
|
|
@ -132,7 +132,7 @@ void platformShutdown(void) {
|
||||||
|
|
||||||
|
|
||||||
uint8_t platformStartup(int16_t width, int16_t height, int16_t depth) {
|
uint8_t platformStartup(int16_t width, int16_t height, int16_t depth) {
|
||||||
SDL_PixelFormatEnum pixelFormat;
|
SDL_PixelFormatEnum pixelFormat = SDL_PIXELFORMAT_ARGB8888;
|
||||||
|
|
||||||
(void)depth;
|
(void)depth;
|
||||||
|
|
||||||
|
|
|
@ -36,18 +36,17 @@ int main(int argc, char *argv[]) {
|
||||||
RadioT *r = NULL;
|
RadioT *r = NULL;
|
||||||
FrameT *f = NULL;
|
FrameT *f = NULL;
|
||||||
|
|
||||||
// frame
|
|
||||||
// layout
|
// layout
|
||||||
|
|
||||||
// listbox
|
// canvas
|
||||||
|
// timer
|
||||||
// textbox
|
// textbox
|
||||||
|
// listbox
|
||||||
// up/down
|
// up/down
|
||||||
// terminal
|
// terminal
|
||||||
// timer
|
|
||||||
|
|
||||||
// msgbox
|
// msgbox
|
||||||
|
|
||||||
|
|
||||||
(void)argc;
|
(void)argc;
|
||||||
|
|
||||||
memoryStartup(argv[0]);
|
memoryStartup(argv[0]);
|
||||||
|
@ -69,7 +68,7 @@ int main(int argc, char *argv[]) {
|
||||||
c = checkboxCreate("Checkbox", 0);
|
c = checkboxCreate("Checkbox", 0);
|
||||||
widgetAdd(W(w), 20, 80, W(c));
|
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));
|
widgetAdd(W(w), 20, 110, W(f));
|
||||||
|
|
||||||
r = radioCreate("Radio 1", 0, 1);
|
r = radioCreate("Radio 1", 0, 1);
|
||||||
|
@ -79,21 +78,12 @@ int main(int argc, char *argv[]) {
|
||||||
r = radioCreate("Radio 3", 0, 0);
|
r = radioCreate("Radio 3", 0, 0);
|
||||||
widgetAdd(W(f), 200, 5, W(r));
|
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);
|
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);
|
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);
|
r = radioCreate("Radio C", 1, 0);
|
||||||
widgetAdd(W(w), 220, 140, W(r));
|
widgetAdd(W(f), 200, 35, W(r));
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
guiRun();
|
guiRun();
|
||||||
guiShutdown();
|
guiShutdown();
|
45
test/test.pro
Normal file
45
test/test.pro
Normal file
|
@ -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 <https://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
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
|
Loading…
Add table
Reference in a new issue