Frame lable color fixed. Button null handler fixed. Project reorganized to use CMake.
This commit is contained in:
parent
16d68d52e5
commit
456b7d98df
65 changed files with 452 additions and 271 deletions
167
CMakeLists.txt
Normal file
167
CMakeLists.txt
Normal file
|
@ -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 <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
|
||||
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
|
||||
)
|
45
font/font.pro
Normal file
45
font/font.pro
Normal file
|
@ -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 <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
|
BIN
font/in/vga4x8.png
(Stored with Git LFS)
Normal file
BIN
font/in/vga4x8.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
font/in/vga8x14.png
(Stored with Git LFS)
Normal file
BIN
font/in/vga8x14.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
font/in/vga8x16.png
(Stored with Git LFS)
Normal file
BIN
font/in/vga8x16.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
font/in/vga8x8.png
(Stored with Git LFS)
Normal file
BIN
font/in/vga8x8.png
(Stored with Git LFS)
Normal file
Binary file not shown.
94
font/src/main.c
Normal file
94
font/src/main.c
Normal file
|
@ -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 <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#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<h; y++) {
|
||||
for (x=0; x<w; x++) {
|
||||
data <<= 1;
|
||||
data |= (font[(y * w * 3) + (x * 3)] != 0);
|
||||
bits++;
|
||||
if (bits > 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;
|
||||
}
|
|
@ -1,262 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 5.0.2, 2022-06-28T15:49:02. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
<value type="QByteArray">{b66758f8-0b3c-4017-8297-d2a3cceca9ca}</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||
<value type="int">0</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.EditorSettings</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
|
||||
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
|
||||
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
|
||||
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
|
||||
<value type="QString" key="language">Cpp</value>
|
||||
<valuemap type="QVariantMap" key="value">
|
||||
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
|
||||
</valuemap>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
|
||||
<value type="QString" key="language">QmlJS</value>
|
||||
<valuemap type="QVariantMap" key="value">
|
||||
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
|
||||
</valuemap>
|
||||
</valuemap>
|
||||
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
|
||||
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
|
||||
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
|
||||
<value type="int" key="EditorConfiguration.IndentSize">4</value>
|
||||
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
|
||||
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
|
||||
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
|
||||
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
|
||||
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
|
||||
<value type="bool" key="EditorConfiguration.PreferSingleLineComments">false</value>
|
||||
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
|
||||
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
|
||||
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
|
||||
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
|
||||
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
|
||||
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
|
||||
<value type="int" key="EditorConfiguration.TabSize">8</value>
|
||||
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
|
||||
<value type="bool" key="EditorConfiguration.UseIndenter">false</value>
|
||||
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
|
||||
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
|
||||
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
|
||||
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
|
||||
<value type="QString" key="EditorConfiguration.ignoreFileTypes">*.md, *.MD, Makefile</value>
|
||||
<value type="bool" key="EditorConfiguration.inEntireDocument">true</value>
|
||||
<value type="bool" key="EditorConfiguration.skipTrailingWhitespace">true</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.PluginSettings</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<valuemap type="QVariantMap" key="AutoTest.ActiveFrameworks">
|
||||
<value type="bool" key="AutoTest.Framework.Boost">true</value>
|
||||
<value type="bool" key="AutoTest.Framework.CTest">false</value>
|
||||
<value type="bool" key="AutoTest.Framework.Catch">true</value>
|
||||
<value type="bool" key="AutoTest.Framework.GTest">true</value>
|
||||
<value type="bool" key="AutoTest.Framework.QtQuickTest">true</value>
|
||||
<value type="bool" key="AutoTest.Framework.QtTest">true</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="AutoTest.CheckStates"/>
|
||||
<value type="int" key="AutoTest.RunAfterBuild">0</value>
|
||||
<value type="bool" key="AutoTest.UseGlobal">true</value>
|
||||
<valuelist type="QVariantList" key="ClangCodeModel.CustomCommandLineKey"/>
|
||||
<value type="bool" key="ClangCodeModel.UseGlobalConfig">true</value>
|
||||
<value type="QString" key="ClangCodeModel.WarningConfigId">Builtin.BuildSystem</value>
|
||||
<valuemap type="QVariantMap" key="ClangTools">
|
||||
<value type="bool" key="ClangTools.AnalyzeOpenFiles">true</value>
|
||||
<value type="bool" key="ClangTools.BuildBeforeAnalysis">true</value>
|
||||
<value type="QString" key="ClangTools.DiagnosticConfig">Builtin.DefaultTidyAndClazy</value>
|
||||
<value type="int" key="ClangTools.ParallelJobs">4</value>
|
||||
<valuelist type="QVariantList" key="ClangTools.SelectedDirs"/>
|
||||
<valuelist type="QVariantList" key="ClangTools.SelectedFiles"/>
|
||||
<valuelist type="QVariantList" key="ClangTools.SuppressedDiagnostics"/>
|
||||
<value type="bool" key="ClangTools.UseGlobalSettings">true</value>
|
||||
</valuemap>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.Target.0</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value type="QString" key="DeviceType">Desktop</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.15.0 GCC 64bit</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.15.0 GCC 64bit</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5150.gcc_64_kit</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||
<value type="int" key="EnableQmlDebugging">0</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/scott/code/roo-e/build-roo-e-Desktop_Qt_5_15_0_GCC_64bit-Debug</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/scott/code/roo-e/build-roo-e-Desktop_Qt_5_15_0_GCC_64bit-Debug</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/scott/code/roo-e/build-roo-e-Desktop_Qt_5_15_0_GCC_64bit-Release</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/scott/code/roo-e/build-roo-e-Desktop_Qt_5_15_0_GCC_64bit-Release</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
||||
<value type="int" key="QtQuickCompiler">0</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
|
||||
<value type="int" key="EnableQmlDebugging">0</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/scott/code/roo-e/build-roo-e-Desktop_Qt_5_15_0_GCC_64bit-Profile</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/scott/code/roo-e/build-roo-e-Desktop_Qt_5_15_0_GCC_64bit-Profile</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
||||
<value type="int" key="QtQuickCompiler">0</value>
|
||||
<value type="int" key="SeparateDebugInfo">0</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deploy</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.DeployConfiguration.CustomData"/>
|
||||
<value type="bool" key="ProjectExplorer.DeployConfiguration.CustomDataEnabled">false</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
||||
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
|
||||
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
|
||||
<valuelist type="QVariantList" key="CustomOutputParsers"/>
|
||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/scott/code/roo-e/roo-e/roo-e.pro</value>
|
||||
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">/home/scott/code/roo-e/roo-e/roo-e.pro</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||
<value type="QString" key="RunConfiguration.WorkingDirectory.default">/home/scott/code/roo-e/build-roo-e-Desktop_Qt_5_15_0_GCC_64bit-Debug/bin</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.TargetCount</variable>
|
||||
<value type="int">1</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
|
||||
<value type="int">22</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Version</variable>
|
||||
<value type="int">22</value>
|
||||
</data>
|
||||
</qtcreator>
|
|
@ -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<h; y++) {
|
||||
for (x=0; x<w; x++) {
|
||||
data <<= 1;
|
||||
data |= (font[(y * w * 3) + (x * 3)] != 0);
|
||||
bits++;
|
||||
if (bits > 7) {
|
||||
bits = 0;
|
||||
fputc(data, out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fclose(out);
|
||||
|
||||
// Clean up.
|
||||
stbi_image_free(font);
|
||||
}
|
||||
#endif
|
|
@ -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);
|
|
@ -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:
|
|
@ -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.
|
|
@ -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);
|
Loading…
Add table
Reference in a new issue