Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Lua Game Development Cookbook

You're reading from   Lua Game Development Cookbook Over 70 recipes that will help you master the elements and best practices required to build a modern game engine using Lua

Arrow left icon
Product type Paperback
Published in Jul 2015
Publisher
ISBN-13 9781849515504
Length 360 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Mário Kašuba Mário Kašuba
Author Profile Icon Mário Kašuba
Mário Kašuba
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. Basics of the Game Engine 2. Events FREE CHAPTER 3. Graphics – Common Methods 4. Graphics – Legacy Method with OpenGL 1.x–2.1 5. Graphics – Modern Method with OpenGL 3.0+ 6. The User Interface 7. Physics and Game Mechanics 8. Artificial Intelligence 9. Sounds and Networking Index

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:

  1. Download the LuaSDL source code with the git command:
    git clone --recursive https://github.com/soulik/LuaSDL.git
    
  2. You need to create an empty working directory, which will contain the project and binary files:
    mkdir LuaSDL/build
    cd LuaSDL/build
    
  3. Now, you can run the CMake building tool to prepare the project files or to make further changes to the building configuration:
    cmake ..
    
  4. 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
  5. The successful compilation will result in binary files stored in the bin and lib 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.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime