### Install Packages on Windows (x64-windows-static) Source: https://github.com/samtupy/nvgt/blob/main/other/vcpkg-build-commands.txt Installs a set of specified packages for the x64-windows-static triplet using vcpkg. Includes dependencies like enet6, libflac, curl, and various libraries for graphics, audio, and utilities. ```shell ../vcpkg/bin/vcpkg install --overlay-ports=../vcpkg/ports --overlay-triplets=../vcpkg/triplets --triplet x64-windows-static enet6[*] libflac curl[openssl] libffi miniupnpc[*] libogg opus[*] opusfile sdl3[vulkan] sdl3-image sdl3-ttf freetype[core,bzip2,error-strings,subpixel-rendering,zlib] libvorbis[*] poco[net,netssl,json,util,xml,zip,encodings,mongodb,redis,jwt,prometheus,sevenzip] universalspeech angelscript angelscript-nc reactphysics3d libgit2[core,pcre2] libplist libarchive[core,bzip2,libxml2,lz4,lzma,zstd] bass bass-fx bassmix steam-audio-official ``` -------------------------------- ### Visual Studio 2015 Environment Setup Source: https://github.com/samtupy/nvgt/blob/main/test/data/inflated.txt Configures the Visual Studio 2015 development environment for 32-bit and 64-bit targets. Note: The 64-bit setup involves multiple steps. ```batch :: For 32-bit target call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86 :: For 64-bit target call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64 ``` -------------------------------- ### Install Packages on Windows (arm64-windows-static) Source: https://github.com/samtupy/nvgt/blob/main/other/vcpkg-build-commands.txt Installs a set of specified packages for the arm64-windows-static triplet using vcpkg. This command is similar to the x64 version but targets the ARM64 architecture. ```shell ../vcpkg/bin/vcpkg install --overlay-ports=../vcpkg/ports --overlay-triplets=../vcpkg/triplets --triplet arm64-windows-static enet6[*] libflac curl[openssl] libffi miniupnpc[*] libogg opus[*] opusfile sdl3[vulkan] sdl3-image sdl3-ttf freetype[core,bzip2,error-strings,subpixel-rendering,zlib] libvorbis[*] poco[net,netssl,json,util,xml,zip,encodings,mongodb,redis,jwt,prometheus,sevenzip] universalspeech angelscript angelscript-nc reactphysics3d libgit2[core,pcre2] libplist libarchive[core,bzip2,libxml2,lz4,lzma,zstd] ``` -------------------------------- ### Update and Install Packages on Linux Source: https://github.com/samtupy/nvgt/blob/main/other/vcpkg-build-commands.txt Updates the package list, performs a full upgrade, and installs essential development tools and libraries for Linux. Includes packages for graphics, audio, and general development. ```bash apt update apt full-upgrade -y apt install -y build-essential libtool mesa-common-dev libxext-dev libxcursor-dev ladspa-sdk libxcomposite-dev libsystemd-dev autoconf libxxf86vm-dev libgl1-mesa-dev libxinerama-dev libx11-dev libltdl-dev libgtk-4-dev libglib2.0-dev libspeechd-dev libudev-dev linux-libc-dev libxrandr-dev libxrender-dev libwayland-dev pkg-config xorg-dev libglu1-mesa-dev libxft-dev libgsasl-dev clang python3-jinja2 zip gcc-aarch64-linux-gnu g++-aarch64-linux-gnu ``` -------------------------------- ### Visual Studio 2019 Environment Setup Source: https://github.com/samtupy/nvgt/blob/main/test/data/inflated.txt Configures the Visual Studio 2019 development environment for both 32-bit and 64-bit targets by calling the appropriate vcvars scripts. ```batch :: For 32-bit target call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars32.bat" :: For 64-bit target call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" ``` -------------------------------- ### Install Packages on macOS (x64-osx) Source: https://github.com/samtupy/nvgt/blob/main/other/vcpkg-build-commands.txt Installs openssl and libffi for the x64-osx triplet using vcpkg. This command is for building applications on Intel-based Macs. ```shell ../vcpkg/bin/vcpkg install --overlay-ports=../vcpkg/ports --overlay-triplets=../vcpkg/triplets --triplet x64-osx openssl libffi ``` -------------------------------- ### Install Packages on Linux (x64-linux) Source: https://github.com/samtupy/nvgt/blob/main/other/vcpkg-build-commands.txt Installs a set of specified packages for the x64-linux triplet using vcpkg. This command targets the x64 architecture on Linux systems. ```shell ../vcpkg/bin/vcpkg install --overlay-ports=../vcpkg/ports --overlay-triplets=../vcpkg/triplets --triplet x64-linux enet6[*] libflac curl[openssl] libffi miniupnpc[*] libogg opus[*] opusfile sdl3[vulkan] sdl3-image sdl3-ttf freetype[core,bzip2,error-strings,subpixel-rendering,zlib] libvorbis[*] poco[net,netssl,json,util,xml,zip,encodings,mongodb,redis,jwt,prometheus,sevenzip] angelscript reactphysics3d libgit2[core,pcre2] libplist libarchive[core,bzip2,libxml2,lz4,lzma,zstd] bass bass-fx bassmix steam-audio-official ``` -------------------------------- ### Setup Company and Product Configuration Source: https://github.com/samtupy/nvgt/blob/main/doc/src/references/include/User Data Storage and Retrieval (settings.nvgt)/Classes/settings/Methods/!setup.md Initializes the nvgt object by setting up the company and product details. This activation allows interaction with product data. Supports INI, JSON, and custom DAT formats. ```cpp bool settings::setup(const string company, const string product, const bool local_path, const string format = "ini"); ``` -------------------------------- ### Visual Studio 2017 Environment Setup Source: https://github.com/samtupy/nvgt/blob/main/test/data/inflated.txt Configures the Visual Studio 2017 development environment for both 32-bit and 64-bit targets by calling the appropriate vcvars scripts. ```batch :: For 32-bit target call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat" :: For 64-bit target call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" ``` -------------------------------- ### Install Packages on iOS Simulator (arm64-ios-simulator) Source: https://github.com/samtupy/nvgt/blob/main/other/vcpkg-build-commands.txt Installs a set of specified packages for the arm64-ios-simulator triplet using vcpkg. This command is for building applications for the iOS simulator on ARM64 architecture. ```shell ../vcpkg/bin/vcpkg install --overlay-ports=../vcpkg/ports --overlay-triplets=../vcpkg/triplets --triplet arm64-ios-simulator enet6[*] libflac curl[openssl] libffi miniupnpc[*] libogg opus[*] opusfile sdl3[vulkan] sdl3-image sdl3-ttf freetype[core,bzip2,error-strings,subpixel-rendering,zlib] libvorbis[*] poco[net,netssl,json,util,xml,zip,encodings,mongodb,redis,jwt,prometheus,sevenzip] angelscript reactphysics3d libgit2[core,pcre2] bass bass-fx bassmix steam-audio-official ``` -------------------------------- ### Install Packages on macOS (arm64-osx) Source: https://github.com/samtupy/nvgt/blob/main/other/vcpkg-build-commands.txt Installs a set of specified packages for the arm64-osx triplet using vcpkg. This command is for building applications on Apple Silicon Macs. ```shell ../vcpkg/bin/vcpkg install --overlay-ports=../vcpkg/ports --overlay-triplets=../vcpkg/triplets --triplet arm64-osx enet6[*] libflac curl[openssl] libffi miniupnpc[*] libogg opus[*] opusfile sdl3[vulkan] sdl3-image sdl3-ttf freetype[core,bzip2,error-strings,subpixel-rendering,zlib] libvorbis[*] poco[net,netssl,json,util,xml,zip,encodings,mongodb,redis,jwt,prometheus,sevenzip] angelscript reactphysics3d libgit2[core,pcre2] libplist libarchive[core,bzip2,libxml2,lz4,lzma,zstd] bass bass-fx bassmix steam-audio-official ``` -------------------------------- ### Setup Network Server Source: https://github.com/samtupy/nvgt/blob/main/doc/src/references/builtin/Networking/classes/network/methods/setup_server.md Configures the network object to act as a server, specifying the port to bind to, the maximum number of channels, and the maximum number of allowed peers. ```cpp bool network::setup_server(uint16 bind_port, uint8 max_channels, uint16 max_peers); Arguments: * uint16 bind_port: the port to bind the server to. * uint8 max_channels: the maximum number of channels used on the connection (up to 255). * uint16 max_peers: the maximum number of peers allowed by the connection (maximum is 65535). Returns: bool: true if the server was successfully set up, false otherwise. ``` -------------------------------- ### NVGT Shared Plugin AngelScript Setup Source: https://github.com/samtupy/nvgt/blob/main/ASAddon/plugin/readme.md Essential lines for shared NVGT plugins that use AngelScript. These ensure the use of manually imported AngelScript symbols provided by NVGT. ```c++ #define NVGT_PLUGIN_INCLUDE #include "../../src/nvgt_plugin.h" ``` -------------------------------- ### Install Packages on Android (arm64-android) Source: https://github.com/samtupy/nvgt/blob/main/other/vcpkg-build-commands.txt Installs a set of specified packages for the arm64-android triplet using vcpkg after setting the Android NDK home. This command is for building Android applications. ```shell ../vcpkg/bin/vcpkg install --overlay-ports=../vcpkg/ports --overlay-triplets=../vcpkg/triplets --triplet arm64-android enet6[*] libflac curl[openssl] libffi miniupnpc[*] libogg opus[*] opusfile sdl3[vulkan] sdl3-image sdl3-ttf freetype[core,bzip2,error-strings,subpixel-rendering,zlib] libvorbis[*] poco[net,netssl,json,util,xml,zip,encodings,mongodb,redis,jwt,prometheus,sevenzip] angelscript reactphysics3d libgit2[core,pcre2] bass bass-fx bassmix steam-audio-official ``` -------------------------------- ### Install Packages on iOS (arm64-ios) Source: https://github.com/samtupy/nvgt/blob/main/other/vcpkg-build-commands.txt Installs a set of specified packages for the arm64-ios triplet using vcpkg. This command is for building applications for ARM64-based iOS devices. ```shell ../vcpkg/bin/vcpkg install --overlay-ports=../vcpkg/ports --overlay-triplets=../vcpkg/triplets --triplet arm64-ios enet6[*] libflac curl[openssl] libffi miniupnpc[*] libogg opus[*] opusfile sdl3[vulkan] sdl3-image sdl3-ttf freetype[core,bzip2,error-strings,subpixel-rendering,zlib] libvorbis[*] poco[net,netssl,json,util,xml,zip,encodings,mongodb,redis,jwt,prometheus,sevenzip] angelscript reactphysics3d libgit2[core,pcre2] bass bass-fx bassmix steam-audio-official ``` -------------------------------- ### Install Packages on Linux (arm64-linux) Source: https://github.com/samtupy/nvgt/blob/main/other/vcpkg-build-commands.txt Installs a set of specified packages for the arm64-linux triplet using vcpkg. This command targets the ARM64 architecture on Linux systems. ```shell ../vcpkg/bin/vcpkg install --overlay-ports=../vcpkg/ports --overlay-triplets=../vcpkg/triplets --triplet arm64-linux enet6[*] libflac curl[openssl] libffi miniupnpc[*] libogg opus[*] opusfile sdl3[vulkan] sdl3-image sdl3-ttf freetype[core,bzip2,error-strings,subpixel-rendering,zlib] libvorbis[*] poco[net,netssl,json,util,xml,zip,encodings,mongodb,redis,jwt,prometheus,sevenzip] angelscript reactphysics3d libgit2[core,pcre2] libplist libarchive[core,bzip2,libxml2,lz4,lzma,zstd] ``` -------------------------------- ### Install SDL and other dependencies Source: https://github.com/samtupy/nvgt/blob/main/doc/src/advanced/Building NVGT For Linux.md Installs development libraries for SDL2, OpenSSL, libcurl, and libopus. Note that `libsdl2-dev` is installed and then removed, suggesting a specific version management strategy or a workaround. ```bash sudo apt install libssl-dev libcurl4-openssl-dev libopus-dev libsdl2-dev sudo apt remove libsdl2-dev ``` -------------------------------- ### JSON Configuration Example Source: https://github.com/samtupy/nvgt/blob/main/doc/src/manual/-Toolkit Configuration.md An example of a JSON configuration file for NVGT, demonstrating the structure for 'application' and 'scripting' sections. This format is widely used and easy to generate programmatically. ```json { "application": { "quiet": true }, "scripting": { "compiler_warnings": 1, "allow_multiline_strings": true } } ``` -------------------------------- ### NVGT For Loop Example Source: https://github.com/samtupy/nvgt/blob/main/doc/src/manual/-Game Development Tutorial.md Provides an example of a for loop in NVGT, demonstrating its concise syntax for initialization, condition checking, and iteration. This loop iterates and speaks numbers. ```nvgt void main(){ for(uint i = 1; i < 6; i ++){ screen_reader_speak(i, false); wait(1000); } } ``` -------------------------------- ### Subscripting Code Example Source: https://github.com/samtupy/nvgt/blob/main/doc/src/manual/Subscripting Tutorial.md Example of subscripting code that utilizes imported functions to create and interact with `person` objects. It demonstrates calling `new_person`, accessing data through `people[0].name`, and includes an `add` function with a note about current limitations on return types. ```angelscript string code = "void test() { person@ p = new_person(\"Sam\", 21); new_person(\"reborn\", -1); alert(\"test\", people[0].name); } // This function needs arguments. int64 add(int n1, int n2) { return n1 + n2; // normal int can be passed as argument but not yet for return values, consider it a beta bug. } // This function will be used to demonstrate how to catch script exceptions. void throw_exception() { throw (\"oh no!\"); } "; ``` -------------------------------- ### Install build-essential tools Source: https://github.com/samtupy/nvgt/blob/main/doc/src/advanced/Building NVGT For Linux.md Installs essential build tools on Debian/Ubuntu-based systems, including the GNU compiler collection, make, and other necessary utilities for compiling software. ```bash sudo apt install build-essential gcc g++ make autoconf libtool ``` -------------------------------- ### Building and Installing NVGT for Android Source: https://github.com/samtupy/nvgt/blob/main/doc/src/advanced/Building NVGT for Android.md Commands to build the NVGT runner and stub for Android using Gradle, and to install the runner application on connected devices. ```bash cd jni ./gradlew assembleRunnerDebug assembleStubRelease ``` ```bash ./gradlew installRunnerDebug ``` -------------------------------- ### NVGT Plugin SConscript Example Source: https://github.com/samtupy/nvgt/blob/main/doc/src/advanced/Plugin Creation.md An example SConscript file demonstrating how to build both shared and static versions of an NVGT plugin, including linking against external libraries and defining static plugin names. ```python Import("env") # Create the shared version of our plugin if the user has not disabled this feature. if ARGUMENTS.get("no_shared_plugins", "0") == "0": env.SharedLibrary("#release/lib/test_plugin", ["test.cpp"], libs = ["user32"]) # If we want to make a static version along side our shared one, we need to specifically rebuild the object file containing the plugin's entry point with a different name so that SCons can maintain a proper dependency graph. Note the NVGT_PLUGIN_STATIC define. static = env.Object("test_plugin_static", "test.cpp", CPPDEFINES = [("NVGT_PLUGIN_STATIC", "test_plugin")]) # now actually build the static library, reusing the same variable from above for fewer declarations. static = env.StaticLibrary("#build/lib/test_plugin", [static]) # Tell NVGT's SConstruct script that the static version of this plugin needs symbols from the user32 library. static = [static, "user32"] ``` -------------------------------- ### NVGT Do-While Loop Example Source: https://github.com/samtupy/nvgt/blob/main/doc/src/manual/-Game Development Tutorial.md Shows how to implement a do-while loop in NVGT, ensuring the code block executes at least once before checking the condition. This example speaks numbers and increments a counter. ```nvgt #include "speech.nvgt" void main(){ int counter = 1; do{ speak(counter); wait(1000); counter+=1; } while(counter < 6); } ``` -------------------------------- ### settings::setup Method API Documentation Source: https://github.com/samtupy/nvgt/blob/main/doc/src/references/include/User Data Storage and Retrieval (settings.nvgt)/Classes/settings/Methods/!setup.md Provides detailed API documentation for the `settings::setup` method. Explains parameters, return values, and supported data formats for project configuration. ```APIDOC settings::setup(company: string, product: string, local_path: bool, format: string = "ini") Description: Sets up the company and product, activating the object for data interaction. Parameters: company (string): The name of the company, used as the main folder. product (string): The name of the product, used as the subfolder. local_path (bool): If true, data is saved in the script's execution path; otherwise, in appdata. format (string, optional): The data format to use. Defaults to "ini". Supported formats include "ini" (.ini), "json" (.json), and "nvgt" (.dat). Returns: bool: true if the setup is successful, false otherwise. Remarks: Currently, file extensions cannot be modified. Future support for custom extensions will be documented. ``` -------------------------------- ### Launch NVGT Script with Debugger Source: https://github.com/samtupy/nvgt/blob/main/doc/src/advanced/Debugging Scripts.md Starts an NVGT script with the Angelscript debugger attached using the command-line interface. Requires the '-d' or '--debug' flag. ```nvgt nvgt -d mygame.nvgt ``` -------------------------------- ### Android SDK Setup Notes Source: https://github.com/samtupy/nvgt/blob/main/doc/src/advanced/Building NVGT for Android.md Notes on setting up the Android SDK on Windows, including handling spaces in paths, running Gradle as administrator, setting environment variables, accepting licenses, and locating the Java runtime. ```batch mklink /d C:\android "C:\Program Files (x86)\Android" ``` ```batch gradlew -stop ``` ```batch set ANDROID_NDK_HOME=path\to\ndk set ANDROID_HOME=path\to\sdk set JAVA_HOME=path\to\java ``` -------------------------------- ### Thread Creation and Management in NVGT Source: https://github.com/samtupy/nvgt/blob/main/doc/src/manual/Concurrency Tutorial.md Demonstrates the creation, starting, joining, and priority management of threads in NVGT. It highlights the importance of thread naming and the structure of thread callbacks. ```nvgt // Create a thread with a unique ID thread myThread("thread_id_1"); // Start the thread with a callback function and arguments myThread.start(my_callback_function, {"arg1": "value1"}); // Wait for the thread to complete myThread.join(); // Wait for the thread to complete with a timeout myThread.join(timeout_ms); // Change thread priority (use with caution) myThread.priority = new_priority; ``` -------------------------------- ### Cloning and Setting Up NVGT User Repository Source: https://github.com/samtupy/nvgt/blob/main/doc/src/advanced/Plugin Creation.md Provides bash commands to clone the nvgt and nvgt_user repositories and copy setup files. This is a convenience mechanism for setting up a development environment from scratch. ```bash git clone https://github.com/samtupy/nvgt cd nvgt/user git clone https://github.com/samtupy/nvgt_user cp nvgt_user/setup/* . ``` -------------------------------- ### Setup Network Client Source: https://github.com/samtupy/nvgt/blob/main/doc/src/references/builtin/Networking/classes/network/methods/setup_client.md Configures the network object to act as a client, specifying the maximum number of channels and peers allowed. Returns true on success, false otherwise. ```APIDOC network::setup_client(uint8 max_channels, uint16 max_peers) Sets up the network object as a client. Arguments: max_channels: uint8 - the maximum number of channels used on the connection (up to 255). max_peers: uint16 - the maximum number of peers allowed by the connection (maximum is 65535). Returns: bool: true if the client was successfully set up, false otherwise. ``` -------------------------------- ### Copyright Disclaimer Example Source: https://github.com/samtupy/nvgt/blob/main/doc/OSL/LGPL/NVDA.txt Example of a copyright disclaimer that an employer might sign for a library. ```text Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice ``` -------------------------------- ### Nvgt Subscript Module Initialization and Execution Source: https://github.com/samtupy/nvgt/blob/main/doc/src/manual/Subscripting Tutorial.md This snippet illustrates the process of creating, configuring, and executing a script module in Nvgt. It covers setting access masks, building the module, binding imported functions, retrieving functions by declaration or name, and calling them with and without arguments, including handling return values and exceptions. ```nvgt #include "nvgt_subsystems.nvgt" // To limit the subscript's access to certain nvgt core functions. void main() { // Create a new module. script_module@ mod = script_get_module("example", 1); // The second argument can be 0 (only if exists), 1 (create if not exists), and 2 (always create). // Add the code sections, usually it's a section per file though they can come from anywhere. mod.add_section("imports", imports); mod.add_section("code", code); // Remember when I talked about an access mask earlier that allows you to limit what core engine functions can be called by the subscript? Now is the time to set that. If the function permissions aren't set at build time, there will be compilation errors and/or wider access than you intended. An access mask is just an integer that is used to store single bit flags as to whether the subscript should have access to a given set of functions. You can see the full list in nvgt_subsystems.nvgt. You can simply binary OR the ones you want to grant access to in this next call, all others will be disabled. mod.set_access_mask(NVGT_SUBSYSTEM_SCRIPTING_SANDBOX | NVGT_SUBSYSTEM_UI); // Now we need to build the module. We should collect any errors here which are returned in a string array. You should display them if the build function returns something less than 0. string[] err; if (mod.build(err) < 0) { alert("error", join(err, "\r\n\r\n")); exit(); } // Next, if any functions are being shared via the imported functions method, we need to bind their addresses from this nvgt_game module to our example module. Don't worry it's just one line + error checking, but what is happening behind the scenes in this next call is that we are looping through all functions that have been imported, and we're searching for them by declaration in the nvgt_game module. When we find them, we tell the example module the function's address. if (mod.bind_all_imported_functions() < 0) { alert("error", "failed to bind any imported functions"); exit(); } // Cool, we're ready to go! Everything above this point you can consider an initialization step, code up to this point executes rarely, usually you'll want to store a handle to the script_module object somewhere and other parts of your code will repeatedly perform the steps below as calls are needed. Some wrapper functions that make calling common function types even easier are supplied later in this tutorial. We're about to start calling functions now. We can either retrieve a function by declaration, by index or by name. script_function@ func = mod.get_function_by_decl("void test()"); // This is useful because we can limit the returned function by return type and argument types, meaning that if 2 functions with the same name but different arguments exist, you will know you get the correct one. if (@func == null) { alert("error", "can't find function"); exit(); } // This looks a bit bulky, but it won't in actual usage when you don't need to show UI upon this error. Lets call the function! func({}); // Usually a dictionary of arguments is passed, this function takes none. Soon I think we'll be able to use funcdefs to call functions from shared code completely naturally, but we're not there yet and so now we use a dictionary, properly demonstrated in the next call. // Now lets demonstrate how to pass function arguments and how to fetch the return value. We'll skip the error check here we know the add function exists. @func = mod.get_function_by_name("add"); // Notice the lack of signature verification here. dictionary@ r = func.call({{1, people[0].age}, {2, people[1].age}}); // Notice how we can access those person objects created from the subscript. // The return value will be stored in a key called 0, and the other values will maintain the indexes that you passed to them encase the function has modified a value using an &out reference. int64 result = 1; r.get(0, result); alert("add test", result); // Usually it's good to check for errors when calling functions, unfortunately. In time this may be compressed so that a default error handler may exist or something of the sort, for now, this is possible. err.resize(0); @func = mod.get_function_by_name("throw_exception"); func({}, err); if (err.size() > 0) alert("test", join(err, "\r\n")); } ``` -------------------------------- ### Initialize Settings Object Source: https://github.com/samtupy/nvgt/blob/main/doc/src/references/include/User Data Storage and Retrieval (settings.nvgt)/Classes/settings/!settings.md Creates an instance of the Settings class. The object is inactive upon initialization and requires the `setup` method to be called to become active. ```python settings(); ``` -------------------------------- ### Create Fat Binaries on macOS Source: https://github.com/samtupy/nvgt/blob/main/other/vcpkg-build-commands.txt Command to create universal (fat) binaries by lipo-ing together architecture-specific static libraries. This is used for creating libraries compatible with multiple architectures. ```shell lipo -create arm.a x64.a -output fat.a ``` -------------------------------- ### Play Sound Source: https://github.com/samtupy/nvgt/blob/main/doc/src/references/builtin/Audio/Classes/sound/Methods/play.md Starts playing the sound. Returns true if the sound was able to start playing, false otherwise. ```cpp bool sound::play(); ``` -------------------------------- ### Menu Intro Sequence Source: https://github.com/samtupy/nvgt/blob/main/doc/src/references/include/Menu Interface (menu.nvgt)/Classes/menu/Methods/intro.md Produces the intro sequence for the menu. This function is optional and can be skipped if the intro is not desired. ```cpp void menu::intro(); ``` -------------------------------- ### NVGT Versioning and Installer Source: https://github.com/samtupy/nvgt/blob/main/doc/src/appendix/Changelog.md NVGT now uses semantic versioning (e.g., 0.85.0) and has a cross-platform installer, utilizing NSIS on Windows and a .dmg file on macOS. ```APIDOC NVGT Versioning: Format: MAJOR.MINOR.PATCH (e.g., 0.85.0) NVGT Installer: Windows: NSIS installer macOS: .dmg file ``` -------------------------------- ### Installing Microsoft HTML Help Compiler Source: https://github.com/samtupy/nvgt/blob/main/doc/src/advanced/docgen+.md Provides instructions and a link to download the Microsoft HTML Help Compiler, which is necessary for rebuilding NVGT documentation from source. The link points to an archived version from the Wayback Machine. ```markdown ## Installing the Microsoft HTML help compiler Because of it's simple format and easy distribution, we still prefer to generate the NVGT documentation as a .chm file (compressed HTML help). Unfortunately, the link to the html help workshop installer has been broken by Microsoft for a couple of years now. Fortunately, the installer for this program was archived from Microsoft's official website by the wayback machine. Until we get a better link, you should be able to [download it here](http://web.archive.org/web/20200312222543/http://download.microsoft.com/download/0/A/9/0A939EF6-E31C-430F-A3DF-DFAE7960D564/htmlhelp.exe), though it should be noted that only those wishing to rebuild nvgt's documentation from source will need this program. ``` -------------------------------- ### Play Sound Looped Source: https://github.com/samtupy/nvgt/blob/main/doc/src/references/builtin/Audio/Classes/sound/Methods/play_looped.md Starts playing the sound repeatedly. Returns true if the sound was able to start playing, false otherwise. ```cpp bool sound::play_looped(); ``` -------------------------------- ### Install scons build tool Source: https://github.com/samtupy/nvgt/blob/main/doc/src/advanced/Building NVGT For Linux.md Installs the scons build tool using pip, which is required for the final compilation step of NVGT. ```bash pip3 install scons ``` -------------------------------- ### NVGT Hello World Script Source: https://github.com/samtupy/nvgt/blob/main/doc/src/manual/-Game Development Tutorial.md A basic NVGT script that displays a 'Hello, world!' message in a dialog box. This serves as a fundamental example for new NVGT developers. ```nvgt void main(){ alert("hello", "Hello, world!"); } ``` -------------------------------- ### NVGT Test Runner Execution Source: https://github.com/samtupy/nvgt/blob/main/test/readme.md Demonstrates how to execute the NVGT test runner application from the command line. It covers running all test cases or accessing help information. ```bash nvgt tests.nvgt nvgt tests.nvgt -- -h ``` -------------------------------- ### SConscript Example for Static Plugin Library Source: https://github.com/samtupy/nvgt/blob/main/doc/src/advanced/Plugin Creation.md Demonstrates how to define a static library for a plugin using SCons. It specifies source files, preprocessor definitions, and linked libraries, and then appends the static library to the main nvgt environment. ```python Import(["plugin_env", "nvgt_env"]) static = plugin_env.StaticLibrary("#build/lib/plugname2", ["code.cpp"], CPPDEFINES = [("NVGT_PLUGIN_STATIC", "plugname2")], LIBS = ["somelib"]) vngt_env.Append(LIBS = [static, "somelib"]) ``` -------------------------------- ### Update Sound Start Values Source: https://github.com/samtupy/nvgt/blob/main/doc/src/references/include/Legacy Sound Manager (sound_pool.nvgt)/Classes/sound_pool/Methods/update_sound_start_values.md Updates the starting pan, volume, and pitch for a sound in a given slot. Returns true on success, false otherwise. ```cpp bool sound_pool::update_sound_start_values(int slot, float start_pan, float start_volume, float start_pitch); Arguments: * int slot: the slot of the sound you wish to update. * float start_pan: the new pan to update. * float start_volume: the new volume to update. * float start_pitch: the new pitch to update. Returns: bool: true if the sound is updated successfully, false otherwise. ``` -------------------------------- ### Build NVGT with SCons Source: https://github.com/samtupy/nvgt/blob/main/readme.md Instructions for building the NVGT project from source using SCons. Covers basic build commands and options for disabling plugins or shared libraries. ```python pip install scons scons -s scons -s no_curl_plugin=1 no_git_plugin=1 scons -s no_shared_plugins=1 scons -s no_stubs=1 scons -s -h ``` -------------------------------- ### Example Sound Loading Callback Source: https://github.com/samtupy/nvgt/blob/main/doc/src/references/include/Music System (music.nvgt)/classes/music_manager/methods/set_load_callback.md Provides a practical example of a sound loading callback function that can be used with set_load_callback. This function handles loading sound data from a specified file. ```script sound@ music_load(sound@ sound_to_load, string filename_to_load) { // Usually a sound object will be provided to this function from the music manager. Encase not, if (@sound_to_load is null) @sound_to_load = sound(); if( !sound_to_load.load(filename_to_load, pack_file)) return null; // indicates error. return s; // Return a handle to the loaded sound. } // ... your_music_manager.set_load_callback(music_load); ``` -------------------------------- ### Setup Local Server Source: https://github.com/samtupy/nvgt/blob/main/doc/src/references/builtin/Networking/classes/network/methods/setup_local_server.md Configures the network object to act as a local server. It binds to a specified port, sets the maximum number of channels, and defines the maximum number of allowed peers. ```APIDOC network::setup_local_server(uint16 bind_port, uint8 max_channels, uint16 max_peers) - Sets up the network object as a local server on localhost. - Arguments: - bind_port (uint16): The port to bind the server to. - max_channels (uint8): The maximum number of channels used on the connection (up to 255). - max_peers (uint16): The maximum number of peers allowed by the connection (maximum is 65535). - Returns: bool: true if the server was successfully set up, false otherwise. ``` -------------------------------- ### String Variable Declaration Examples in NVGT Source: https://github.com/samtupy/nvgt/blob/main/doc/src/manual/-Game Development Tutorial.md Provides examples of declaring string variables in NVGT, including single words, multiple words, and strings with non-ASCII characters. ```nvgt string name = "Rory"; ``` ```nvgt string message = "How are you today?"; ``` ```nvgt string message2 = "Hello, and 你好 👋"; ``` -------------------------------- ### Nvgt Toolkit Configuration Tutorial Source: https://github.com/samtupy/nvgt/blob/main/doc/src/appendix/Changelog.md Updates the toolkit configuration tutorial to include all new options. ```nvgt # Toolkit Configuration Tutorial Updates ``` -------------------------------- ### Create and Run NVGT Coroutine Source: https://github.com/samtupy/nvgt/blob/main/doc/src/manual/Concurrency Tutorial.md Demonstrates how to create a coroutine using `create_coroutine` and pass arguments to it. It also shows how to yield control within the coroutine and in the main loop. ```nvgt void create_coroutine(coroutine @func, dictionary @args); void coroutine(dictionary@); void yield(); void generate_factors(dictionary@ args) { const uint64 number = uint64(args["n"]); uint64[] factors = {1, number}; for (uint64 i = 2; i * i <= number; ++i) { if (number % i == 0) { factors.insert_last(i); if (i * i != number) { factors.insert_last(number / i); } } yield(); } factors.sort_ascending(); for (uint64 i = 0; i < factors.length(); ++i) { println("%0".format(factors[i])); yield(); } } dictionary args; args["n"] = 100000; create_coroutine(@generate_factors, @args); while (true) { wait(1); yield(); ... } ``` -------------------------------- ### Get File Size in Pack Source: https://github.com/samtupy/nvgt/blob/main/doc/src/references/builtin/Data Manipulation/Classes/pack/methods/get_file_size.md Retrieves the size of a specified file within a pack. It takes the filename as input and returns the file size in bytes. If the file is not found, it returns 0. ```cpp uint pack::get_file_size(const string&in filename); Arguments: * const string&in filename: the name of the file to query the size of. Returns: uint: the size of the file (in bytes), or 0 if no file with that name was found. ```