Skip to content

PathOfBuildingCommunity/PathOfBuilding-SimpleGraphic

Repository files navigation

Path of Building Community SimpleGraphic.dll

Introduction

SimpleGraphic.dll is the host environment for Lua. It contains the API used by the application's Lua logic, as well as a 2D OpenGL ES 2.0 renderer, window management, input handling, and a debug console. It exports one symbol, RunLuaFileAsWin, which is passed a C-style argc/argv argument list, with the script path as argv[0].

The Windows-specific code is contained in 5 files:

  • win\entry.cpp: Contains the DLL export It just creates the system main module, and runs it
  • engine\system\win\sys_main.cpp: The system main module. It initialises the application, and contains generic OS interface functions, such as input and clipboard handling
  • engine\system\win\sys_console.cpp: Manages the debug console window that appears during the program's initialisation
  • engine\system\win\sys_video.cpp: Creates and manages the main program window
  • engine\system\win\sys_opengl.cpp: Initialises OpenGL

Building

SimpleGraphic.dll is currently built using Visual Studio 2022 for 64-bit.

The DLL depends on a number of 3rd-party libraries, all provided either as direct submodules and built by the main CMakeLists.txt file or built from ports in the vcpkg submodule as part of the build process.

The build process will also build the lcurl and lzip Lua extensions against the same LuaJIT version as the DLL is built with.

A short guide on building and debugging the DLL is available in CONTRIBUTING.md.

The INSTALL target will deploy the DLL, its dependencies and the VC++ runtime to the installation directory.

Debugging

Since SimpleGraphic.dll is dynamically loaded by PathOfBuilding.exe, to debug it, run PathOfBuilding.exe and then attach to that process using the "Debug" > "Attach to Process..." menu option in Visual Studio.

Visual Studio can also be configured to start the Path of Building executable when debugging a target which troubleshooting of early startup.

Project dependencies

Runtime and utilities:

  • LuaJIT - fast Lua fork with JIT compilation that has diverged from upstream Lua at version 5.1
  • curl - very common HTTP library, exposed to Lua
  • fmtlib - modern string formatting
  • libsodium - friendly cryptographic primitives, used in SimpleGraphic for fast hashing
  • pkgconf - part of the build process to locate builds of bundled libraries
  • re2 - regex library

Graphics:

  • GLFW - multi-platform windowing library for OpenGL (and other APIs)
  • ANGLE - OpenGL ES runtime from Google built on top of native rendering APIs
  • Glad 2 - OpenGL header generator

Compression and image formats:

  • stb - single-header libraries for many things, here image reading and writing
  • giflib - GIF loading/saving
  • libjpeg-turbo - JPEG loading/saving
  • libpng - PNG loading/saving
  • liblzma - LZMA compression/decompression
  • zlib - zlib compression/decompression

Licence

MIT

For 3rd-party licences, see LICENSE. The licencing information is considered to be part of the documentation.