LuaCheia Logo  

LuaCheia Reference Manual

SDL

Synopsis

cheia.load “SDL”
 
SDL.SDL_Init(SDL.SDL_INIT_VIDEO)
screen = SDL.SDL_SetVideoMode(width, height, bpp, flags)
background = SDL.SDL_MapRGB(screen.format, r, g, b)
 
events = SDL.SDL_Event_new()
while SDL.SDL_PollEvent(events) ~= 0 do
     ...
end
 
sprite = SDL.SDL_LoadBMP(file)
sprite_disp = SDL.SDL_DisplayFormat(sprite)
SDL.SDL_FreeSurface(sprite)
SDL.SDL_BlitSurface(sprite_disp, src_rect, screen, dest_rect)

Description

This module provides a binding for the Simple DirectMedia Layer, a cross-platform multimedia API. It provides uniform access to 2D and 3D (OpenGL) graphics, audio output, and keyboard, mouse, and joystick input.

Examples

Reference

This section is intended to supplement the libsdl documentation found at http://sdldoc.csn.ul.ie/. It simply lists the functions available and notes where they differ from the C API equivalents.

Issues

Could REALLY do with an OO API.

Why is this module name uppercase when all the others aren't?

See also

The LibSDL website, http://www.libsdl.org/.

Revision history

Added in LuaCheia 5.0.

Credits

Relies on LibSDL, see http://www.libsdl.org/credits.php.

LuaCheia module by Asko Kauppi.

Documentation for LuaCheia by Jamie Webb.

Return to main site

Introduction

 » Writing LuaCheia modules

Module Reference

 » bit
 » cgi
 » fuzzy
 » md5
 » pack
 » rex
 » SDL
 » shelve
 » sqlite

Appendices

 » Module path conventions
 » Module names
 » Application Binary Interface
 » Credits