- Lua Game Development Cookbook
- Mário Ka?uba
- 390字
- 2021-07-16 13:23:08
Getting LuaSDL for libSDL 1.2
LuaSDL is a binding to the famous libSDL 1.2 multimedia library. LuaSDL provides an interface not only to libSDL itself but also to the SDL_image, SDL_mixer, SDL_net, SDL_ttf, and SDL_gfx libraries.
Getting ready
The LuaSDL module depends on many external libraries. To make the module preparation easier, there's a LuaSDL project repository at GitHub with support for the CMake building system. This project repository contains all the necessary external libraries, which make module building process a breeze.
You'll need to have the following software installed to successfully build the LuaSDL module:
- The git version control system is available at https://git-scm.com/
- The CMake building system version 3.1 or newer is available at http://www.cmake.org/
- The C/C++ compiler, Microsoft Visual Studio, GCC, and clang are supported
- The Netwide Assembler—NASM (optional) used only for CPU-specific optimizations is available at http://www.nasm.us/
How to do it…
The building process of LuaSDL is the same on both Windows and Linux operating systems with minor differences:
- Download the LuaSDL source code with the
git
command:git clone --recursive https://github.com/soulik/LuaSDL.git
- You need to create an empty working directory, which will contain the project and binary files:
mkdir LuaSDL/build cd LuaSDL/build
- Now, you can run the
CMake
building tool to prepare the project files or to make further changes to the building configuration:cmake ..
- After successful preparation of the building environment, you can either open the project file in your IDE or simply run the make command to start the compilation depending on the compiler of your choice:
- For Microsoft Visual Studio—use the
luasdl.sln
file - For Linux users—use the
make
command
- For Microsoft Visual Studio—use the
- The successful compilation will result in binary files stored in the
bin
andlib
directories.
Note that Microsoft Visual Studio will generate the .dll binary files in the bin directory, whereas, Linux users will find the same binary files in the lib directory. You can copy all the binary files into one directory where your Lua application resides. This will ensure that the Lua interpreter finds all the necessary binary modules.
There's more…
LuaSDL uses libSDL 1.2, which is more than 5 years old. Despite being no longer maintained, the LuaSDL package is considered as stable.
LuaSDL2 is being developed at the time of writing. You can access the source code from GitHub at https://github.com/soulik/LuaSDL-2.0.git.
- Kubernetes實(shí)戰(zhàn)
- 無代碼編程:用云表搭建企業(yè)數(shù)字化管理平臺
- Microsoft Dynamics 365 Extensions Cookbook
- 基于差分進(jìn)化的優(yōu)化方法及應(yīng)用
- Mastering KnockoutJS
- 好好學(xué)Java:從零基礎(chǔ)到項(xiàng)目實(shí)戰(zhàn)
- Android Sensor Programming By Example
- Android 游戲開發(fā)大全(第二版)
- Python無監(jiān)督學(xué)習(xí)
- CISSP in 21 Days(Second Edition)
- Kudu:構(gòu)建高性能實(shí)時(shí)數(shù)據(jù)分析存儲系統(tǒng)
- 代碼揭秘
- WordPress Responsive Theme Design
- Hybrid Mobile Development with Ionic
- Java并發(fā)編程深度解析與實(shí)戰(zhàn)