diff --git a/.gitignore b/.gitignore index 27d5feb..3639c96 100644 --- a/.gitignore +++ b/.gitignore @@ -1,73 +1,6 @@ -# ---> C++ - -# Prerequisites -*.d - -# Compiled Object files -*.slo -*.lo -*.o -*.obj - -# Precompiled Headers -*.gch -*.pch - -# Compiled Dynamic libraries -*.so -*.dylib -*.dll - -# Fortran module files -*.mod -*.smod - -# Compiled Static libraries -*.lai -*.la -*.a -*.lib - -# Executables -*.exe -*.out -*.app - -# Build directories +# ---> Zig +.zig-cache/ +zig-out/ build/ build-*/ -bin/ -obj/ -Debug/ -Release/ -x64/ -x86/ - -# IDE and Editor files -.vscode/ -.idea/ -*.swp -*.swo -*~ - -# OS generated files -.DS_Store -.DS_Store? -._* -.Spotlight-V100 -.Trashes -ehthumbs.db -Thumbs.db - -# CMake -CMakeCache.txt -CMakeFiles/ -cmake_install.cmake -Makefile - -# Dependency directories -node_modules/ -vendor/ - -# Logs -*.log +docgen_tmp/ diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index f16e457..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 3.16) -project(observations-on-the-sublime-dynamics-of-eroding-matter) - -set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_STANDARD_REQUIRED ON) - -# Find SDL2 -find_package(SDL2 REQUIRED) - -# Add executable -add_executable(${PROJECT_NAME} src/main.cpp) - -# Link SDL2 -target_link_libraries(${PROJECT_NAME} SDL2::SDL2) - -# Include directories for SDL2 -target_include_directories(${PROJECT_NAME} PRIVATE ${SDL2_INCLUDE_DIRS}) diff --git a/README.md b/README.md index d1327b8..4a42cdc 100644 --- a/README.md +++ b/README.md @@ -1,99 +1,2 @@ -# Observations on the Sublime Dynamics of Eroding Matter - -A C++ project using SDL2 for graphics and window management. - -## Prerequisites - -### macOS -Install SDL2 using Homebrew: -```bash -brew install sdl2 -``` - -### Ubuntu/Debian -```bash -sudo apt-get install libsdl2-dev -``` - -### Windows -Download SDL2 development libraries from [SDL2 website](https://www.libsdl.org/download-2.0.php) or use vcpkg: -```bash -vcpkg install sdl2 -``` - -## Building - -### Option 1: Using Build Scripts (Recommended) - -#### Unix-like Systems (macOS/Linux) -```bash -# Build the project -./build.sh - -# Clean and rebuild -./build.sh -c - -# Check dependencies only -./build.sh --check-only - -# Show help -./build.sh -h -``` - -#### Windows -```cmd -# Build the project -build.bat - -# Clean and rebuild -build.bat -c - -# Check dependencies only -build.bat --check-only - -# Show help -build.bat -h -``` - -### Option 2: Manual Build - -1. Create a build directory: -```bash -mkdir build -cd build -``` - -2. Configure with CMake: -```bash -cmake .. -``` - -3. Build the project: -```bash -make -``` - -## Running - -From the build directory: -```bash -./observations-on-the-sublime-dynamics-of-eroding-matter -``` - -## Build Script Features - -The build scripts provide: -- **Dependency checking**: Automatically verifies CMake, C++ compiler, and SDL2 -- **Cross-platform support**: Works on macOS, Linux, and Windows -- **Smart SDL2 detection**: Finds SDL2 installed via Homebrew, package managers, or system paths -- **Build optimization**: Uses parallel compilation and Release configuration -- **Error handling**: Clear error messages and helpful installation instructions -- **Flexible options**: Clean builds, dependency checks, and future test/install support - -## Features - -- SDL2 window with 800x600 resolution -- Black background -- Proper event handling (close window to exit) -- Clean resource management +# observations-on-the-sublime-dynamics-of-eroding-matter diff --git a/build.bat b/build.bat deleted file mode 100644 index 10ce3d2..0000000 --- a/build.bat +++ /dev/null @@ -1,333 +0,0 @@ -@echo off -setlocal enabledelayedexpansion - -REM Build script for "Observations on the Sublime Dynamics of Eroding Matter" -REM A C++ project using SDL2 - -set "SCRIPT_NAME=%~n0" -set "PROJECT_NAME=observations-on-the-sublime-dynamics-of-eroding-matter" - -REM Colors for output (Windows 10+) -set "RED=[91m" -set "GREEN=[92m" -set "YELLOW=[93m" -set "BLUE=[94m" -set "NC=[0m" - -REM Function to print colored output -:print_status -echo %BLUE%[INFO]%NC% %~1 -goto :eof - -:print_success -echo %GREEN%[SUCCESS]%NC% %~1 -goto :eof - -:print_warning -echo %YELLOW%[WARNING]%NC% %~1 -goto :eof - -:print_error -echo %RED%[ERROR]%NC% %~1 -goto :eof - -REM Function to check if command exists -:command_exists -where %1 >nul 2>&1 -if %errorlevel% equ 0 ( - set "COMMAND_EXISTS=true" -) else ( - set "COMMAND_EXISTS=false" -) -goto :eof - -REM Function to check SDL2 installation -:check_sdl2 -call :print_status "Checking SDL2 installation..." - -REM Check if SDL2 is available via vcpkg or system -set "SDL2_FOUND=false" - -REM Check if SDL2 is in PATH -where sdl2-config >nul 2>&1 -if %errorlevel% equ 0 ( - call :print_success "SDL2 found in PATH" - set "SDL2_FOUND=true" - goto :sdl2_check_end -) - -REM Check if vcpkg is available and SDL2 is installed -where vcpkg >nul 2>&1 -if %errorlevel% equ 0 ( - vcpkg list | findstr sdl2 >nul 2>&1 - if %errorlevel% equ 0 ( - call :print_success "SDL2 found via vcpkg" - set "SDL2_FOUND=true" - goto :sdl2_check_end - ) -) - -REM Check if SDL2 headers exist in common locations -if exist "C:\SDL2\include\SDL2\SDL.h" ( - call :print_success "SDL2 found in C:\SDL2" - set "SDL2_FOUND=true" - goto :sdl2_check_end -) - -if exist "%ProgramFiles%\SDL2\include\SDL2\SDL.h" ( - call :print_success "SDL2 found in %ProgramFiles%\SDL2" - set "SDL2_FOUND=true" - goto :sdl2_check_end -) - -if exist "%ProgramFiles(x86)%\SDL2\include\SDL2\SDL.h" ( - call :print_success "SDL2 found in %ProgramFiles(x86)%\SDL2" - set "SDL2_FOUND=true" - goto :sdl2_check_end -) - -:sdl2_check_end -if "%SDL2_FOUND%"=="false" ( - call :print_warning "SDL2 not found. Please install SDL2:" - call :print_status " 1. Download from: https://www.libsdl.org/download-2.0.php" - call :print_status " 2. Or use vcpkg: vcpkg install sdl2" - call :print_status " 3. Or use MSYS2: pacman -S mingw-w64-x86_64-SDL2" - exit /b 1 -) - -goto :eof - -REM Function to check CMake -:check_cmake -call :print_status "Checking CMake installation..." - -call :command_exists cmake -if "%COMMAND_EXISTS%"=="false" ( - call :print_error "CMake not found. Please install CMake first:" - call :print_status " Download from: https://cmake.org/download/" - call :print_status " Or use chocolatey: choco install cmake" - call :print_status " Or use winget: winget install Kitware.CMake" - exit /b 1 -) - -for /f "tokens=3" %%i in ('cmake --version 2^>nul') do ( - set "CMAKE_VERSION=%%i" - goto :cmake_version_found -) - -:cmake_version_found -call :print_success "CMake found: version %CMAKE_VERSION%" - -REM Check minimum version requirement (simplified check) -REM This is a basic check - you might want to implement proper version comparison -call :print_success "CMake version check passed" -goto :eof - -REM Function to check C++ compiler -:check_compiler -call :print_status "Checking C++ compiler..." - -set "COMPILER_FOUND=false" - -REM Check for MSVC -where cl >nul 2>&1 -if %errorlevel% equ 0 ( - call :print_success "MSVC found" - set "COMPILER_FOUND=true" - goto :compiler_check_end -) - -REM Check for MinGW -where g++ >nul 2>&1 -if %errorlevel% equ 0 ( - call :print_success "MinGW G++ found" - set "COMPILER_FOUND=true" - goto :compiler_check_end -) - -REM Check for Clang -where clang++ >nul 2>&1 -if %errorlevel% equ 0 ( - call :print_success "Clang++ found" - set "COMPILER_FOUND=true" - goto :compiler_check_end -) - -:compiler_check_end -if "%COMPILER_FOUND%"=="false" ( - call :print_error "No C++ compiler found. Please install one of:" - call :print_status " - Visual Studio with C++ workload" - call :print_status " - MinGW-w64" - call :print_status " - Clang for Windows" - exit /b 1 -) - -goto :eof - -REM Function to clean build directory -:clean_build -if exist "build" ( - call :print_status "Cleaning build directory..." - rmdir /s /q build - call :print_success "Build directory cleaned" -) -goto :eof - -REM Function to build project -:build_project -call :print_status "Creating build directory..." -if not exist "build" mkdir build -cd build - -call :print_status "Configuring project with CMake..." -cmake .. -DCMAKE_BUILD_TYPE=Release -if %errorlevel% neq 0 ( - call :print_error "CMake configuration failed" - exit /b 1 -) - -call :print_status "Building project..." -cmake --build . --config Release -if %errorlevel% neq 0 ( - call :print_error "Build failed" - exit /b 1 -) - -call :print_success "Build completed successfully!" - -REM Check if executable was created -if exist "%PROJECT_NAME%.exe" ( - call :print_success "Executable created: %PROJECT_NAME%.exe" - call :print_status "You can run it with: %PROJECT_NAME%.exe" -) else ( - call :print_error "Executable not found after build" - exit /b 1 -) - -cd .. -goto :eof - -REM Function to run tests (placeholder for future use) -:run_tests -call :print_status "Running tests..." -call :print_warning "No tests configured yet" -goto :eof - -REM Function to install (placeholder for future use) -:install_project -call :print_status "Installing project..." -call :print_warning "Installation not configured yet" -goto :eof - -REM Function to show help -:show_help -echo Usage: %SCRIPT_NAME%.bat [OPTIONS] -echo. -echo Options: -echo -h, --help Show this help message -echo -c, --clean Clean build directory before building -echo -t, --test Run tests after building -echo -i, --install Install the project -echo --check-only Only check dependencies without building -echo. -echo Examples: -echo %SCRIPT_NAME%.bat # Build the project -echo %SCRIPT_NAME%.bat -c # Clean and build -echo %SCRIPT_NAME%.bat --check-only # Only check dependencies -goto :eof - -REM Main script -:main -call :print_status "Starting build process for 'Observations on the Sublime Dynamics of Eroding Matter'" -call :print_status "Project directory: %CD%" - -REM Parse command line arguments -set "CLEAN_BUILD=false" -set "RUN_TESTS=false" -set "INSTALL_PROJECT=false" -set "CHECK_ONLY=false" - -:parse_args -if "%~1"=="" goto :args_parsed -if "%~1"=="-h" goto :show_help -if "%~1"=="--help" goto :show_help -if "%~1"=="-c" ( - set "CLEAN_BUILD=true" - shift - goto :parse_args -) -if "%~1"=="--clean" ( - set "CLEAN_BUILD=true" - shift - goto :parse_args -) -if "%~1"=="-t" ( - set "RUN_TESTS=true" - shift - goto :parse_args -) -if "%~1"=="--test" ( - set "RUN_TESTS=true" - shift - goto :parse_args -) -if "%~1"=="-i" ( - set "INSTALL_PROJECT=true" - shift - goto :parse_args -) -if "%~1"=="--install" ( - set "INSTALL_PROJECT=true" - shift - goto :parse_args -) -if "%~1"=="--check-only" ( - set "CHECK_ONLY=true" - shift - goto :parse_args -) -call :print_error "Unknown option: %~1" -call :show_help -exit /b 1 - -:args_parsed -REM Check dependencies -call :check_cmake -if %errorlevel% neq 0 exit /b 1 - -call :check_compiler -if %errorlevel% neq 0 exit /b 1 - -call :check_sdl2 -if %errorlevel% neq 0 exit /b 1 - -if "%CHECK_ONLY%"=="true" ( - call :print_success "All dependencies are satisfied!" - exit /b 0 -) - -REM Clean build directory if requested -if "%CLEAN_BUILD%"=="true" ( - call :clean_build -) - -REM Build the project -call :build_project - -REM Run tests if requested -if "%RUN_TESTS%"=="true" ( - call :run_tests -) - -REM Install if requested -if "%INSTALL_PROJECT%"=="true" ( - call :install_project -) - -call :print_success "Build process completed successfully!" -exit /b 0 - -REM Entry point -if "%~1"=="-h" goto :show_help -if "%~1"=="--help" goto :show_help -goto :main diff --git a/build.sh b/build.sh deleted file mode 100755 index 684a835..0000000 --- a/build.sh +++ /dev/null @@ -1,256 +0,0 @@ -#!/bin/bash - -# Build script for "Observations on the Sublime Dynamics of Eroding Matter" -# A C++ project using SDL2 - -set -e # Exit on any error - -# Colors for output -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[1;33m' -BLUE='\033[0;34m' -NC='\033[0m' # No Color - -# Function to print colored output -print_status() { - echo -e "${BLUE}[INFO]${NC} $1" -} - -print_success() { - echo -e "${GREEN}[SUCCESS]${NC} $1" -} - -print_warning() { - echo -e "${YELLOW}[WARNING]${NC} $1" -} - -print_error() { - echo -e "${RED}[ERROR]${NC} $1" -} - -# Function to check if command exists -command_exists() { - command -v "$1" >/dev/null 2>&1 -} - -# Function to check SDL2 installation -check_sdl2() { - print_status "Checking SDL2 installation..." - - if [[ "$OSTYPE" == "darwin"* ]]; then - # macOS - if command_exists brew; then - if brew list sdl2 >/dev/null 2>&1; then - print_success "SDL2 found via Homebrew" - return 0 - else - print_warning "SDL2 not found. Installing via Homebrew..." - brew install sdl2 - print_success "SDL2 installed successfully" - return 0 - fi - else - print_error "Homebrew not found. Please install Homebrew first: https://brew.sh/" - return 1 - fi - elif [[ "$OSTYPE" == "linux-gnu"* ]]; then - # Linux - if command_exists pkg-config; then - if pkg-config --exists sdl2; then - print_success "SDL2 found via pkg-config" - return 0 - else - print_warning "SDL2 not found. Please install libsdl2-dev:" - print_status " Ubuntu/Debian: sudo apt-get install libsdl2-dev" - print_status " Fedora: sudo dnf install SDL2-devel" - print_status " Arch: sudo pacman -S sdl2" - return 1 - fi - else - print_error "pkg-config not found. Please install it first." - return 1 - fi - else - print_error "Unsupported operating system: $OSTYPE" - return 1 - fi -} - -# Function to check CMake -check_cmake() { - print_status "Checking CMake installation..." - - if command_exists cmake; then - CMAKE_VERSION=$(cmake --version | head -n1 | cut -d' ' -f3) - print_success "CMake found: version $CMAKE_VERSION" - - # Check minimum version requirement - REQUIRED_VERSION="3.16.0" - if [ "$(printf '%s\n' "$REQUIRED_VERSION" "$CMAKE_VERSION" | sort -V | head -n1)" = "$REQUIRED_VERSION" ]; then - print_success "CMake version meets requirement (>= $REQUIRED_VERSION)" - else - print_error "CMake version $CMAKE_VERSION is too old. Required: >= $REQUIRED_VERSION" - return 1 - fi - else - print_error "CMake not found. Please install CMake first:" - print_status " macOS: brew install cmake" - print_status " Ubuntu/Debian: sudo apt-get install cmake" - print_status " Or download from: https://cmake.org/download/" - return 1 - fi -} - -# Function to check C++ compiler -check_compiler() { - print_status "Checking C++ compiler..." - - if command_exists g++; then - print_success "G++ found: $(g++ --version | head -n1)" - elif command_exists clang++; then - print_success "Clang++ found: $(clang++ --version | head -n1)" - else - print_error "No C++ compiler found. Please install g++ or clang++" - return 1 - fi -} - -# Function to clean build directory -clean_build() { - if [ -d "build" ]; then - print_status "Cleaning build directory..." - rm -rf build - print_success "Build directory cleaned" - fi -} - -# Function to build project -build_project() { - print_status "Creating build directory..." - mkdir -p build - cd build - - print_status "Configuring project with CMake..." - cmake .. -DCMAKE_BUILD_TYPE=Release - - print_status "Building project..." - make -j$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 4) - - print_success "Build completed successfully!" - - # Check if executable was created - if [ -f "observations-on-the-sublime-dynamics-of-eroding-matter" ]; then - print_success "Executable created: observations-on-the-sublime-dynamics-of-eroding-matter" - print_status "You can run it with: ./observations-on-the-sublime-dynamics-of-eroding-matter" - else - print_error "Executable not found after build" - exit 1 - fi -} - -# Function to run tests (placeholder for future use) -run_tests() { - print_status "Running tests..." - # Add test execution logic here when tests are implemented - print_warning "No tests configured yet" -} - -# Function to install (placeholder for future use) -install_project() { - print_status "Installing project..." - # Add installation logic here when needed - print_warning "Installation not configured yet" -} - -# Function to show help -show_help() { - echo "Usage: $0 [OPTIONS]" - echo "" - echo "Options:" - echo " -h, --help Show this help message" - echo " -c, --clean Clean build directory before building" - echo " -t, --test Run tests after building" - echo " -i, --install Install the project" - echo " --check-only Only check dependencies without building" - echo "" - echo "Examples:" - echo " $0 # Build the project" - echo " $0 -c # Clean and build" - echo " $0 --check-only # Only check dependencies" -} - -# Main script -main() { - print_status "Starting build process for 'Observations on the Sublime Dynamics of Eroding Matter'" - print_status "Project directory: $(pwd)" - - # Parse command line arguments - CLEAN_BUILD=false - RUN_TESTS=false - INSTALL_PROJECT=false - CHECK_ONLY=false - - while [[ $# -gt 0 ]]; do - case $1 in - -h|--help) - show_help - exit 0 - ;; - -c|--clean) - CLEAN_BUILD=true - shift - ;; - -t|--test) - RUN_TESTS=true - shift - ;; - -i|--install) - INSTALL_PROJECT=true - shift - ;; - --check-only) - CHECK_ONLY=true - shift - ;; - *) - print_error "Unknown option: $1" - show_help - exit 1 - ;; - esac - done - - # Check dependencies - check_cmake || exit 1 - check_compiler || exit 1 - check_sdl2 || exit 1 - - if [ "$CHECK_ONLY" = true ]; then - print_success "All dependencies are satisfied!" - exit 0 - fi - - # Clean build directory if requested - if [ "$CLEAN_BUILD" = true ]; then - clean_build - fi - - # Build the project - build_project - - # Run tests if requested - if [ "$RUN_TESTS" = true ]; then - run_tests - fi - - # Install if requested - if [ "$INSTALL_PROJECT" = true ]; then - install_project - fi - - print_success "Build process completed successfully!" -} - -# Run main function with all arguments -main "$@" diff --git a/build.zig b/build.zig new file mode 100644 index 0000000..cfc5542 --- /dev/null +++ b/build.zig @@ -0,0 +1,65 @@ +const std = @import("std"); + +// Although this function looks imperative, note that its job is to +// declaratively construct a build graph that will be executed by an external +// runner. +pub fn build(b: *std.Build) void { + // Standard target options allows the person running `zig build` to choose + // what target to build for. Here we do not override the defaults, which + // means any target is allowed, and the default is native. Other options + // for restricting supported target set are available. + const target = b.standardTargetOptions(.{}); + + // Standard optimization options allow the person running `zig build` to select + // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. Here we do not + // set a preferred release mode, allowing the user to decide how to optimize. + const optimize = b.standardOptimizeOption(.{}); + + // This creates a "module", which represents a collection of source files alongside + // some compilation options, such as optimization mode and linked system libraries. + // Every executable or library we compile will be based on one or more modules. + const exe_mod = b.createModule(.{ + // `root_source_file` is the Zig "entry point" of the module. If a module + // only contains e.g. external object files, you can make this `null`. + // In this case the main source file is merely a path, however, in more + // complicated build scripts, this could be a generated file. + .root_source_file = b.path("src/main.zig"), + .target = target, + .optimize = optimize, + }); + + // This creates a `std.Build.Step.Compile`, but this one builds an executable + // rather than a static library. + const exe = b.addExecutable(.{ + .name = "observations_on_the_sublime_dyna", + .root_module = exe_mod, + }); + + // This declares intent for the executable to be installed into the + // standard location when the user invokes the "install" step (the default + // step when running `zig build`). + b.installArtifact(exe); + + // This *creates* a Run step in the build graph, to be executed when another + // step is evaluated that depends on it. The next line below will establish + // such a dependency. + const run_cmd = b.addRunArtifact(exe); + + // By making the run step depend on the install step, it will be run from the + // installation directory rather than directly from within the cache directory. + // This is not necessary, however, if the application depends on other installed + // files, this ensures they will be present and in the expected location. + run_cmd.step.dependOn(b.getInstallStep()); + + // This allows the user to pass arguments to the application in the build + // command itself, like this: `zig build run -- arg1 arg2 etc` + if (b.args) |args| { + run_cmd.addArgs(args); + } + + // This creates a build step. It will be visible in the `zig build --help` menu, + // and can be selected like this: `zig build run` + // This will evaluate the `run` step rather than the default, which is "install". + const run_step = b.step("run", "Run the app"); + run_step.dependOn(&run_cmd.step); +} diff --git a/build.zig.zon b/build.zig.zon new file mode 100644 index 0000000..bcf179d --- /dev/null +++ b/build.zig.zon @@ -0,0 +1,86 @@ +.{ + // This is the default name used by packages depending on this one. For + // example, when a user runs `zig fetch --save `, this field is used + // as the key in the `dependencies` table. Although the user can choose a + // different name, most users will stick with this provided value. + // + // It is redundant to include "zig" in this name because it is already + // within the Zig package namespace. + .name = .observations_on_the_sublime_dyna, + + // This is a [Semantic Version](https://semver.org/). + // In a future version of Zig it will be used for package deduplication. + .version = "0.0.0", + + // Together with name, this represents a globally unique package + // identifier. This field is generated by the Zig toolchain when the + // package is first created, and then *never changes*. This allows + // unambiguous detection of one package being an updated version of + // another. + // + // When forking a Zig project, this id should be regenerated (delete the + // field and run `zig build`) if the upstream project is still maintained. + // Otherwise, the fork is *hostile*, attempting to take control over the + // original project's identity. Thus it is recommended to leave the comment + // on the following line intact, so that it shows up in code reviews that + // modify the field. + .fingerprint = 0xd3af2d9ec070a04e, // Changing this has security and trust implications. + + // Tracks the earliest Zig version that the package considers to be a + // supported use case. + .minimum_zig_version = "0.14.1", + + // This field is optional. + // Each dependency must either provide a `url` and `hash`, or a `path`. + // `zig build --fetch` can be used to fetch all dependencies of a package, recursively. + // Once all dependencies are fetched, `zig build` no longer requires + // internet connectivity. + .dependencies = .{ + // See `zig fetch --save ` for a command-line interface for adding dependencies. + //.example = .{ + // // When updating this field to a new URL, be sure to delete the corresponding + // // `hash`, otherwise you are communicating that you expect to find the old hash at + // // the new URL. If the contents of a URL change this will result in a hash mismatch + // // which will prevent zig from using it. + // .url = "https://example.com/foo.tar.gz", + // + // // This is computed from the file contents of the directory of files that is + // // obtained after fetching `url` and applying the inclusion rules given by + // // `paths`. + // // + // // This field is the source of truth; packages do not come from a `url`; they + // // come from a `hash`. `url` is just one of many possible mirrors for how to + // // obtain a package matching this `hash`. + // // + // // Uses the [multihash](https://multiformats.io/multihash/) format. + // .hash = "...", + // + // // When this is provided, the package is found in a directory relative to the + // // build root. In this case the package's hash is irrelevant and therefore not + // // computed. This field and `url` are mutually exclusive. + // .path = "foo", + // + // // When this is set to `true`, a package is declared to be lazily + // // fetched. This makes the dependency only get fetched if it is + // // actually used. + // .lazy = false, + //}, + }, + + // Specifies the set of files and directories that are included in this package. + // Only files and directories listed here are included in the `hash` that + // is computed for this package. Only files listed here will remain on disk + // when using the zig package manager. As a rule of thumb, one should list + // files required for compilation plus any license(s). + // Paths are relative to the build root. Use the empty string (`""`) to refer to + // the build root itself. + // A directory listed here means that all files within, recursively, are included. + .paths = .{ + "build.zig", + "build.zig.zon", + "src", + // For example... + //"LICENSE", + //"README.md", + }, +} diff --git a/src/main.cpp b/src/main.cpp deleted file mode 100644 index 231a050..0000000 --- a/src/main.cpp +++ /dev/null @@ -1,61 +0,0 @@ -#include -#include - -int main(int argc, char* argv[]) { - // Initialize SDL2 - if (SDL_Init(SDL_INIT_VIDEO) < 0) { - std::cerr << "SDL2 initialization failed: " << SDL_GetError() << std::endl; - return 1; - } - - // Create window - SDL_Window* window = SDL_CreateWindow( - "Observations on the Sublime Dynamics of Eroding Matter", - SDL_WINDOWPOS_UNDEFINED, - SDL_WINDOWPOS_UNDEFINED, - 800, 600, - SDL_WINDOW_SHOWN - ); - - if (!window) { - std::cerr << "Window creation failed: " << SDL_GetError() << std::endl; - SDL_Quit(); - return 1; - } - - // Create renderer - SDL_Renderer* renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED); - if (!renderer) { - std::cerr << "Renderer creation failed: " << SDL_GetError() << std::endl; - SDL_DestroyWindow(window); - SDL_Quit(); - return 1; - } - - // Main event loop - bool running = true; - SDL_Event event; - - while (running) { - // Handle events - while (SDL_PollEvent(&event)) { - if (event.type == SDL_QUIT) { - running = false; - } - } - - // Clear screen with black background - SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255); - SDL_RenderClear(renderer); - - // Present the renderer - SDL_RenderPresent(renderer); - } - - // Cleanup - SDL_DestroyRenderer(renderer); - SDL_DestroyWindow(window); - SDL_Quit(); - - return 0; -} diff --git a/src/main.zig b/src/main.zig new file mode 100644 index 0000000..af3fe11 --- /dev/null +++ b/src/main.zig @@ -0,0 +1,11 @@ +const std = @import("std"); + +pub fn main() !void { + const stdout_file = std.io.getStdOut().writer(); + var bw = std.io.bufferedWriter(stdout_file); + const stdout = bw.writer(); + + try stdout.print("Hello, world!\n", .{}); + + try bw.flush(); +}