icons embed in their programs

This commit is contained in:
floralrainfall 2023-07-07 03:48:43 -04:00
parent cd7720810c
commit a158d87b63
7 changed files with 28 additions and 2 deletions

View File

@ -1,5 +1,7 @@
cmake_minimum_required(VERSION 3.4)
include(cmake/resource.cmake)
project(engine)
project(player)
project(server)
@ -24,21 +26,26 @@ add_library(engine STATIC
src/include/engine/network/Guid.hpp
)
create_resources(rsc/client ${CMAKE_BINARY_DIR}/client_rsc.h)
qt_add_executable(player
src/client/player/main.cpp
${CMAKE_BINARY_DIR}/client_rsc.c
)
create_resources(rsc/server ${CMAKE_BINARY_DIR}/server_rsc.h)
add_executable(server
src/client/server/main.cpp
)
create_resources(rsc/studio ${CMAKE_BINARY_DIR}/studio_rsc.h)
qt_add_executable(studio
src/client/studio/StudioWindow.cpp
src/include/client/studio/StudioWindow.hpp
src/client/studio/main.cpp
)
target_include_directories(engine PUBLIC src/include)
target_include_directories(engine PUBLIC src/include ${CMAKE_BINARY_DIR})
target_link_libraries(engine PUBLIC ${BOOST_LIBRARIES})
set(QT6_LIBRARIES_INCL Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGLWidgets)

11
cmake/resource.cmake Normal file
View File

@ -0,0 +1,11 @@
function(create_resources dir output)
file(WRITE ${output} "")
file(GLOB bins ${dir}/*)
foreach(bin ${bins})
string(REGEX MATCH "([^/]+)$" filename ${bin})
string(REGEX REPLACE "\\.| |-" "_" filename ${filename})
file(READ ${bin} filedata HEX)
string(REGEX REPLACE "([0-9a-f][0-9a-f])" "0x\\1," filedata ${filedata})
file(APPEND ${output} "const unsigned char ${filename}[] = {${filedata}};\nconst unsigned long long ${filename}_size = sizeof(${filename});\n")
endforeach()
endfunction()

3
rsc/README Normal file
View File

@ -0,0 +1,3 @@
# /rsc
These are files that will be embedded in their respective projects.

View File

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

View File

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

View File

@ -1,9 +1,14 @@
#include <client/studio/StudioWindow.hpp>
#include "studio_rsc.h"
StudioWindow::StudioWindow()
{
setWindowTitle(QString("RBXNU Studio"));
setWindowIcon(QIcon(":/content/images/icon.png"));
QPixmap icon_pixmap = QPixmap();
icon_pixmap.loadFromData(icon_png, icon_png_size);
setWindowIcon(QIcon(icon_pixmap));
}
void StudioWindow::closeEvent(QCloseEvent* event)