Improved performance. Now tolerable on a 486/66.

This commit is contained in:
Scott Duensing 2024-04-15 18:55:17 -05:00
parent 272978b9ad
commit c0d867d11e
14 changed files with 421 additions and 648 deletions

View file

@ -33,7 +33,7 @@ INSTALL = install
DEBUG = -g
## CHANGE THIS ##
TARGET = roo-e
TARGET = roo_e
SRCDIR = .
OBJDIR = obj
BINDIR = bin
@ -41,7 +41,7 @@ BINDIR = bin
# CFLAGS, LDFLAGS, CPPFLAGS, PREFIX can be overriden on CLI
CFLAGS := $(DEBUG)
CFLAGS += -I$(SRCDIR)/shared -I$(SRCDIR)/roo-e/src
CFLAGS += -I$(SRCDIR)/shared -I$(SRCDIR)/roo_e/src
CPPFLAGS :=
LDFLAGS :=
LDLIBS :=
@ -78,9 +78,8 @@ ALL_LDLIBS := $(LDLIBS) -lc
# Source, Binaries, Dependencies
SRC := $(shell find $(SRCDIR)/roo-e -type f -name '*.c')
SRC += $(shell find $(SRCDIR)/shared -type f -name '*.c')
SRC += $(shell find $(SRCDIR)/test -type f -name '*.c')
SRC := $(shell find $(SRCDIR)/roo_e/src -type f -name '*.c')
SRC += $(shell find $(SRCDIR)/test/src -type f -name '*.c')
OBJ := $(patsubst $(SRCDIR)/%,$(OBJDIR)/%,$(SRC:.c=.o))
DEP := $(OBJ:.o=.d)
BIN := $(BINDIR)/$(TARGET)

View file

@ -1,4 +1,4 @@
#!/bin/bash -e
#!/bin/bash -ex
#
# Roo/E, the Kangaroo Punch Portable GUI Toolkit
@ -24,21 +24,21 @@
#
# This requires DJGPP for Linux in /opt/cross/djgpp
#
# See: https://github.com/andrewwutw/build-djgpp
# This requires Toolchains from:
# https://skunkworks.kangaroopunch.com/skunkworks/toolchains
[[ -d obj ]] && rm -rf obj
mkdir -p \
obj/shared/thirdparty/memwatch \
obj/roo-e/src/platform \
obj/roo-e/src/gui/widgets \
obj/roo_e/src/thirdparty/memwatch \
obj/roo_e/src/platform \
obj/roo_e/src/gui/widgets \
obj/test/src
source /opt/cross/djgpp/setenv
#source <(../toolchains/toolchains.sh use x86 dos)
source ../toolchains/x-tools/djgpp/setenv
make -f Makefile.djgpp
[[ -f bin/roo-e ]] && rm bin/roo-e
[[ -f bin/grx ]] && rm bin/grx
[[ -f bin/roo_e ]] && rm bin/roo_e
[[ -f bin/grx ]] && rm bin/grx

View file

@ -1,45 +0,0 @@
#
# Kangaroo Punch MultiPlayer Game Server Mark II
# Copyright (C) 2020-2021 Scott Duensing
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
TEMPLATE = app
CONFIG -= qt
CONFIG += console
DESTDIR = $$OUT_PWD/bin
SHARED = $$PWD/../shared
CLIENT = $$PWD/../client/src
SYSTEM = $$CLIENT/system
GUI = $$CLIENT/gui
DEFINES += FONT_DEBUGGING
INCLUDEPATH += \
$$SHARED \
$$SHARED/thirdparty \
$$CLIENT \
$$SYSTEM \
$$GUI
HEADERS = \
$$SHARED/stddclmr.h \
$$SHARED/thirdparty/memwatch/memwatch.h \
$$SHARED/thirdparty/stb_image.h
SOURCES = \
$$SHARED/thirdparty/memwatch/memwatch.c \
src/main.c

View file

@ -1,40 +0,0 @@
#
# 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

View file

@ -1,105 +0,0 @@
#
# 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 = lib
CONFIG -= \
app_bundle \
qt
CONFIG += \
console \
c99 \
staticlib
CONFIG += BACKEND_SDL2
#CONFIG += BACKEND_DJGPP
SHARED = $$PWD/../shared
DESTDIR = $$OUT_PWD/bin
INCLUDEPATH += \
$$PWD/src \
$$SHARED
HEADERS += \
$$SHARED/macros.h \
$$SHARED/array.h \
$$SHARED/memory.h \
$$SHARED/stddclmr.h \
$$SHARED/thirdparty/memwatch/memwatch.h \
$$SHARED/thirdparty/stb_ds.h \
$$SHARED/log.h \
$$SHARED/util.h \
src/gui/font.h \
src/gui/gui-all.h \
src/gui/gui.h \
src/gui/image.h \
src/gui/surface.h \
src/gui/widgets/button.h \
src/gui/widgets/checkbox.h \
src/gui/widgets/frame.h \
src/gui/widgets/label.h \
src/gui/widgets/picture.h \
src/gui/widgets/radio.h \
src/gui/widgets/hscroll.h \
src/gui/widgets/scroll.h \
src/gui/widgets/vscroll.h \
src/gui/wmwindow.h \
src/os.h \
src/platform/platform.h \
src/thirdparty/stb_image.h
SOURCES += \
$$SHARED/array.c \
$$SHARED/memory.c \
$$SHARED/thirdparty/memwatch/memwatch.c \
$$SHARED/log.c \
$$SHARED/util.c \
src/gui/font.c \
src/gui/gui.c \
src/gui/image.c \
src/gui/surface.c \
src/gui/widgets/button.c \
src/gui/widgets/checkbox.c \
src/gui/widgets/frame.c \
src/gui/widgets/label.c \
src/gui/widgets/picture.c \
src/gui/widgets/radio.c \
src/gui/widgets/hscroll.c \
src/gui/widgets/scroll.c \
src/gui/widgets/vscroll.c \
src/gui/wmwindow.c \
src/platform/djgpp.c \
src/platform/sdl2.c
BACKEND_SDL2 {
DEFINES += BACKEND_SDL2
LIBS += \
-lSDL2
}
BACKEND_DJGPP {
DEFINES += BACKEND_DJGPP
}

View file

@ -121,7 +121,10 @@ FontT *fontLoad(char *filename) {
return NULL;
}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-result"
fread(buffer, size, 1, in);
#pragma GCC diagnostic pop
fclose(in);
font = fontFromRAMLoad(buffer);

View file

@ -133,7 +133,10 @@ void guiShutdown(void) {
while (hmlen(_widgetCatalog) > 0) {
if (_widgetCatalog[0].value->unregister) _widgetCatalog[0].value->unregister(NULL);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-value"
hmdel(_widgetCatalog, _widgetCatalog[0].key);
#pragma GCC diagnostic pop
}
hmfree(_widgetCatalog);

View file

@ -413,12 +413,15 @@ SurfaceT *surfaceLoad(char *filename) {
if (in) {
NEW(SurfaceT, i);
if (!i) return NULL;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-result"
fread(&i->width, sizeof(uint16_t), 1, in);
fread(&i->height, sizeof(uint16_t), 1, in);
fread(&i->scanline, sizeof(size_t), 1, in);
fread(&i->bytes, sizeof(size_t), 1, in);
i->buffer.bits8 = (uint8_t *)malloc(i->bytes);
fread(i->buffer.bits8, i->bytes, 1, in);
#pragma GCC diagnostic pop
fclose(in);
}
}

View file

@ -68,7 +68,7 @@ CheckboxT *checkboxCreate(char *label, uint8_t value, ...) {
memset(c, 0, sizeof(CheckboxT));
c->value = value;
c->label = labelCreate(LABEL_ALIGN_LEFT, f, label);
c->label = labelCreate(LABEL_ALIGN_LEFT, f, label); // Gets attached to widget tree during paint.
if (!c->label) {
DEL(c);
return NULL;

View file

@ -515,8 +515,6 @@ void windowMove(WindowT *w, uint16_t x, uint16_t y) {
static void windowPaint(struct WidgetS *widget, ...) {
int16_t x = 0;
int16_t y;
int16_t px;
int16_t py;
int16_t xi;
int16_t yi;
int16_t xc;
@ -676,10 +674,6 @@ void wmRender(void) {
DamageListT **damageList = NULL;
DamageListT *damageItem = NULL;
// ***TODO*** We still calculate the desktop in the damage list below.
// There's some odd off-by-one when rendering that needs fixed. For now
// we just draw the desktop and then window contents.
// Update all minimized windows.
surfaceSet(__guiBackBuffer);
for (i=0; i<arrlen(_windowList); i++) {
@ -693,13 +687,11 @@ void wmRender(void) {
widget->reg->paint(widget, WINDOW_PAINT_NORMAL);
}
surfaceSet(__guiBackBuffer);
// This is global so we can click on them later.
_iconCount = 0;
// Draw the desktop.
surfaceSet(__guiBackBuffer);
surfaceClear(GUI_CYAN);
// Do we have windows?
if (arrlen(_windowList) > 0) {
@ -928,6 +920,12 @@ void wmRender(void) {
}
} while (found == 1);
// ***TODO*** Something is off by one somewhere. The last column
// and row are not being rendered / blitted.
// Hack around it for now.
surfaceLineH(0, videoDisplayWidthGet() - 1, videoDisplayHeightGet() - 1, GUI_BLACK);
surfaceLineV(videoDisplayWidthGet() - 1, 0, videoDisplayHeightGet() - 1, GUI_BLACK);
// Draw the damage list.
i = 1;
for (k=0; k<arrlen(damageList); k++) {
@ -960,7 +958,7 @@ void wmRender(void) {
}
} else {
// Desktop.
//surfaceBoxFilled(damageList[k]->rect.x, damageList[k]->rect.y, damageList[k]->rect.x2, damageList[k]->rect.y2, GUI_CYAN);
surfaceBoxFilled(damageList[k]->rect.x, damageList[k]->rect.y, damageList[k]->rect.x2 - 1, damageList[k]->rect.y2 - 1, GUI_CYAN);
}
/*
@ -1003,7 +1001,6 @@ void wmUpdate(EventT *event) {
int16_t x2;
int16_t y2;
uint8_t onResize = 0;
WidgetT *widget;
WidgetT *widgetOver = NULL;
WindowT *win = NULL;
ClickRawInputT rawEvent = { 0 };

View file

@ -829,6 +829,8 @@ void* mwUnmark( void *p, const char *file, unsigned line ) {
** Abort/Retry/Ignore handlers
***********************************************************************/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-result"
static int mwARI( const char *estr ) {
char inbuf[81];
int c;
@ -843,6 +845,7 @@ static int mwARI( const char *estr ) {
if( c == 'I' || c == 'i' ) return MW_ARI_IGNORE;
return MW_ARI_ABORT;
}
#pragma GCC diagnostic pop
/* standard ARI handler (exported) */
int mwAriHandler( const char *estr ) {

File diff suppressed because it is too large Load diff

View file

@ -52,11 +52,11 @@ int main(int argc, char *argv[]) {
memoryStartup(argv[0]);
logOpenByHandle(memoryLogHandleGet());
if (guiStartup(800, 600, 16) == SUCCESS) {
if (guiStartup(800, 600, 8) == SUCCESS) {
for (i=1; i<4; i++) {
sprintf(title, "Testing %d", i);
w = windowCreate(i * 50, i * 50, 600, 400, title, WIN_STANDARD, 640, 480);
w = windowCreate(i * 50, i * 50, 500, 300, title, WIN_STANDARD, 640, 480);
l = labelCreate(LABEL_ALIGN_LEFT, __guiFontVGA8x16, "Label");
labelColorSet(l, __guiBaseColors[i], GUI_BLACK);

View file

@ -1,45 +0,0 @@
#
# 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