diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..cd4890f
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,167 @@
+#
+# 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 .
+#
+
+
+cmake_minimum_required(VERSION 3.12)
+
+
+project(roo_e LANGUAGES C)
+
+
+set(THIRDPARTY_HEADERS
+ memwatch/memwatch.h
+ stb_ds.h
+ stb_image.h
+)
+list(TRANSFORM THIRDPARTY_HEADERS PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/roo_e/src/thirdparty/")
+
+set(THIRDPARTY_SOURCE
+ memwatch/memwatch.c
+)
+list(TRANSFORM THIRDPARTY_SOURCE PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/roo_e/src/thirdparty/")
+
+
+set(PLATFORM_HEADERS
+ platform.h
+)
+list(TRANSFORM PLATFORM_HEADERS PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/roo_e/src/platform/")
+
+set(PLATFORM_SOURCE
+ djgpp.c
+ sdl2.c
+)
+list(TRANSFORM PLATFORM_SOURCE PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/roo_e/src/platform/")
+
+
+set(WIDGET_HEADERS
+ button.h
+ checkbox.h
+ frame.h
+ hscroll.h
+ label.h
+ picture.h
+ radio.h
+ scroll.h
+ vscroll.h
+)
+list(TRANSFORM WIDGET_HEADERS PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/roo_e/src/gui/widgets/")
+
+set(WIDGET_SOURCE
+ button.c
+ checkbox.c
+ frame.c
+ hscroll.c
+ label.c
+ picture.c
+ radio.c
+ scroll.c
+ vscroll.c
+)
+list(TRANSFORM WIDGET_SOURCE PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/roo_e/src/gui/widgets/")
+
+
+set(GUI_HEADERS
+ font.h
+ gui-all.h
+ gui.h
+ image.h
+ surface.h
+ wmwindow.h
+)
+list(TRANSFORM GUI_HEADERS PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/roo_e/src/gui/")
+
+set(GUI_SOURCE
+ font.c
+ gui.c
+ image.c
+ surface.c
+ wmwindow.c
+)
+list(TRANSFORM GUI_SOURCE PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/roo_e/src/gui/")
+
+
+set(ROO_E_HEADERS
+ array.h
+ log.h
+ macros.h
+ memory.h
+ os.h
+ stddclmr.h
+ util.h
+)
+list(TRANSFORM ROO_E_HEADERS PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/roo_e/src/")
+
+set(ROO_E_SOURCE
+ array.c
+ log.c
+ memory.c
+ util.c
+)
+list(TRANSFORM ROO_E_SOURCE PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/roo_e/src/")
+
+
+set(TEST_HEADERS
+)
+list(TRANSFORM TEST_HEADERS PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/test/src/")
+
+set(TEST_SOURCE
+ main.c
+)
+list(TRANSFORM TEST_SOURCE PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/test/src/")
+
+
+add_executable(${CMAKE_PROJECT_NAME}
+ ${THIRDPARTY_HEADERS}
+ ${THIRDPARTY_SOURCE}
+ ${PLATFORM_HEADERS}
+ ${PLATFORM_SOURCE}
+ ${WIDGET_HEADERS}
+ ${WIDGET_SOURCE}
+ ${GUI_HEADERS}
+ ${GUI_SOURCE}
+ ${ROO_E_HEADERS}
+ ${ROO_E_SOURCE}
+ ${TEST_HEADERS}
+ ${TEST_SOURCE}
+)
+
+
+add_compile_definitions(
+ _REENTRANT
+ BACKEND_SDL2
+ INCLUDE_FONT_CONVERTER="../roo_e/font/in"
+ INCLUDE_IMAGE_FINDER="../roo_e/roo_e/assets"
+)
+
+
+target_include_directories(${CMAKE_PROJECT_NAME} PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/roo_e/src
+ ${CMAKE_CURRENT_SOURCE_DIR}/roo_e/src/thirdparty
+ /usr/include/SDL2
+)
+
+
+target_link_libraries(${CMAKE_PROJECT_NAME}
+ -lSDL2
+ -lm
+)
diff --git a/font/font.pro b/font/font.pro
new file mode 100644
index 0000000..6921f3b
--- /dev/null
+++ b/font/font.pro
@@ -0,0 +1,45 @@
+#
+# 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 .
+#
+
+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
diff --git a/font/in/vga4x8.png b/font/in/vga4x8.png
new file mode 100644
index 0000000..579fd48
--- /dev/null
+++ b/font/in/vga4x8.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:b4c2a6fe844525cdd4abddd2c7aa2d6d73ec667dd82aee10e8a9c62e2f367d8b
+size 18029
diff --git a/font/in/vga8x14.png b/font/in/vga8x14.png
new file mode 100644
index 0000000..a52f226
--- /dev/null
+++ b/font/in/vga8x14.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:5330f2c589cd0094131d7b686947fbc1da0a6c3df4388a09f3bb77ba57d53a0c
+size 22459
diff --git a/font/in/vga8x16.png b/font/in/vga8x16.png
new file mode 100644
index 0000000..f49a9d9
--- /dev/null
+++ b/font/in/vga8x16.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:170c659c489d3cd1d141dbf12ae37bbf40975941ced925ce6e50817128e5bf97
+size 20257
diff --git a/font/in/vga8x8.png b/font/in/vga8x8.png
new file mode 100644
index 0000000..64e316d
--- /dev/null
+++ b/font/in/vga8x8.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:20b093388e649e7f0eb3c3ca143a592d00c89579b6390cac7bd86287be19bd48
+size 3512
diff --git a/font/src/main.c b/font/src/main.c
new file mode 100644
index 0000000..6af8741
--- /dev/null
+++ b/font/src/main.c
@@ -0,0 +1,94 @@
+/*
+ * 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 .
+ *
+ */
+
+
+#include
+
+#define MEMWATCH
+#include "memwatch/memwatch.h"
+
+#define STB_IMAGE_IMPLEMENTATION
+#define STBI_ONLY_PNG
+#include "stb_image.h"
+
+#include "stddclmr.h"
+
+
+void makeFont(char *source, char *target, int pixelsW, int pixelsH, int charsW, int charCount);
+
+
+void makeFont(char *source, char *target, int pixelsW, int pixelsH, int charsW, int charCount) {
+ unsigned char *font = NULL;
+ unsigned char data = 0;
+ FILE *out = NULL;
+ int bits = 0;
+ int x;
+ int y;
+ int n;
+ int w;
+ int h;
+
+ // Load font atlas from disk.
+ font = stbi_load(source, (int *)&w, (int *)&h, (int *)&n, 3);
+ if (!font) return;
+
+ // Create data file for font.
+ out = fopen(target, "wb");
+ if (!out) {
+ stbi_image_free(font);
+ return;
+ }
+
+ // Provide some metadata for enhancement later.
+ fputc(pixelsW, out); // Width of characters in pixels
+ fputc(pixelsH, out); // Height of characters in pixels
+ fputc(charsW, out); // Number of characters per row
+ fputc(charCount - 1, out); // Number of characters - 1
+
+ // Convert bitmap to actual bits.
+ for (y=0; y 7) {
+ bits = 0;
+ fputc(data, out);
+ }
+ }
+ }
+
+ fclose(out);
+
+ // Clean up.
+ stbi_image_free(font);
+}
+
+
+int main(int argc, char *argv[]) {
+ (void)argc;
+ (void)argv;
+
+ makeFont("/home/scott/code/kpmpgsmkii/font/in/vga4x8.png", "/home/scott/code/kpmpgsmkii/font/out/vga4x8.dat", 4, 8, 16, 256);
+ makeFont("/home/scott/code/kpmpgsmkii/font/in/vga8x8.png", "/home/scott/code/kpmpgsmkii/font/out/vga8x8.dat", 8, 8, 16, 256);
+ makeFont("/home/scott/code/kpmpgsmkii/font/in/vga8x14.png", "/home/scott/code/kpmpgsmkii/font/out/vga8x14.dat", 8, 14, 16, 256);
+ makeFont("/home/scott/code/kpmpgsmkii/font/in/vga8x16.png", "/home/scott/code/kpmpgsmkii/font/out/vga8x16.dat", 8, 16, 16, 256);
+
+ return 0;
+}
diff --git a/roo-e/roo-e.pro.user b/roo-e/roo-e.pro.user
deleted file mode 100644
index 73c0bdd..0000000
--- a/roo-e/roo-e.pro.user
+++ /dev/null
@@ -1,262 +0,0 @@
-
-
-
-
-
- EnvironmentId
- {b66758f8-0b3c-4017-8297-d2a3cceca9ca}
-
-
- ProjectExplorer.Project.ActiveTarget
- 0
-
-
- ProjectExplorer.Project.EditorSettings
-
- true
- false
- true
-
- Cpp
-
- CppGlobal
-
-
-
- QmlJS
-
- QmlJSGlobal
-
-
- 2
- UTF-8
- false
- 4
- false
- 80
- true
- true
- 1
- false
- true
- false
- 0
- true
- true
- 0
- 8
- true
- false
- 1
- true
- true
- true
- *.md, *.MD, Makefile
- true
- true
-
-
-
- ProjectExplorer.Project.PluginSettings
-
-
- true
- false
- true
- true
- true
- true
-
-
- 0
- true
-
- true
- Builtin.BuildSystem
-
- true
- true
- Builtin.DefaultTidyAndClazy
- 4
-
-
-
- true
-
-
-
-
- ProjectExplorer.Project.Target.0
-
- Desktop
- Desktop Qt 5.15.0 GCC 64bit
- Desktop Qt 5.15.0 GCC 64bit
- qt.qt5.5150.gcc_64_kit
- 0
- 0
- 0
-
- 0
- /home/scott/code/roo-e/build-roo-e-Desktop_Qt_5_15_0_GCC_64bit-Debug
- /home/scott/code/roo-e/build-roo-e-Desktop_Qt_5_15_0_GCC_64bit-Debug
-
-
- true
- QtProjectManager.QMakeBuildStep
- false
-
-
-
- true
- Qt4ProjectManager.MakeStep
-
- 2
- Build
- Build
- ProjectExplorer.BuildSteps.Build
-
-
-
- true
- Qt4ProjectManager.MakeStep
- clean
-
- 1
- Clean
- Clean
- ProjectExplorer.BuildSteps.Clean
-
- 2
- false
-
-
- Debug
- Qt4ProjectManager.Qt4BuildConfiguration
- 2
-
-
- /home/scott/code/roo-e/build-roo-e-Desktop_Qt_5_15_0_GCC_64bit-Release
- /home/scott/code/roo-e/build-roo-e-Desktop_Qt_5_15_0_GCC_64bit-Release
-
-
- true
- QtProjectManager.QMakeBuildStep
- false
-
-
-
- true
- Qt4ProjectManager.MakeStep
-
- 2
- Build
- Build
- ProjectExplorer.BuildSteps.Build
-
-
-
- true
- Qt4ProjectManager.MakeStep
- clean
-
- 1
- Clean
- Clean
- ProjectExplorer.BuildSteps.Clean
-
- 2
- false
-
-
- Release
- Qt4ProjectManager.Qt4BuildConfiguration
- 0
- 0
-
-
- 0
- /home/scott/code/roo-e/build-roo-e-Desktop_Qt_5_15_0_GCC_64bit-Profile
- /home/scott/code/roo-e/build-roo-e-Desktop_Qt_5_15_0_GCC_64bit-Profile
-
-
- true
- QtProjectManager.QMakeBuildStep
- false
-
-
-
- true
- Qt4ProjectManager.MakeStep
-
- 2
- Build
- Build
- ProjectExplorer.BuildSteps.Build
-
-
-
- true
- Qt4ProjectManager.MakeStep
- clean
-
- 1
- Clean
- Clean
- ProjectExplorer.BuildSteps.Clean
-
- 2
- false
-
-
- Profile
- Qt4ProjectManager.Qt4BuildConfiguration
- 0
- 0
- 0
-
- 3
-
-
- 0
- Deploy
- Deploy
- ProjectExplorer.BuildSteps.Deploy
-
- 1
-
- false
- ProjectExplorer.DefaultDeployConfiguration
-
- 1
-
- true
- true
- true
-
- 2
-
- Qt4ProjectManager.Qt4RunConfiguration:/home/scott/code/roo-e/roo-e/roo-e.pro
- /home/scott/code/roo-e/roo-e/roo-e.pro
- false
- true
- true
- false
- true
- /home/scott/code/roo-e/build-roo-e-Desktop_Qt_5_15_0_GCC_64bit-Debug/bin
-
- 1
-
-
-
- ProjectExplorer.Project.TargetCount
- 1
-
-
- ProjectExplorer.Project.Updater.FileVersion
- 22
-
-
- Version
- 22
-
-
diff --git a/roo-e/assets/mouse.png b/roo_e/assets/mouse.png
similarity index 100%
rename from roo-e/assets/mouse.png
rename to roo_e/assets/mouse.png
diff --git a/roo-e/assets/resize.png b/roo_e/assets/resize.png
similarity index 100%
rename from roo-e/assets/resize.png
rename to roo_e/assets/resize.png
diff --git a/roo-e/roo-e.pro b/roo_e/roo-e.pro
similarity index 100%
rename from roo-e/roo-e.pro
rename to roo_e/roo-e.pro
diff --git a/shared/array.c b/roo_e/src/array.c
similarity index 100%
rename from shared/array.c
rename to roo_e/src/array.c
diff --git a/shared/array.h b/roo_e/src/array.h
similarity index 100%
rename from shared/array.h
rename to roo_e/src/array.h
diff --git a/roo-e/src/gui/font.c b/roo_e/src/gui/font.c
similarity index 72%
rename from roo-e/src/gui/font.c
rename to roo_e/src/gui/font.c
index c5ae68c..90b3149 100644
--- a/roo-e/src/gui/font.c
+++ b/roo_e/src/gui/font.c
@@ -34,6 +34,11 @@ static ColorT _background = 0;
static uint8_t _allowMods = 1;
+#ifdef INCLUDE_FONT_CONVERTER
+void makeFont(char *target);
+#endif
+
+
void fontColorSet(ColorT foreground, ColorT background) {
_foreground = foreground;
_background = background;
@@ -58,6 +63,16 @@ FontT *fontFromRAMLoad(uint8_t *pointer) {
font->heightPixels = font->height * ((font->count + 1) / font->span); // Height of atlas in pixels
size = font->widthPixels * font->heightPixels / 8; // Bits required to store atlas
+ /*
+ logWrite("font->width %d\n", font->width);
+ logWrite("font->height %d\n", font->height);
+ logWrite("font->span %d\n", font->span);
+ logWrite("font->count %d\n", font->count);
+ logWrite("font->widthPixels %d\n", font->widthPixels);
+ logWrite("font->heightPixels %d\n", font->heightPixels);
+ logWrite("size %d\n\n", size);
+ */
+
font->bits = (uint8_t *)malloc(size);
if (!font->bits) {
DEL(font);
@@ -81,6 +96,18 @@ FontT *fontLoad(char *filename) {
uint8_t *buffer = NULL;
FontT *font = NULL;
+#ifdef INCLUDE_FONT_CONVERTER
+ // Do we need to convert this font?
+ in = fopen(filename, "rb");
+ if (in) {
+ // Nope.
+ fclose(in);
+ } else {
+ // Yes!
+ makeFont(filename);
+ }
+#endif
+
in = fopen(filename, "rb");
if (!in) return NULL;
@@ -217,8 +244,8 @@ void fontSet(FontT *font) {
void fontUnload(FontT **font) {
FontT *f = *font;
- free(f->bits);
- free(f);
+ DEL(f->bits);
+ DEL(f);
*font = NULL;
}
@@ -258,3 +285,81 @@ uint16_t fontWidthCharactersGet(char *string) {
uint16_t fontWidthGet(FontT *font) {
return font->width;
}
+
+
+#ifdef INCLUDE_FONT_CONVERTER
+#include "stb_image.h" // This is implemented in image.c
+void makeFont(char *target) {
+ char *source;
+ unsigned char *font = NULL;
+ unsigned char data = 0;
+ char *pngFile = NULL;
+ FILE *out = NULL;
+ int bits = 0;
+ int x;
+ int y;
+ int n;
+ int w;
+ int h;
+
+ int pixelsW;
+ int pixelsH;
+ int charsW = 16;
+ int charCount = 256;
+
+ // Determine font metrics from filename.
+ x = 0;
+ while ((target[x] < '0') || (target[x] > '9')) x++;
+ pixelsW = atoi(&target[x]);
+ x++;
+ while ((target[x] < '0') || (target[x] > '9')) x++;
+ pixelsH = atoi(&target[x]);
+
+ // Guess where to find our PNGs.
+ source = utilFileExtensionChange(target, "png");
+ pngFile = utilCreateString("%s/%s", INCLUDE_FONT_CONVERTER, source);
+ DEL(source);
+
+ /*
+ logWrite("Font atlas: %s\n", pngFile);
+ logWrite("Font glyph width: %d\n", pixelsW);
+ logWrite("Font glyph height: %d\n\n", pixelsH);
+ */
+
+ // Load font atlas from disk.
+ font = stbi_load(pngFile, (int *)&w, (int *)&h, (int *)&n, 3);
+ DEL(pngFile);
+ if (!font) return;
+
+ // Create data file for font.
+ out = fopen(target, "wb");
+ if (!out) {
+ stbi_image_free(font);
+ return;
+ }
+
+ // Provide some metadata for enhancement later.
+ fputc(pixelsW, out); // Width of characters in pixels
+ fputc(pixelsH, out); // Height of characters in pixels
+ fputc(charsW, out); // Number of characters per row
+ fputc(charCount - 1, out); // Number of characters - 1
+
+ // Convert bitmap to actual bits.
+ for (y=0; y 7) {
+ bits = 0;
+ fputc(data, out);
+ }
+ }
+ }
+
+ fclose(out);
+
+ // Clean up.
+ stbi_image_free(font);
+}
+#endif
diff --git a/roo-e/src/gui/font.h b/roo_e/src/gui/font.h
similarity index 100%
rename from roo-e/src/gui/font.h
rename to roo_e/src/gui/font.h
diff --git a/roo-e/src/gui/gui-all.h b/roo_e/src/gui/gui-all.h
similarity index 100%
rename from roo-e/src/gui/gui-all.h
rename to roo_e/src/gui/gui-all.h
diff --git a/roo-e/src/gui/gui.c b/roo_e/src/gui/gui.c
similarity index 100%
rename from roo-e/src/gui/gui.c
rename to roo_e/src/gui/gui.c
diff --git a/roo-e/src/gui/gui.h b/roo_e/src/gui/gui.h
similarity index 100%
rename from roo-e/src/gui/gui.h
rename to roo_e/src/gui/gui.h
diff --git a/roo-e/src/gui/image.c b/roo_e/src/gui/image.c
similarity index 75%
rename from roo-e/src/gui/image.c
rename to roo_e/src/gui/image.c
index c3dbf38..9f683c2 100644
--- a/roo-e/src/gui/image.c
+++ b/roo_e/src/gui/image.c
@@ -40,10 +40,13 @@ SurfaceT *imageLoad(char *filename) {
int32_t r;
int32_t x;
int32_t y;
- SurfaceT *i = NULL;
- SurfaceT *t = surfaceGet();
- unsigned char *raw = NULL;
- char *cached = NULL;
+ SurfaceT *i = NULL;
+ SurfaceT *t = surfaceGet();
+ unsigned char *raw = NULL;
+ char *cached = NULL;
+#ifdef INCLUDE_IMAGE_FINDER
+ char *pngFile = NULL;
+#endif
// Has this image been cached?
cached = utilFileExtensionChange(filename, "");
@@ -51,8 +54,22 @@ SurfaceT *imageLoad(char *filename) {
if (!i) {
// Nope. Decode PNG and save raw.
r = stbi_info(filename, &w, &h, &n);
+#ifdef INCLUDE_IMAGE_FINDER
+ pngFile = utilCreateString("%s/%s", INCLUDE_IMAGE_FINDER, filename);
+ //logWrite("Image: %s\n", pngFile);
+ r = stbi_info(pngFile, &w, &h, &n);
+ if (!r) {
+ DEL(pngFile);
+ DEL(cached);
+ return i;
+ }
+#endif
if (r) {
raw = stbi_load(filename, &w, &h, &n, PIXEL_COMPONENTS);
+#ifdef INCLUDE_IMAGE_FINDER
+ if (!raw) raw = stbi_load(pngFile, &w, &h, &n, PIXEL_COMPONENTS);
+ DEL(pngFile);
+#endif
if (raw) {
i = surfaceCreate(w, h);
surfaceSet(i);
diff --git a/roo-e/src/gui/image.h b/roo_e/src/gui/image.h
similarity index 100%
rename from roo-e/src/gui/image.h
rename to roo_e/src/gui/image.h
diff --git a/roo-e/src/gui/surface.c b/roo_e/src/gui/surface.c
similarity index 100%
rename from roo-e/src/gui/surface.c
rename to roo_e/src/gui/surface.c
diff --git a/roo-e/src/gui/surface.h b/roo_e/src/gui/surface.h
similarity index 100%
rename from roo-e/src/gui/surface.h
rename to roo_e/src/gui/surface.h
diff --git a/roo-e/src/gui/widgets/button.c b/roo_e/src/gui/widgets/button.c
similarity index 98%
rename from roo-e/src/gui/widgets/button.c
rename to roo_e/src/gui/widgets/button.c
index 92d548b..9a16c0c 100644
--- a/roo-e/src/gui/widgets/button.c
+++ b/roo_e/src/gui/widgets/button.c
@@ -47,7 +47,7 @@ static void buttonClick(WidgetT *widget, uint16_t x, uint16_t y, uint8_t event,
case CLICK_LEFT_UP:
b->isPressed = 0;
// Call the actual click event.
- b->handler(widget, x, y, event, data);
+ if(b->handler != NULL) b->handler(widget, x, y, event, data);
break;
case CLICK_LEFT_CANCEL:
diff --git a/roo-e/src/gui/widgets/button.h b/roo_e/src/gui/widgets/button.h
similarity index 100%
rename from roo-e/src/gui/widgets/button.h
rename to roo_e/src/gui/widgets/button.h
diff --git a/roo-e/src/gui/widgets/checkbox.c b/roo_e/src/gui/widgets/checkbox.c
similarity index 100%
rename from roo-e/src/gui/widgets/checkbox.c
rename to roo_e/src/gui/widgets/checkbox.c
diff --git a/roo-e/src/gui/widgets/checkbox.h b/roo_e/src/gui/widgets/checkbox.h
similarity index 100%
rename from roo-e/src/gui/widgets/checkbox.h
rename to roo_e/src/gui/widgets/checkbox.h
diff --git a/roo-e/src/gui/widgets/frame.c b/roo_e/src/gui/widgets/frame.c
similarity index 97%
rename from roo-e/src/gui/widgets/frame.c
rename to roo_e/src/gui/widgets/frame.c
index 604dd45..91d1a9c 100644
--- a/roo-e/src/gui/widgets/frame.c
+++ b/roo_e/src/gui/widgets/frame.c
@@ -135,7 +135,10 @@ static void framePaint(struct WidgetS *widget, ...) {
(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);
+ if (f->title) {
+ fontColorSet(GUI_BLACK, GUI_LIGHTGRAY);
+ 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
similarity index 100%
rename from roo-e/src/gui/widgets/frame.h
rename to roo_e/src/gui/widgets/frame.h
diff --git a/roo-e/src/gui/widgets/hscroll.c b/roo_e/src/gui/widgets/hscroll.c
similarity index 100%
rename from roo-e/src/gui/widgets/hscroll.c
rename to roo_e/src/gui/widgets/hscroll.c
diff --git a/roo-e/src/gui/widgets/hscroll.h b/roo_e/src/gui/widgets/hscroll.h
similarity index 100%
rename from roo-e/src/gui/widgets/hscroll.h
rename to roo_e/src/gui/widgets/hscroll.h
diff --git a/roo-e/src/gui/widgets/label.c b/roo_e/src/gui/widgets/label.c
similarity index 100%
rename from roo-e/src/gui/widgets/label.c
rename to roo_e/src/gui/widgets/label.c
diff --git a/roo-e/src/gui/widgets/label.h b/roo_e/src/gui/widgets/label.h
similarity index 100%
rename from roo-e/src/gui/widgets/label.h
rename to roo_e/src/gui/widgets/label.h
diff --git a/roo-e/src/gui/widgets/picture.c b/roo_e/src/gui/widgets/picture.c
similarity index 100%
rename from roo-e/src/gui/widgets/picture.c
rename to roo_e/src/gui/widgets/picture.c
diff --git a/roo-e/src/gui/widgets/picture.h b/roo_e/src/gui/widgets/picture.h
similarity index 100%
rename from roo-e/src/gui/widgets/picture.h
rename to roo_e/src/gui/widgets/picture.h
diff --git a/roo-e/src/gui/widgets/radio.c b/roo_e/src/gui/widgets/radio.c
similarity index 100%
rename from roo-e/src/gui/widgets/radio.c
rename to roo_e/src/gui/widgets/radio.c
diff --git a/roo-e/src/gui/widgets/radio.h b/roo_e/src/gui/widgets/radio.h
similarity index 100%
rename from roo-e/src/gui/widgets/radio.h
rename to roo_e/src/gui/widgets/radio.h
diff --git a/roo-e/src/gui/widgets/scroll.c b/roo_e/src/gui/widgets/scroll.c
similarity index 100%
rename from roo-e/src/gui/widgets/scroll.c
rename to roo_e/src/gui/widgets/scroll.c
diff --git a/roo-e/src/gui/widgets/scroll.h b/roo_e/src/gui/widgets/scroll.h
similarity index 100%
rename from roo-e/src/gui/widgets/scroll.h
rename to roo_e/src/gui/widgets/scroll.h
diff --git a/roo-e/src/gui/widgets/vscroll.c b/roo_e/src/gui/widgets/vscroll.c
similarity index 100%
rename from roo-e/src/gui/widgets/vscroll.c
rename to roo_e/src/gui/widgets/vscroll.c
diff --git a/roo-e/src/gui/widgets/vscroll.h b/roo_e/src/gui/widgets/vscroll.h
similarity index 100%
rename from roo-e/src/gui/widgets/vscroll.h
rename to roo_e/src/gui/widgets/vscroll.h
diff --git a/roo-e/src/gui/wmwindow.c b/roo_e/src/gui/wmwindow.c
similarity index 100%
rename from roo-e/src/gui/wmwindow.c
rename to roo_e/src/gui/wmwindow.c
diff --git a/roo-e/src/gui/wmwindow.h b/roo_e/src/gui/wmwindow.h
similarity index 100%
rename from roo-e/src/gui/wmwindow.h
rename to roo_e/src/gui/wmwindow.h
diff --git a/shared/log.c b/roo_e/src/log.c
similarity index 100%
rename from shared/log.c
rename to roo_e/src/log.c
diff --git a/shared/log.h b/roo_e/src/log.h
similarity index 100%
rename from shared/log.h
rename to roo_e/src/log.h
diff --git a/shared/macros.h b/roo_e/src/macros.h
similarity index 100%
rename from shared/macros.h
rename to roo_e/src/macros.h
diff --git a/shared/memory.c b/roo_e/src/memory.c
similarity index 100%
rename from shared/memory.c
rename to roo_e/src/memory.c
diff --git a/shared/memory.h b/roo_e/src/memory.h
similarity index 100%
rename from shared/memory.h
rename to roo_e/src/memory.h
diff --git a/roo-e/src/os.h b/roo_e/src/os.h
similarity index 100%
rename from roo-e/src/os.h
rename to roo_e/src/os.h
diff --git a/roo-e/src/platform/djgpp.c b/roo_e/src/platform/djgpp.c
similarity index 100%
rename from roo-e/src/platform/djgpp.c
rename to roo_e/src/platform/djgpp.c
diff --git a/roo-e/src/platform/platform.h b/roo_e/src/platform/platform.h
similarity index 100%
rename from roo-e/src/platform/platform.h
rename to roo_e/src/platform/platform.h
diff --git a/roo-e/src/platform/sdl2.c b/roo_e/src/platform/sdl2.c
similarity index 99%
rename from roo-e/src/platform/sdl2.c
rename to roo_e/src/platform/sdl2.c
index 12b8804..c964cc2 100644
--- a/roo-e/src/platform/sdl2.c
+++ b/roo_e/src/platform/sdl2.c
@@ -173,7 +173,7 @@ uint8_t platformStartup(int16_t width, int16_t height, int16_t depth) {
SDL_Init(SDL_INIT_EVERYTHING);
- _windowScale = 3;
+ _windowScale = 1;
_window = SDL_CreateWindow("GUI Debug", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, SDL_WINDOW_ALLOW_HIGHDPI);
_renderer = SDL_CreateRenderer(_window, -1, SDL_RENDERER_ACCELERATED);
diff --git a/shared/stddclmr.h b/roo_e/src/stddclmr.h
similarity index 100%
rename from shared/stddclmr.h
rename to roo_e/src/stddclmr.h
diff --git a/shared/thirdparty/memwatch/FAQ b/roo_e/src/thirdparty/memwatch/FAQ
similarity index 100%
rename from shared/thirdparty/memwatch/FAQ
rename to roo_e/src/thirdparty/memwatch/FAQ
diff --git a/shared/thirdparty/memwatch/Makefile b/roo_e/src/thirdparty/memwatch/Makefile
similarity index 100%
rename from shared/thirdparty/memwatch/Makefile
rename to roo_e/src/thirdparty/memwatch/Makefile
diff --git a/shared/thirdparty/memwatch/README b/roo_e/src/thirdparty/memwatch/README
similarity index 100%
rename from shared/thirdparty/memwatch/README
rename to roo_e/src/thirdparty/memwatch/README
diff --git a/shared/thirdparty/memwatch/USING b/roo_e/src/thirdparty/memwatch/USING
similarity index 100%
rename from shared/thirdparty/memwatch/USING
rename to roo_e/src/thirdparty/memwatch/USING
diff --git a/shared/thirdparty/memwatch/gpl.txt b/roo_e/src/thirdparty/memwatch/gpl.txt
similarity index 100%
rename from shared/thirdparty/memwatch/gpl.txt
rename to roo_e/src/thirdparty/memwatch/gpl.txt
diff --git a/shared/thirdparty/memwatch/memwatch.c b/roo_e/src/thirdparty/memwatch/memwatch.c
similarity index 100%
rename from shared/thirdparty/memwatch/memwatch.c
rename to roo_e/src/thirdparty/memwatch/memwatch.c
diff --git a/shared/thirdparty/memwatch/memwatch.h b/roo_e/src/thirdparty/memwatch/memwatch.h
similarity index 100%
rename from shared/thirdparty/memwatch/memwatch.h
rename to roo_e/src/thirdparty/memwatch/memwatch.h
diff --git a/shared/thirdparty/memwatch/memwatch.lsm b/roo_e/src/thirdparty/memwatch/memwatch.lsm
similarity index 100%
rename from shared/thirdparty/memwatch/memwatch.lsm
rename to roo_e/src/thirdparty/memwatch/memwatch.lsm
diff --git a/shared/thirdparty/memwatch/test.C b/roo_e/src/thirdparty/memwatch/test.C
similarity index 100%
rename from shared/thirdparty/memwatch/test.C
rename to roo_e/src/thirdparty/memwatch/test.C
diff --git a/shared/thirdparty/stb_ds.h b/roo_e/src/thirdparty/stb_ds.h
similarity index 100%
rename from shared/thirdparty/stb_ds.h
rename to roo_e/src/thirdparty/stb_ds.h
diff --git a/roo-e/src/thirdparty/stb_image.h b/roo_e/src/thirdparty/stb_image.h
similarity index 100%
rename from roo-e/src/thirdparty/stb_image.h
rename to roo_e/src/thirdparty/stb_image.h
diff --git a/shared/util.c b/roo_e/src/util.c
similarity index 100%
rename from shared/util.c
rename to roo_e/src/util.c
diff --git a/shared/util.h b/roo_e/src/util.h
similarity index 100%
rename from shared/util.h
rename to roo_e/src/util.h