Skip to content
Open
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
1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@
[submodule "ThirdParty/SDL2"]
path = ThirdParty/SDL2
url = https://github.com/libsdl-org/SDL.git
branch = SDL2
67 changes: 56 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,16 @@ if(APPLE AND NOT CMAKE_OSX_DEPLOYMENT_TARGET)
endif()

set(SPARK_ENGINE_VERSION "1.0.0" CACHE STRING "SparkEngine semantic version used for package metadata")
project(SparkEngine VERSION ${SPARK_ENGINE_VERSION} LANGUAGES CXX C)

# Objective-C / Objective-C++ are required on macOS so SDL2's cocoa/.m sources
# (SDL_cocoaevents.m, SDL_cocoametalview.m, SDL_rwopsbundlesupport.m, etc.) and
# our own MetalDevice.mm can compile. Without them CMake silently skips .m/.mm
# sources and the link fails with "no such file or directory" on the .m.o files.
if(APPLE)
project(SparkEngine VERSION ${SPARK_ENGINE_VERSION} LANGUAGES CXX C OBJC OBJCXX)
else()
project(SparkEngine VERSION ${SPARK_ENGINE_VERSION} LANGUAGES CXX C)
endif()

# Set consistent runtime library for all targets using modern CMake (CMP0091)
# Must be after project() so that the MSVC variable is defined.
Expand Down Expand Up @@ -519,20 +528,56 @@ if(NOT WIN32 AND ENABLE_SDL2 AND EXISTS "${SDL2_SUBMODULE_DIR}/CMakeLists.txt")
set(SDL_SHARED ON CACHE BOOL "" FORCE)
set(SDL_STATIC OFF CACHE BOOL "" FORCE)
set(SDL_TEST OFF CACHE BOOL "" FORCE)
set(SDL_WAYLAND OFF CACHE BOOL "" FORCE)
set(SDL_KMSDRM OFF CACHE BOOL "" FORCE)
set(SDL_DBUS OFF CACHE BOOL "" FORCE)
set(SDL_IBUS OFF CACHE BOOL "" FORCE)
set(SDL_PULSEAUDIO OFF CACHE BOOL "" FORCE)
set(SDL_ALSA OFF CACHE BOOL "" FORCE)
set(SDL_PIPEWIRE OFF CACHE BOOL "" FORCE)
set(SDL_SNDIO OFF CACHE BOOL "" FORCE)
set(SDL_JACK OFF CACHE BOOL "" FORCE)
set(SDL_X11 ON CACHE BOOL "" FORCE)
set(SDL_OPENGL ON CACHE BOOL "" FORCE)

if(APPLE)
# macOS: Cocoa + CoreAudio. X11/Wayland/ALSA etc. are irrelevant.
set(SDL_X11 OFF CACHE BOOL "" FORCE)
set(SDL_WAYLAND OFF CACHE BOOL "" FORCE)
set(SDL_KMSDRM OFF CACHE BOOL "" FORCE)
set(SDL_DBUS OFF CACHE BOOL "" FORCE)
set(SDL_IBUS OFF CACHE BOOL "" FORCE)
set(SDL_PULSEAUDIO OFF CACHE BOOL "" FORCE)
set(SDL_ALSA OFF CACHE BOOL "" FORCE)
set(SDL_PIPEWIRE OFF CACHE BOOL "" FORCE)
set(SDL_SNDIO OFF CACHE BOOL "" FORCE)
set(SDL_JACK OFF CACHE BOOL "" FORCE)
else()
# Linux: X11 + OpenGL, everything else off to keep the build lean.
set(SDL_X11 ON CACHE BOOL "" FORCE)
set(SDL_WAYLAND OFF CACHE BOOL "" FORCE)
set(SDL_KMSDRM OFF CACHE BOOL "" FORCE)
set(SDL_DBUS OFF CACHE BOOL "" FORCE)
set(SDL_IBUS OFF CACHE BOOL "" FORCE)
set(SDL_PULSEAUDIO OFF CACHE BOOL "" FORCE)
set(SDL_ALSA OFF CACHE BOOL "" FORCE)
set(SDL_PIPEWIRE OFF CACHE BOOL "" FORCE)
set(SDL_SNDIO OFF CACHE BOOL "" FORCE)
set(SDL_JACK OFF CACHE BOOL "" FORCE)
endif()

add_subdirectory("${SDL2_SUBMODULE_DIR}" "${CMAKE_BINARY_DIR}/ThirdParty/SDL2" EXCLUDE_FROM_ALL)
set(SDL2_FOUND TRUE)

# Eagerly copy SDL2's public headers to the build tree at configure time.
# SDL2 normally copies them via a build-time custom_target ("sdl_headers_copy"),
# but consumers that pick up SDL2's INTERFACE_INCLUDE_DIRECTORIES without a
# direct build-order dep on SDL2 (e.g. cached CI restores, tests using <SDL.h>
# through SparkEngineLib's PUBLIC include path) can race the copy and fail
# with "fatal error: SDL_main.h: No such file or directory" at
# build/ThirdParty/SDL2/include/SDL2/SDL.h. Copying at configure time makes
# the headers available before any compilation job runs.
file(GLOB _SDL2_PUBLIC_HEADERS "${SDL2_SUBMODULE_DIR}/include/*.h")
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/ThirdParty/SDL2/include/SDL2")
foreach(_hdr IN LISTS _SDL2_PUBLIC_HEADERS)
if(NOT _hdr MATCHES ".*(SDL_config|SDL_revision).*")
get_filename_component(_name "${_hdr}" NAME)
configure_file("${_hdr}"
"${CMAKE_BINARY_DIR}/ThirdParty/SDL2/include/SDL2/${_name}"
COPYONLY)
endif()
endforeach()

message(STATUS "SDL2 built from submodule (ThirdParty/SDL2)")
endif()

Expand Down
13 changes: 5 additions & 8 deletions SparkBuild/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ if(WIN32)
)
endif()

if(MSVC)
set_property(TARGET SparkBuildCore PROPERTY
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
# Inherit the top-level /MD[d] CRT (CMAKE_MSVC_RUNTIME_LIBRARY is set by the
# engine's root CMakeLists). Forcing /MT[d] here causes SparkInstaller — which
# also links imgui (built with /MD[d] via BuildImGui.cmake) — to pull in both
# CRT variants and fail with LNK1169 / LNK2005 on duplicate symbols.

if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
target_link_libraries(SparkBuildCore PUBLIC pthread)
Expand All @@ -77,10 +77,7 @@ endif()

target_link_libraries(SparkBuild PRIVATE SparkBuildCore)

if(MSVC)
set_property(TARGET SparkBuild PROPERTY
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
# Inherit the top-level /MD[d] CRT — see comment above SparkBuildCore.

if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
target_compile_options(SparkBuild PRIVATE -Wall -Wextra -Wpedantic)
Expand Down
7 changes: 2 additions & 5 deletions SparkEditor/Source/Core/EditorFonts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,8 @@ namespace SparkEditor
#endif

const char* fontPaths[] = {
exeFontsPath.c_str(), // next to binary (works regardless of CWD)
"EditorAssets/Fonts/",
"Fonts/",
"../SparkEditor/Fonts/",
"../Fonts/",
exeFontsPath.c_str(), // next to binary (works regardless of CWD)
"EditorAssets/Fonts/", "Fonts/", "../SparkEditor/Fonts/", "../Fonts/",
};

std::string fontDir;
Expand Down
28 changes: 14 additions & 14 deletions SparkEditor/Source/Core/EditorTheme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -593,23 +593,23 @@ namespace SparkEditor
t.author = "Spark Engine Team";

// Warm neutral background stack (hue ≈ 60, very low chroma).
t.background = ThemeColor::FromHex("#1A1716"); // bg-1: panel
t.backgroundDark = ThemeColor::FromHex("#110E0D"); // bg-0: deepest
t.backgroundLight = ThemeColor::FromHex("#302D2A"); // bg-3: hover/input
t.background = ThemeColor::FromHex("#1A1716"); // bg-1: panel
t.backgroundDark = ThemeColor::FromHex("#110E0D"); // bg-0: deepest
t.backgroundLight = ThemeColor::FromHex("#302D2A"); // bg-3: hover/input
t.backgroundAccent = ThemeColor::FromHex("#AF530D").WithAlpha(0.22f);
t.backgroundHeader = ThemeColor::FromHex("#23201E"); // bg-2: header row
t.backgroundHeader = ThemeColor::FromHex("#23201E"); // bg-2: header row
t.backgroundActive = ThemeColor::FromHex("#F1823A").WithAlpha(0.20f);
t.backgroundHover = ThemeColor::FromHex("#302D2A");
t.backgroundSelected = ThemeColor::FromHex("#F1823A").WithAlpha(0.16f);

// Warm off-white foreground (hue ≈ 80).
t.text = ThemeColor::FromHex("#C5C3C1"); // fg-1
t.textDisabled = ThemeColor::FromHex("#64625F"); // fg-3
t.textSecondary = ThemeColor::FromHex("#8D8B88"); // fg-2
t.textAccent = ThemeColor::FromHex("#F1823A"); // ember
t.textWarning = ThemeColor::FromHex("#EDCF59"); // yellow
t.textError = ThemeColor::FromHex("#FA6862"); // red
t.textSuccess = ThemeColor::FromHex("#6ED086"); // green
t.text = ThemeColor::FromHex("#C5C3C1"); // fg-1
t.textDisabled = ThemeColor::FromHex("#64625F"); // fg-3
t.textSecondary = ThemeColor::FromHex("#8D8B88"); // fg-2
t.textAccent = ThemeColor::FromHex("#F1823A"); // ember
t.textWarning = ThemeColor::FromHex("#EDCF59"); // yellow
t.textError = ThemeColor::FromHex("#FA6862"); // red
t.textSuccess = ThemeColor::FromHex("#6ED086"); // green

// Buttons — slightly raised from panel.
t.button = ThemeColor::FromHex("#23201E");
Expand All @@ -623,10 +623,10 @@ namespace SparkEditor
t.frameActive = ThemeColor::FromHex("#F1823A").WithAlpha(0.35f);

// Borders — barely visible on idle, ember on focus.
t.border = ThemeColor::FromHex("#35322F"); // line
t.borderLight = ThemeColor::FromHex("#403C38"); // bg-4
t.border = ThemeColor::FromHex("#35322F"); // line
t.borderLight = ThemeColor::FromHex("#403C38"); // bg-4
t.borderAccent = ThemeColor::FromHex("#F1823A");
t.borderSeparator = ThemeColor::FromHex("#282523"); // line-soft
t.borderSeparator = ThemeColor::FromHex("#282523"); // line-soft

// Title bar — deepest charcoal; active tab uses a dim ember wash.
t.titleBar = ThemeColor::FromHex("#110E0D");
Expand Down
7 changes: 3 additions & 4 deletions SparkEditor/Source/Panels/HierarchyPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,10 +485,9 @@ namespace SparkEditor
const ImVec2 itemMin = ImGui::GetItemRectMin();
const ImVec2 itemMax = ImGui::GetItemRectMax();
const ImVec4 accent = ImGui::GetStyleColorVec4(ImGuiCol_NavHighlight);
ImGui::GetWindowDrawList()->AddRectFilled(
ImVec2(ImGui::GetWindowPos().x, itemMin.y),
ImVec2(ImGui::GetWindowPos().x + 2.0f, itemMax.y),
ImGui::GetColorU32(accent));
ImGui::GetWindowDrawList()->AddRectFilled(ImVec2(ImGui::GetWindowPos().x, itemMin.y),
ImVec2(ImGui::GetWindowPos().x + 2.0f, itemMax.y),
ImGui::GetColorU32(accent));
}

if (!object->active)
Expand Down
5 changes: 5 additions & 0 deletions SparkEditor/Source/Panels/ProjectBrowserPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
#include <ctime>
#include <cstring>

#ifdef _WIN32
#include <windows.h>
#include <shlobj.h>
#endif

namespace fs = std::filesystem;

namespace SparkEditor
Expand Down
8 changes: 8 additions & 0 deletions SparkEngine/Source/Audio/OpenALAudioEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,16 @@
#include "../Utils/Validate.h"

#ifdef SPARK_OPENAL_AVAILABLE
// On macOS the system OpenAL.framework lays headers out as <OpenAL/al.h>.
// openal-soft (Homebrew, Linux) uses the <AL/al.h> form. Prefer the
// framework style on Apple so the build works with either provider.
#if defined(__APPLE__) && __has_include(<OpenAL/al.h>)
#include <OpenAL/al.h>
#include <OpenAL/alc.h>
#else
#include <AL/al.h>
#include <AL/alc.h>
#endif
#else
// Stub typedefs when OpenAL is not available - all operations become no-ops
typedef int ALuint;
Expand Down
Loading
Loading