Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 39 additions & 29 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,37 +51,36 @@ jobs:
with:
submodules: recursive

- name: Install development tools
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
cmake \
libgl1-mesa-dev \
libglfw3-dev \
libx11-dev \
libxrandr-dev \
libxinerama-dev \
libxcursor-dev \
libxi-dev \
libwayland-dev \
libxkbcommon-dev

- name: Build on Linux
sudo apt-get install -y build-essential cmake python3-pip libgl1-mesa-dev
pip install aqtinstall

- name: Install Qt 6.10.0
run: python3 -m aqt install-qt linux desktop 6.10.0 linux_gcc_64 --outputdir external

- name: Build and Install
run: |
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release
cmake --install build --prefix "${{ github.workspace }}/dist" --config Release

- name: Extract branch name
shell: bash
id: extract_branch
run: echo "branch=$(echo ${GITHUB_REF#refs/heads/} | tr '/' '_')" >> $GITHUB_OUTPUT

- name: Prepare artifact structure
run: |
mkdir -p release/Sprite-Tools
cp -r dist/* release/Sprite-Tools/

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: Sprite-Tools-${{ steps.extract_branch.outputs.branch }}-linux
path: build/SpriteTools
path: release

windows:
name: Windows
Expand All @@ -91,27 +90,34 @@ jobs:
uses: actions/checkout@v5
with:
submodules: recursive

- name: Install aqtinstall
run: pip install aqtinstall

- name: Set developer command prompt
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: Install Qt 6.10.0
run: python -m aqt install-qt windows desktop 6.10.0 win64_msvc2022_64 --outputdir external

- name: Build on Windows
- name: Build and Install
run: |
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release
cmake --install build --prefix "${{ github.workspace }}/dist" --config Release

- name: Extract branch name
shell: bash
id: extract_branch
run: echo "branch=$(echo ${GITHUB_REF#refs/heads/} | tr '/' '_')" >> $GITHUB_OUTPUT

- name: Prepare artifact structure
run: |
mkdir -p release/Sprite-Tools
cp -r dist/* release/Sprite-Tools/

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: Sprite-Tools-${{ steps.extract_branch.outputs.branch }}-windows
path: build/Release/SpriteTools.exe
path: release

release:
name: Upload release
Expand All @@ -129,7 +135,6 @@ jobs:
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true

- name: Set tag name
run: |
Expand All @@ -141,6 +146,16 @@ jobs:
RELEASE_NAME="Sprite-Tools $TAG_NAME Build"
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV

- name: Pack Archives
run: |
mkdir final_assets
cd artifacts
for dir in */; do
zip_name="${dir%/}.zip"
echo "Creating $zip_name..."
cd "$dir" && zip -r "../../final_assets/$zip_name" . && cd ..
done

- name: Remove old release if exists
run: |
Expand All @@ -150,17 +165,12 @@ jobs:
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: List downloaded artifacts
run: |
echo "Listing all artifacts in artifacts/:"
ls -R artifacts/

- name: Upload new release
run: |
gh release create "$TAG_NAME" \
--title "$RELEASE_NAME" \
--prerelease artifacts/* \
--prerelease final_assets/* \
--repo ${{ github.repository }} \
--target ${{ github.sha }}
env:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ CMakeSettings.json
CMakeFiles
CMakeCache.txt
Makefile
external/6.10.0
dist/
aqtinstall.log
9 changes: 0 additions & 9 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
[submodule "external/stb"]
path = external/stb
url = https://github.com/nothings/stb
[submodule "external/portable-file-dialogs"]
path = external/portable-file-dialogs
url = https://github.com/samhocevar/portable-file-dialogs
[submodule "external/imgui"]
path = external/imgui
url = https://github.com/ocornut/imgui
[submodule "external/glfw"]
path = external/glfw
url = https://github.com/glfw/glfw.git
116 changes: 86 additions & 30 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
cmake_minimum_required(VERSION 3.18)

if(POLICY CMP0177)
cmake_policy(SET CMP0177 NEW)
endif()

project(SpriteTools)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

if(ANDROID)
set(PLATFORM_ANDROID TRUE)
message(STATUS "Platform: Android")
Expand All @@ -16,7 +23,6 @@ elseif(UNIX)
endif()

if(PLATFORM_ANDROID)

add_library(${PROJECT_NAME} SHARED
src/core/sprite_converter_capi.cpp
src/core/sprite_converter.cpp
Expand All @@ -25,54 +31,104 @@ if(PLATFORM_ANDROID)
src/core/sprite_jni.cpp
src/core/stb_impl.cpp
)

target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/core external/stb)

target_include_directories(${PROJECT_NAME} PRIVATE src/core external/stb)
target_link_libraries(${PROJECT_NAME} android log)

else()
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)

if(PLATFORM_WIN32)
set(QT_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/external/6.10.0/msvc2022_64")
else()
set(QT_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/external/6.10.0/gcc_64")
endif()

add_subdirectory(external/glfw)
set(CMAKE_PREFIX_PATH ${QT_ROOT})

find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets NO_DEFAULT_PATH PATHS ${QT_ROOT})

qt_standard_project_setup()

set(SOURCES
src/main.cpp
src/ui.cpp
src/ui_utils.cpp
src/mainwindow.cpp
src/sprite_viewport.cpp
src/properties_panel.cpp
src/export_dialog.cpp
src/import_dialog.cpp
src/about_dialog.cpp
src/frame_slider.cpp
src/core/stb_impl.cpp
src/core/sprite_loader.cpp
src/core/sprite_converter.cpp
src/renderer.cpp

external/imgui/imgui.cpp
external/imgui/imgui_demo.cpp
external/imgui/imgui_draw.cpp
external/imgui/imgui_tables.cpp
external/imgui/imgui_widgets.cpp
external/imgui/backends/imgui_impl_glfw.cpp
external/imgui/backends/imgui_impl_opengl3.cpp
resources/resources.qrc
)

add_executable(${PROJECT_NAME} ${SOURCES})

target_include_directories(${PROJECT_NAME} PRIVATE
src
src/core
src/icons
external/imgui
external/imgui/backends
external/stb
external/portable-file-dialogs
set(HEADERS
src/mainwindow.h
src/sprite_viewport.h
src/properties_panel.h
src/export_dialog.h
src/import_dialog.h
src/about_dialog.h
src/frame_slider.h
src/app_state.h
src/theme.h
)

add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS})

target_include_directories(${PROJECT_NAME} PRIVATE src src/core external/stb)
target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Core Qt6::Gui Qt6::Widgets)

if(PLATFORM_WIN32)
target_compile_definitions(${PROJECT_NAME} PRIVATE PLATFORM_WIN32)
target_link_libraries(${PROJECT_NAME} PRIVATE glfw opengl32)
set(LIB_DEST ".")
endif()

if(PLATFORM_LINUX)
find_package(OpenGL REQUIRED)
target_compile_definitions(${PROJECT_NAME} PRIVATE PLATFORM_LINUX)
target_link_libraries(${PROJECT_NAME} PRIVATE glfw OpenGL::GL)
set(LIB_DEST "lib")

set_target_properties(${PROJECT_NAME} PROPERTIES
BUILD_RPATH "${QT_ROOT}/lib"
INSTALL_RPATH "$ORIGIN/lib"
BUILD_WITH_INSTALL_RPATH FALSE
)
endif()

endif()
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION .
LIBRARY DESTINATION ${LIB_DEST}
)

set(QT_DEPLOY_BIN_DIR ".")
set(QT_DEPLOY_LIB_DIR "${LIB_DEST}")
set(QT_DEPLOY_PLUGINS_DIR "plugins")

if(IS_ABSOLUTE "${CMAKE_INSTALL_PREFIX}")
set(QT_DEPLOY_QT_CONF_PATH "${CMAKE_INSTALL_PREFIX}/qt.conf")
else()
get_filename_component(ABS_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" ABSOLUTE)
set(QT_DEPLOY_QT_CONF_PATH "${ABS_INSTALL_PREFIX}/qt.conf")
endif()

qt_generate_deploy_app_script(
TARGET ${PROJECT_NAME}
OUTPUT_SCRIPT deploy_script
NO_TRANSLATIONS
POST_EXCLUDE_REGEXES ""
)

install(SCRIPT ${deploy_script})

if(PLATFORM_LINUX)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/qt.conf"
"[Paths]\nPrefix = .\nLibraries = lib\nPlugins = plugins\n"
)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/qt.conf" DESTINATION .)
endif()

endif()
1 change: 0 additions & 1 deletion external/glfw
Submodule glfw deleted from fdd14e
1 change: 0 additions & 1 deletion external/imgui
Submodule imgui deleted from 41765f
1 change: 0 additions & 1 deletion external/portable-file-dialogs
Submodule portable-file-dialogs deleted from c12ea8
2 changes: 1 addition & 1 deletion external/stb
Binary file added resources/add_photo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/center_focus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/close.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/folder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/info.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/navigate_before.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/navigate_next.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/pause.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/play.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions resources/resources.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<RCC>
<qresource prefix="/icons">
<file>center_focus.png</file>
<file>folder.png</file>
<file>navigate_before.png</file>
<file>navigate_next.png</file>
<file>pause.png</file>
<file>play.png</file>
<file>skip_next.png</file>
<file>skip_previous.png</file>
<file>zoom_in.png</file>
<file>zoom_out.png</file>
<file>close.png</file>
<file>save_alt.png</file>
<file>info.png</file>
<file>add_photo.png</file>
</qresource>
</RCC>
Binary file added resources/save_alt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/skip_next.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/skip_previous.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/zoom_in.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/zoom_out.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions src/about_dialog.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#include "about_dialog.h"
#include "theme.h"

#include <QVBoxLayout>
#include <QLabel>

AboutDialog::AboutDialog(QWidget* parent) : QDialog(parent)
{
setWindowTitle("About");
setFixedSize(380, 150);

auto* lay = new QVBoxLayout(this);
lay->setContentsMargins(18, 18, 18, 18);
lay->setSpacing(0);

auto* nameLbl = new QLabel("Sprite-Tools");
nameLbl->setStyleSheet(QString("font-size: 17px; font-weight: bold; color: %1;").arg(SpriteColors::Accent.name()));
lay->addWidget(nameLbl);
lay->addSpacing(6);

auto* descLbl = new QLabel("Sprite viewer and creator for Quake / Half-Life sprites");
descLbl->setStyleSheet(QString("font-size: 12px; color: %1;").arg(SpriteColors::TextPrimary.name()));
descLbl->setWordWrap(true);
lay->addWidget(descLbl);
lay->addSpacing(16);


auto* linkLbl = new QLabel;
linkLbl->setTextFormat(Qt::RichText);
linkLbl->setOpenExternalLinks(true);
linkLbl->setText(
QString("<span style='color:%1; font-size:12px;'>GitHub: </span>"
"<a style='color:%2; font-size:12px; text-decoration:underline;' "
"href='https://github.com/Elinsrc/Sprite-Tools'>"
"https://github.com/Elinsrc/Sprite-Tools</a>")
.arg(SpriteColors::TextPrimary.name(), SpriteColors::Accent.name()));
linkLbl->setCursor(Qt::PointingHandCursor);
lay->addWidget(linkLbl);

lay->addStretch();
}
Loading
Loading