Coder Social home page Coder Social logo

luasdl2's Introduction

Lua-SDL2 (SDL2 binding for Lua)

Lua-SDL2 is a pure C binding of SDL2 to Lua 5.1, Lua 5.2, Lua 5.3, Lua 5.4, and LuaJIT.

The current version is 2.1, compatible with SDL 2.0.1 - 2.0.5.

Lua-SDL2 follows the SemVer standard with regards to project versioning.

Features

Lua-SDL2 is a portable binding of SDL2, written in pure C for efficiency. It tries to stay as close to SDL as possible, acting as a simple binding rather than attempting to re-design the interaction between the programmer and SDL.

Lua-SDL2 takes full advantage of Lua's object-oriented capabilities wherever possible, allowing the programmer to fully leverage SDL's inherent object-oriented design.

Lua-SDL2 is very well documented, with copious source-code comments, and a full API reference available at the wiki.

Compatibility

Lua-SDL2 is designed to be as compatible as possible. The library has support for all the latest features of SDL2, while still compiling with SDL 2.0.1.

If the library is compiled with a newer point release of SDL than what is listed here, the library should still function, simply without access to the newer features.

Lua-SDL2 is compatible with:

* Lua 5.1, 5.2, 5.3, 5.4 or LuaJIT
* SDL 2.0.1 and greater

Installing

If you have LuaRocks installed,

$ luarocks install lua-sdl2

Otherwise, read INSTALL.md for instructions to build it yourself.

Website

The official website is hosted at https://github.com/Tangent128/luasdl2.

The current documentation is available at the associated wiki.

Author and Maintainer

The Lua-SDL2 library was written by David Demelier.

It is currently being maintained by Joseph Wallace.

luasdl2's People

Contributors

emperorpenguin18 avatar fperrad avatar hishamhm avatar jcw87 avatar markand avatar setop avatar shamazmazum avatar tangent128 avatar tdwtp avatar tpetazzoni avatar waldyrious avatar web-eworks avatar xriss avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

luasdl2's Issues

Quick Question!

Hello does luasdl 2 work with android? I mean can I compile it to android and make it work?Also does it work on all desktop platforms? Thanks!

Edit 1 : It works with 2d and 3d right?

Undefined symbol

I get the following error when trying to require the .so file from a lua project:

"error loading module 'SDL' from file '/usr/local/lib/lua/5.1/SDL.so'" : 0 : undefined symbol

image.load function couldn't loade PNG with with pixelformat = PNG

Debugging session started in '/opt/zbstudio/myprograms/'. ...e/warpspeedscp/luasdl2/tutorials/04-drawing/tutorial.lua:19: Couldn't open Lua-SDL2.png stack traceback: [C]: in function 'error' ...e/warpspeedscp/luasdl2/tutorials/04-drawing/tutorial.lua:19: in local 'trySDL' ...e/warpspeedscp/luasdl2/tutorials/04-drawing/tutorial.lua:48: in main chunk Debugging session completed (traced 26 instructions). Program completed in 40.08 seconds (pid: 2418).

I was testing SDL2 after installation, and this is what happened.
It ran into a problem when image.load() was called.
Any ideas on why this is happening

Compile on mac issues

installed all the libs, seems to need pointing directly to the headerfiles

`Warning: falling back to curl - install luasec to get native HTTPS support
Installing https://luarocks.org/lua-sdl2-2.0.3.4.0-1.src.rock

Error: Could not find header file for SDL2
No file SDL2/SDL_scancode.h in /Library/Frameworks/SDL2.framework/Headers/
You may have to install SDL2 in your system and/or pass SDL2_DIR or SDL2_INCDIR to the luarocks command.
Example: luarocks install lua-sdl2 SDL2_DIR=/usr/local
Blackbook:luarocks-2.4.1 charlottelilyfields$ #sudo luarocks install lua-sdl2 SDL2_INCDIR=/Library/Frameworks/SDL2.framework/Headers/* SDL2_INCDIR=/Library/Frameworks/SDL2_image.framework/Headers SDL2_INCDIR=/Library/Frameworks/SDL2_mixer.framework/Headers SDL2_INCDIR=/Library/Frameworks/SDL2_net.framework/Headers SDL2_INCDIR=/Library/Frameworks/SDL2_ttf.framework/Headers`

is used there because i didn't want to run it again

Super bad fps

Ok,as usually when I want to start learning a new game frameworks or engine the first thing I do it's to test it's performance.The same thing I did with luasdl2 and I got scared by the results.Very very bad fps when only drawing 500 images(47fps).
Check my code here: http://www.pasteall.org/58070/lua
Luckly I have the solution for this.I was thinking that we need an simple c++ class system for entities or something where all the drawing is taken care of and just the logic is made in lua.For that I'd want to hear from you guys some IDEs for C++,because I'd like to start playing around!

SDL 2.0.4 support

  1. Bind applicable functionality from the below release notes.
  2. Do so in a manner that retains compatibility when compiling against older SDL versions.

SDL 2.0.4 Release notes

In addition to numerous bug fixes, here are the major changes since 2.0.3:
General:

  • Added support for web applications using Emscripten, see docs/README-emscripten.md for more information
  • Added support for web applications using Native Client (NaCl), see docs/README-nacl.md for more information
  • Added an API to queue audio instead of using the audio callback:
    SDL_QueueAudio(), SDL_GetQueuedAudioSize(), SDL_ClearQueuedAudio()
  • Added events for audio device hot plug support:
    SDL_AUDIODEVICEADDED, SDL_AUDIODEVICEREMOVED
  • Added SDL_PointInRect()
  • Added SDL_HasAVX2() to detect CPUs with AVX2 support
  • Added SDL_SetWindowHitTest() to let apps treat parts of their SDL window like traditional window decorations (drag areas, resize areas)
  • Added SDL_GetGrabbedWindow() to get the window that currently has input grab, if any
  • Added SDL_RenderIsClipEnabled() to tell whether clipping is currently enabled in a renderer
  • Added SDL_CaptureMouse() to capture the mouse to get events while the mouse is not in your window
  • Added SDL_WarpMouseGlobal() to warp the mouse cursor in global screen space
  • Added SDL_GetGlobalMouseState() to get the current mouse state outside of an SDL window* Added a direction field to mouse wheel events to tell whether they are flipped
    (natural) or not
  • Added GL_CONTEXT_RELEASE_BEHAVIOR GL attribute (maps to [WGL|GLX]ARB_context
    flush_control extension)
  • Added EGL_KHR_create_context support to allow OpenGL ES version selection on s
    ome platforms* Added NV12 and NV21 YUV texture support for OpenGL and OpenGL ES 2.0 renderers
  • Added a Vivante video driver that is used on various SoC platforms
  • Added an event SDL_RENDER_DEVICE_RESET that is sent from the D3D renderers when the D3D device is lost, and from Android's event loop when the GLES context ha
    d to be recreated
  • Added a hint SDL_HINT_NO_SIGNAL_HANDLERS to disable SDL's built in signal hand
    ling* Added a hint SDL_HINT_THREAD_STACK_SIZE to set the stack size of SDL's threads
  • Added SDL_sqrtf(), SDL_tan(), and SDL_tanf() to the stdlib routines
  • Improved support for WAV and BMP files with unusual chunks in them
  • Renamed SDL_assert_data to SDL_AssertData and SDL_assert_state to SDL_AssertSt
    ate
  • Added a hint SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN to prevent window interaction while cursor is hidden
  • Added SDL_GetDisplayDPI() to get the DPI information for a display* Added SDL_JoystickCurrentPowerLevel() to get the battery level of a joystick
  • Added SDL_JoystickFromInstanceID(), as a helper function, to get the SDL_Joystick* that an event is referring to.
  • Added SDL_GameControllerFromInstanceID(), as a helper function, to get the SDL_GameController* that an event is referring to.

Windows:

  • Added support for Windows Phone 8.1 and Windows 10/UWP (Universal Windows Platform)
  • Timer resolution is now 1 ms by default, adjustable with the SDL_HINT_TIMER_RESOLUTION hint
  • SDLmain no longer depends on the C runtime, so you can use the same .lib in both Debug and Release builds
  • Added SDL_SetWindowsMessageHook() to set a function to be called for every windows message before TranslateMessage()
  • Added a hint SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP to control whether SDL_PumpEvents() processes the Windows message loop
  • You can distinguish between real mouse and touch events by looking for SDL_TOUCH_MOUSEID in the mouse event "which" field
  • SDL_SysWMinfo now contains the window HDC
  • Added support for Unicode command line options
  • Prevent beeping when Alt-key combos are pressed
  • SDL_SetTextInputRect() re-positions the OS-rendered IME
  • Added a hint SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 to prevent generating SDL_WINDOWEVENT_CLOSE events when Alt-F4 is pressed
  • Added a hint SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING to use the old axis and button mapping for XInput devices (deprecated)

Mac OS X:

  • Implemented drag-and-drop support
  • Improved joystick hot-plug detection
  • The SDL_WINDOWEVENT_EXPOSED window event is triggered in the appropriate situations
  • Fixed relative mouse mode when the application loses/regains focus
  • Fixed bugs related to transitioning to and from Spaces-aware fullscreen-desktop mode
  • Fixed the refresh rate of display modes
  • SDL_SysWMInfo is now ARC-compatible
  • Added a hint SDL_HINT_MAC_BACKGROUND_APP to prevent forcing the application to become a foreground process

Linux:

  • Enabled building with Mir and Wayland support by default.
  • Added IBus IME support
  • Added a hint SDL_HINT_IME_INTERNAL_EDITING to control whether IBus should handle text editing internally instead of sending SDL_TEXTEDITING events
  • Added a hint SDL_HINT_VIDEO_X11_NET_WM_PING to allow disabling _NET_WM_PING protocol handling in SDL_CreateWindow()
  • Added support for multiple audio devices when using Pulseaudio
  • Fixed duplicate mouse events when using relative mouse motion

iOS:

  • Added support for iOS 8
  • The SDL_WINDOW_ALLOW_HIGHDPI window flag now enables high-dpi support, and SDL_GL_GetDrawableSize() or SDL_GetRendererOutputSize() gets the window resolution in pixels
  • SDL_GetWindowSize() and display mode sizes are in the "DPI-independent points" / "screen coordinates" coordinate space rather than pixels (matches OS X behavior)
  • Added native resolution support for the iPhone 6 Plus
  • Added support for MFi game controllers
  • Added support for the hint SDL_HINT_ACCELEROMETER_AS_JOYSTICK
  • Added sRGB OpenGL ES context support on iOS 7+
  • Added support for SDL_DisableScreenSaver(), SDL_EnableScreenSaver() and the hint SDL_HINT_VIDEO_ALLOW_SCREENSAVER
  • SDL_SysWMinfo now contains the OpenGL ES framebuffer and color renderbuffer objects used by the window's active GLES view
  • Fixed various rotation and orientation issues
  • Fixed memory leaks

Android:

  • Added a hint SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH to prevent mouse events from being registered as touch events
  • Added hints SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION and SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION
  • Added support for SDL_DisableScreenSaver(), SDL_EnableScreenSaver() and the hint SDL_HINT_VIDEO_ALLOW_SCREENSAVER
  • Added support for SDL_ShowMessageBox() and SDL_ShowSimpleMessageBox()

Raspberry Pi:

  • Added support for the Raspberry Pi 2

Cmake on OSX

As seen in #19, cmake on OSX apparently:

  • does not locate the core SDL framework
  • does locate SDL-image, ntet, etc.
  • does not build Lua module swith the necessary -undefined dynamic_lookup linker flags

[FUTURE REQUEST] building to an application

this is way down the line...
but if people who are using this binding, i think maybe a tutorial/tips etc on making your lua creation into an actual application would be a good path.

once im more into lua-SDL2, ill make a duff project and do an Xcode one and post up on this repo. as said, wont be soon, but good to plan ;)

Possible Versioning Change

(Continuing on from discussion on #57).

How about 'Ver. x.x(.x), for SDL 2.0.1 - 2.0.5'? As there's at least some effort for backwards compatibility going on, having the latest SDL version in the main version number seems counter-intuitive.

Something I would additionally like to see would be a unified set of guidelines for what increments which version digit, perhaps even adopting the SemVer standard.

At some point, to facilitate added functionality, I may want to try to move the obj:getWhatever() interface to a obj.whatever implicit-getter style interface (probably using lstruct, once I get the C API production-ready). A big 'Breaking Changes' number to increment would be a virtual necessity with those kinds of changes.

Lua 5.3 support

The code needs to be updated to take into account the changes to the Lua API in 5.3.

  • needs to run under Lua 5.3 without any compatibility flags set in Lua
  • obviously can't be called "done" until Lua 5.3 itself is done, but a branch can track the work versions meanwhile
  • if at all possible, don't drop Lua 5.1 support in doing so.

channel first/last method results in deadlock

I always got deadlock when use channel.first/push/pop. noticed that there might be issue with the codes.

static const Variant *
channelFirst(const Channel *c)
{
	Variant *v;

	SDL_LockMutex(c->mutex);
	if (STAILQ_EMPTY(&c->queue))
		return NULL;   //<---- here return without unlock mutex ???

	v = STAILQ_FIRST(&c->queue);
	SDL_UnlockMutex(c->mutex);

	return v;
}

Compiling on Windows 10 x64

Which exactly SDL2 libraries (e.g. you need SDL2-devel-2.0.4-mingw.tar.gz, SDL2_image-2.0.1.zip, etc) do I need to download to make with Cmake and then compile with Mingw? Do I need Mingw32 or Mingw64? Which version of Cmake do I need?

lua-sdl2 installation on win7

I have successfully installed lua-sdl2 on linux (ubuntu) using luarocks,by typing "luarocks install lua-sdl2",though some other libraries are needed before this step. But it is still easy compared to the installation on win7.
I have read the readme.txt and install.txt in the lua-sdl2 source code folder,but still don't know how to install it on win7. And I also got that lua-sdl2 has already been tested on win7.
Is there anyone who has already made it? Or is there any helpful links that can be sent to me?
Thank you very much!

build issue on MAC yosemite

i get right to the 'make' part [not even 'make install'] of the build, but it then doesnt make it. it says about something like 'SDL.so' at the end plus something else. dont know what it is. also did contact david regarding this but he doesnt know. he said it may be something to do with SDL2, maybe, but these are guesses really

– using yosemite/mac 10.10.3
– SDL2.0.3. built from source also tried the binary build from the site
– have all the other SDL_image etc in my frameworks folder
– also have cmake 2.8.12-2.

great if someone could help.

thanks

lepton:_build_ lepton$ make
Scanning dependencies of target common
[  2%] Building C object common/CMakeFiles/common.dir/array.c.o
[  5%] Building C object common/CMakeFiles/common.dir/common.c.o
[  8%] Building C object common/CMakeFiles/common.dir/rwops.c.o
[ 11%] Building C object common/CMakeFiles/common.dir/surface.c.o
[ 14%] Building C object common/CMakeFiles/common.dir/table.c.o
[ 17%] Building C object common/CMakeFiles/common.dir/variant.c.o
[ 20%] Building C object common/CMakeFiles/common.dir/video.c.o
Linking C static library libcommon.a
[ 20%] Built target common
Scanning dependencies of target SDL
[ 23%] Building C object CMakeFiles/SDL.dir/src/audio.c.o
[ 26%] Building C object CMakeFiles/SDL.dir/src/channel.c.o
[ 29%] Building C object CMakeFiles/SDL.dir/src/clipboard.c.o
[ 32%] Building C object CMakeFiles/SDL.dir/src/cpu.c.o
[ 35%] Building C object CMakeFiles/SDL.dir/src/display.c.o
[ 38%] Building C object CMakeFiles/SDL.dir/src/events.c.o
[ 41%] Building C object CMakeFiles/SDL.dir/src/filesystem.c.o
[ 44%] Building C object CMakeFiles/SDL.dir/src/gamecontroller.c.o
[ 47%] Building C object CMakeFiles/SDL.dir/src/gl.c.o
[ 50%] Building C object CMakeFiles/SDL.dir/src/haptic.c.o
[ 52%] Building C object CMakeFiles/SDL.dir/src/joystick.c.o
[ 55%] Building C object CMakeFiles/SDL.dir/src/keyboard.c.o
[ 58%] Building C object CMakeFiles/SDL.dir/src/logging.c.o
[ 61%] Building C object CMakeFiles/SDL.dir/src/mouse.c.o
[ 64%] Building C object CMakeFiles/SDL.dir/src/platform.c.o
[ 67%] Building C object CMakeFiles/SDL.dir/src/power.c.o
[ 70%] Building C object CMakeFiles/SDL.dir/src/rectangle.c.o
[ 73%] Building C object CMakeFiles/SDL.dir/src/renderer.c.o
[ 76%] Building C object CMakeFiles/SDL.dir/src/SDL.c.o
[ 79%] Building C object CMakeFiles/SDL.dir/src/texture.c.o
[ 82%] Building C object CMakeFiles/SDL.dir/src/thread.c.o
[ 85%] Building C object CMakeFiles/SDL.dir/src/timer.c.o
[ 88%] Building C object CMakeFiles/SDL.dir/src/window.c.o
Linking C shared module SDL.so
Undefined symbols for architecture x86_64:
  "_SDL_AddEventWatch", referenced from:
      _eventAddFilter in events.c.o
  "_SDL_AddTimer", referenced from:
      _l_addTimer in timer.c.o
  "_SDL_AllocRW", referenced from:
      _l_rw_create in libcommon.a(rwops.c.o)
  "_SDL_AtomicAdd", referenced from:
      _l_channel_get in channel.c.o
      _l_channel_gc in channel.c.o
      _l_thread_create in thread.c.o
      _destroy in thread.c.o
      _callback in thread.c.o
  "_SDL_AtomicGet", referenced from:
      _l_channel_gc in channel.c.o
      _destroy in thread.c.o
  "_SDL_AudioInit", referenced from:
      _l_audioInit in audio.c.o
  "_SDL_AudioQuit", referenced from:
      _l_audioQuit in audio.c.o
  "_SDL_BuildAudioCVT", referenced from:
      _audioGetCVT in audio.c.o
  "_SDL_ClearError", referenced from:
      _l_clearError in SDL.c.o
  "_SDL_ClearHints", referenced from:
      _l_clearHints in SDL.c.o
  "_SDL_CloseAudio", referenced from:
      _l_audiodev_gc in audio.c.o
  "_SDL_CloseAudioDevice", referenced from:
      _l_audiodev_gc in audio.c.o
  "_SDL_CondBroadcast", referenced from:
      _channelClear in channel.c.o
      _l_channel_wait in channel.c.o
      _channelWait in channel.c.o
      _channelPush in channel.c.o
      _channelPop in channel.c.o
  "_SDL_CondWait", referenced from:
      _channelWait in channel.c.o
      _channelSupply in channel.c.o
  "_SDL_ConvertAudio", referenced from:
      _l_convertAudio in audio.c.o
  "_SDL_ConvertSurfaceFormat", referenced from:
      _l_surface_convertFormat in libcommon.a(surface.c.o)
  "_SDL_CreateColorCursor", referenced from:
      _l_createColorCursor in mouse.c.o
  "_SDL_CreateCond", referenced from:
      _l_channel_get in channel.c.o
  "_SDL_CreateCursor", referenced from:
      _l_createCursor in mouse.c.o
  "_SDL_CreateMutex", referenced from:
      _l_channel_get in channel.c.o
      _luaopen_SDL in SDL.c.o
  "_SDL_CreateRGBSurface", referenced from:
      _l_surface_createRGB in libcommon.a(surface.c.o)
  "_SDL_CreateRenderer", referenced from:
      _l_createRenderer in renderer.c.o
  "_SDL_CreateSoftwareRenderer", referenced from:
      _l_createSoftwareRenderer in renderer.c.o
  "_SDL_CreateTexture", referenced from:
      _l_renderer_createTexture in renderer.c.o
  "_SDL_CreateTextureFromSurface", referenced from:
      _l_renderer_createTextureFromSuface in renderer.c.o
  "_SDL_CreateThread", referenced from:
      _l_thread_create in thread.c.o
  "_SDL_CreateWindow", referenced from:
      _l_createWindow in window.c.o
  "_SDL_DelEventWatch", referenced from:
      _l_filter_gc in events.c.o
  "_SDL_Delay", referenced from:
      _l_delay in timer.c.o
  "_SDL_DestroyCond", referenced from:
      _l_channel_get in channel.c.o
  "_SDL_DestroyMutex", referenced from:
      _l_channel_get in channel.c.o
  "_SDL_DestroyRenderer", referenced from:
      _l_renderer_gc in renderer.c.o
  "_SDL_DestroyTexture", referenced from:
      _l_texture_gc in texture.c.o
  "_SDL_DestroyWindow", referenced from:
      _l_window_gc in window.c.o
  "_SDL_DetachThread", referenced from:
      _l_thread_gc in thread.c.o
  "_SDL_DisableScreenSaver", referenced from:
      _l_video_disableScreenSaver in display.c.o
  "_SDL_EnableScreenSaver", referenced from:
      _l_video_enableScreenSaver in display.c.o
  "_SDL_EnclosePoints", referenced from:
      _l_enclosePoints in rectangle.c.o
  "_SDL_EventState", referenced from:
      _l_event_eventState in events.c.o
  "_SDL_FillRect", referenced from:
      _l_surface_fillRect in libcommon.a(surface.c.o)
  "_SDL_FillRects", referenced from:
      _l_surface_fillRects in libcommon.a(surface.c.o)
  "_SDL_FilterEvents", referenced from:
      _l_event_filterEvents in events.c.o
  "_SDL_FlushEvent", referenced from:
      _l_event_flushEvent in events.c.o
  "_SDL_FlushEvents", referenced from:
      _l_event_flushEvents in events.c.o
  "_SDL_FreeCursor", referenced from:
      _l_cursor_gc in mouse.c.o
  "_SDL_FreeRW", referenced from:
      _l_rw_create in libcommon.a(rwops.c.o)
      _l_rw_gc in libcommon.a(rwops.c.o)
  "_SDL_FreeSurface", referenced from:
      _l_surface_gc in libcommon.a(surface.c.o)
  "_SDL_GL_CreateContext", referenced from:
      _l_glCreateContext in gl.c.o
  "_SDL_GL_DeleteContext", referenced from:
      _l_glDeleteContext in gl.c.o
  "_SDL_GL_ExtensionSupported", referenced from:
      _l_glExtensionSupported in gl.c.o
  "_SDL_GL_GetAttribute", referenced from:
      _l_glGetAttribute in gl.c.o
  "_SDL_GL_GetCurrentContext", referenced from:
      _l_glGetCurrentContext in gl.c.o
  "_SDL_GL_GetCurrentWindow", referenced from:
      _l_glGetCurrentWindow in gl.c.o
  "_SDL_GL_GetDrawableSize", referenced from:
      _l_glGetDrawableSize in gl.c.o
  "_SDL_GL_GetSwapInterval", referenced from:
      _l_glGetSwapInterval in gl.c.o
  "_SDL_GL_MakeCurrent", referenced from:
      _l_glMakeCurrent in gl.c.o
  "_SDL_GL_SetAttribute", referenced from:
      _l_glSetAttribute in gl.c.o
  "_SDL_GL_SetSwapInterval", referenced from:
      _l_glSetSwapInterval in gl.c.o
  "_SDL_GL_SwapWindow", referenced from:
      _l_glSwapWindow in gl.c.o
  "_SDL_GameControllerAddMapping", referenced from:
      _l_gameControllerAddMapping in gamecontroller.c.o
  "_SDL_GameControllerClose", referenced from:
      _l_gamectl_gc in gamecontroller.c.o
  "_SDL_GameControllerGetAttached", referenced from:
      _l_gamectl_tostring in gamecontroller.c.o
      _l_gamectl_getAttached in gamecontroller.c.o
  "_SDL_GameControllerName", referenced from:
      _l_gamectl_tostring in gamecontroller.c.o
      _l_gamectl_name in gamecontroller.c.o
  "_SDL_GameControllerNameForIndex", referenced from:
      _l_gameControllerNameForIndex in gamecontroller.c.o
  "_SDL_GameControllerOpen", referenced from:
      _l_gameControllerOpen in gamecontroller.c.o
  "_SDL_GetAudioDeviceName", referenced from:
      _l_getAudioDeviceName in audio.c.o
  "_SDL_GetAudioDeviceStatus", referenced from:
      _l_audiodev_tostring in audio.c.o
      _l_audiodev_status in audio.c.o
  "_SDL_GetAudioDriver", referenced from:
      _l_getAudioDriver in audio.c.o
  "_SDL_GetAudioStatus", referenced from:
      _l_getAudioStatus in audio.c.o
      _l_audiodev_status in audio.c.o
  "_SDL_GetBasePath", referenced from:
      _l_getBasePath in filesystem.c.o
  "_SDL_GetCPUCacheLineSize", referenced from:
      _l_cpu_getCacheLineSize in cpu.c.o
  "_SDL_GetCPUCount", referenced from:
      _l_cpu_getCount in cpu.c.o
  "_SDL_GetClipRect", referenced from:
      _l_surface_getClipRect in libcommon.a(surface.c.o)
      _surfaceBlit in libcommon.a(surface.c.o)
  "_SDL_GetClipboardText", referenced from:
      _l_video_getClipboardText in clipboard.c.o
  "_SDL_GetClosestDisplayMode", referenced from:
      _l_video_getClosestDisplayMode in display.c.o
  "_SDL_GetColorKey", referenced from:
      _l_surface_getColorKey in libcommon.a(surface.c.o)
  "_SDL_GetCurrentAudioDriver", referenced from:
      _l_getCurrentAudioDriver in audio.c.o
  "_SDL_GetCurrentDisplayMode", referenced from:
      _l_video_getCurrentDisplayMode in display.c.o
  "_SDL_GetCurrentVideoDriver", referenced from:
      _l_video_getCurrentVideoDriver in display.c.o
  "_SDL_GetCursor", referenced from:
      _l_getCursor in mouse.c.o
  "_SDL_GetDesktopDisplayMode", referenced from:
      _l_video_getDesktopDisplayMode in display.c.o
  "_SDL_GetDisplayBounds", referenced from:
      _l_video_getDisplayBounds in display.c.o
  "_SDL_GetDisplayMode", referenced from:
      _l_video_getDisplayMode in display.c.o
  "_SDL_GetError", referenced from:
      _luaopen_SDL in SDL.c.o
      _l_getError in SDL.c.o
      _l_texture_tostring in texture.c.o
      _l_rw_read in libcommon.a(rwops.c.o)
      _l_rw_write in libcommon.a(rwops.c.o)
      _commonPushSDLError in libcommon.a(common.c.o)
  "_SDL_GetHint", referenced from:
      _l_getHint in SDL.c.o
  "_SDL_GetKeyFromName", referenced from:
      _l_getKeyFromName in keyboard.c.o
  "_SDL_GetKeyFromScancode", referenced from:
      _l_getKeyFromScancode in keyboard.c.o
  "_SDL_GetKeyName", referenced from:
      _l_getKeyName in keyboard.c.o
  "_SDL_GetKeyboardFocus", referenced from:
      _l_getKeyboardFocus in keyboard.c.o
  "_SDL_GetKeyboardState", referenced from:
      _keysIndex in keyboard.c.o
  "_SDL_GetModState", referenced from:
      _l_getModState in keyboard.c.o
  "_SDL_GetMouseFocus", referenced from:
      _l_getMouseFocus in mouse.c.o
  "_SDL_GetMouseState", referenced from:
      _l_getMouseState in mouse.c.o
  "_SDL_GetNumAudioDevices", referenced from:
      _l_getNumAudioDevices in audio.c.o
  "_SDL_GetNumAudioDrivers", referenced from:
      _l_getNumAudioDrivers in audio.c.o
  "_SDL_GetNumDisplayModes", referenced from:
      _l_video_getNumDisplayModes in display.c.o
  "_SDL_GetNumRenderDrivers", referenced from:
      _l_getNumRenderDrivers in renderer.c.o
  "_SDL_GetNumVideoDisplays", referenced from:
      _l_video_getNumVideoDisplays in display.c.o
  "_SDL_GetNumVideoDrivers", referenced from:
      _l_video_getNumVideoDrivers in display.c.o
  "_SDL_GetPerformanceCounter", referenced from:
      _l_getPerformanceCounter in timer.c.o
  "_SDL_GetPerformanceFrequency", referenced from:
      _l_getPerformanceFrequency in timer.c.o
  "_SDL_GetPlatform", referenced from:
      _l_getPlatform in platform.c.o
  "_SDL_GetPowerInfo", referenced from:
      _l_getPowerInfo in power.c.o
  "_SDL_GetPrefPath", referenced from:
      _l_getPrefPath in filesystem.c.o
  "_SDL_GetRelativeMouseMode", referenced from:
      _l_getRelativeMouseMode in mouse.c.o
  "_SDL_GetRelativeMouseState", referenced from:
      _l_getRelativeMouseState in mouse.c.o
  "_SDL_GetRenderDrawBlendMode", referenced from:
      _l_renderer_getDrawBlendMode in renderer.c.o
  "_SDL_GetRenderDrawColor", referenced from:
      _l_renderer_getDrawColor in renderer.c.o
  "_SDL_GetRenderDriverInfo", referenced from:
      _l_getRenderDriverInfo in renderer.c.o
  "_SDL_GetRendererInfo", referenced from:
      _l_renderer_tostring in renderer.c.o
      _l_renderer_getInfo in renderer.c.o
  "_SDL_GetScancodeFromKey", referenced from:
      _l_getScancodeFromKey in keyboard.c.o
  "_SDL_GetScancodeFromName", referenced from:
      _l_getScancodeFromName in keyboard.c.o
  "_SDL_GetScancodeName", referenced from:
      _l_getScancodeName in keyboard.c.o
  "_SDL_GetSurfaceAlphaMod", referenced from:
      _l_surface_getAlphaMod in libcommon.a(surface.c.o)
  "_SDL_GetSurfaceBlendMode", referenced from:
      _l_surface_getBlendMode in libcommon.a(surface.c.o)
  "_SDL_GetSurfaceColorMod", referenced from:
      _l_surface_getColorMod in libcommon.a(surface.c.o)
  "_SDL_GetTextureAlphaMod", referenced from:
      _l_texture_getAlphaMod in texture.c.o
  "_SDL_GetTextureBlendMode", referenced from:
      _l_texture_getBlendMode in texture.c.o
  "_SDL_GetTextureColorMod", referenced from:
      _l_texture_getColorMod in texture.c.o
  "_SDL_GetThreadID", referenced from:
      _l_thread_tostring in thread.c.o
      _l_thread_getId in thread.c.o
  "_SDL_GetThreadName", referenced from:
      _l_thread_getName in thread.c.o
  "_SDL_GetTicks", referenced from:
      _l_getTicks in timer.c.o
  "_SDL_GetVersion", referenced from:
      _luaopen_SDL in SDL.c.o
  "_SDL_GetVideoDriver", referenced from:
      _l_video_getVideoDriver in display.c.o
  "_SDL_GetWindowBrightness", referenced from:
      _l_window_getBrightness in window.c.o
  "_SDL_GetWindowDisplayIndex", referenced from:
      _l_window_getDisplayIndex in window.c.o
  "_SDL_GetWindowDisplayMode", referenced from:
      _l_window_getDisplayMode in window.c.o
  "_SDL_GetWindowFlags", referenced from:
      _l_window_getFlags in window.c.o
  "_SDL_GetWindowGammaRamp", referenced from:
      _l_window_getGammaRamp in window.c.o
  "_SDL_GetWindowGrab", referenced from:
      _l_window_getGrab in window.c.o
  "_SDL_GetWindowID", referenced from:
      _l_window_getID in window.c.o
  "_SDL_GetWindowMaximumSize", referenced from:
      _l_window_getMaximumSize in window.c.o
  "_SDL_GetWindowMinimumSize", referenced from:
      _l_window_getMinimumSize in window.c.o
  "_SDL_GetWindowPixelFormat", referenced from:
      _l_window_getPixelFormat in window.c.o
  "_SDL_GetWindowPosition", referenced from:
      _l_window_getPosition in window.c.o
  "_SDL_GetWindowSize", referenced from:
      _l_window_tostring in window.c.o
      _l_window_getSize in window.c.o
  "_SDL_GetWindowSurface", referenced from:
      _l_window_getSurface in window.c.o
  "_SDL_GetWindowTitle", referenced from:
      _l_window_tostring in window.c.o
      _l_window_getTitle in window.c.o
  "_SDL_HapticClose", referenced from:
      _l_haptic_gc in haptic.c.o
  "_SDL_HapticDestroyEffect", referenced from:
      _l_haptic_destroyEffect in haptic.c.o
  "_SDL_HapticEffectSupported", referenced from:
      _l_haptic_effectSupported in haptic.c.o
  "_SDL_HapticGetEffectStatus", referenced from:
      _l_haptic_getEffectStatus in haptic.c.o
  "_SDL_HapticIndex", referenced from:
      _l_haptic_index in haptic.c.o
  "_SDL_HapticNewEffect", referenced from:
      _l_haptic_newEffect in haptic.c.o
  "_SDL_HapticNumAxes", referenced from:
      _l_haptic_numAxes in haptic.c.o
  "_SDL_HapticNumEffects", referenced from:
      _l_haptic_numEffects in haptic.c.o
  "_SDL_HapticNumEffectsPlaying", referenced from:
      _l_haptic_numEffectsPlaying in haptic.c.o
  "_SDL_HapticOpen", referenced from:
      _l_hapticOpen in haptic.c.o
  "_SDL_HapticOpenFromJoystick", referenced from:
      _l_hapticOpenFromJoystick in haptic.c.o
  "_SDL_HapticOpenFromMouse", referenced from:
      _l_hapticOpenFromMouse in haptic.c.o
  "_SDL_HapticOpened", referenced from:
      _l_hapticOpened in haptic.c.o
  "_SDL_HapticPause", referenced from:
      _l_haptic_pause in haptic.c.o
  "_SDL_HapticRumbleInit", referenced from:
      _l_haptic_rumbleInit in haptic.c.o
  "_SDL_HapticRumblePlay", referenced from:
      _l_haptic_rumblePlay in haptic.c.o
  "_SDL_HapticRumbleStop", referenced from:
      _l_haptic_rumbleStop in haptic.c.o
  "_SDL_HapticRumbleSupported", referenced from:
      _l_haptic_rumbleSupported in haptic.c.o
  "_SDL_HapticRunEffect", referenced from:
      _l_haptic_runEffect in haptic.c.o
  "_SDL_HapticSetAutocenter", referenced from:
      _l_haptic_setAutocenter in haptic.c.o
  "_SDL_HapticSetGain", referenced from:
      _l_haptic_setGain in haptic.c.o
  "_SDL_HapticStopAll", referenced from:
      _l_haptic_stopAll in haptic.c.o
  "_SDL_HapticStopEffect", referenced from:
      _l_haptic_stopEffect in haptic.c.o
  "_SDL_HapticUnpause", referenced from:
      _l_haptic_unpause in haptic.c.o
  "_SDL_HapticUpdateEffect", referenced from:
      _l_haptic_updateEffect in haptic.c.o
  "_SDL_Has3DNow", referenced from:
      _l_cpu_has3DNow in cpu.c.o
  "_SDL_HasAltiVec", referenced from:
      _l_cpu_hasAltiVec in cpu.c.o
  "_SDL_HasClipboardText", referenced from:
      _l_video_hasClipboardText in clipboard.c.o
  "_SDL_HasEvent", referenced from:
      _l_event_hasEvent in events.c.o
  "_SDL_HasEvents", referenced from:
      _l_event_hasEvents in events.c.o
  "_SDL_HasIntersection", referenced from:
      _l_hasIntersection in rectangle.c.o
  "_SDL_HasMMX", referenced from:
      _l_cpu_hasMMX in cpu.c.o
  "_SDL_HasRDTSC", referenced from:
      _l_cpu_hasRDTSC in cpu.c.o
  "_SDL_HasSSE", referenced from:
      _l_cpu_hasSSE in cpu.c.o
  "_SDL_HasSSE2", referenced from:
      _l_cpu_hasSSE2 in cpu.c.o
  "_SDL_HasSSE41", referenced from:
      _l_cpu_hasSSE41 in cpu.c.o
  "_SDL_HasSSE42", referenced from:
      _l_cpu_hasSSE42 in cpu.c.o
  "_SDL_HideWindow", referenced from:
      _l_window_hide in window.c.o
  "_SDL_Init", referenced from:
      _l_init in SDL.c.o
  "_SDL_InitSubSystem", referenced from:
      _l_initSubSystem in SDL.c.o
  "_SDL_IntersectRect", referenced from:
      _l_intersectRect in rectangle.c.o
  "_SDL_IntersectRectAndLine", referenced from:
      _l_intersectRectAndLine in rectangle.c.o
  "_SDL_IsGameController", referenced from:
      _l_isGameController in gamecontroller.c.o
  "_SDL_IsScreenSaverEnabled", referenced from:
      _l_video_isScreenSaverLoaded in display.c.o
  "_SDL_JoystickClose", referenced from:
      _l_joystick_gc in joystick.c.o
  "_SDL_JoystickEventState", referenced from:
      _l_joystickEventState in joystick.c.o
  "_SDL_JoystickGetAttached", referenced from:
      _l_joystick_tostring in joystick.c.o
      _l_joystick_getAttached in joystick.c.o
  "_SDL_JoystickGetAxis", referenced from:
      _l_joystick_getAxis in joystick.c.o
  "_SDL_JoystickGetBall", referenced from:
      _l_joystick_getBall in joystick.c.o
  "_SDL_JoystickGetButton", referenced from:
      _l_joystick_getButton in joystick.c.o
  "_SDL_JoystickGetHat", referenced from:
      _l_joystick_getHat in joystick.c.o
  "_SDL_JoystickInstanceID", referenced from:
      _l_joystick_tostring in joystick.c.o
      _l_joystick_instanceID in joystick.c.o
  "_SDL_JoystickIsHaptic", referenced from:
      _l_joystickIsHaptic in haptic.c.o
  "_SDL_JoystickName", referenced from:
      _l_joystick_tostring in joystick.c.o
      _l_joystick_name in joystick.c.o
  "_SDL_JoystickNameForIndex", referenced from:
      _l_joystickNameForIndex in joystick.c.o
  "_SDL_JoystickNumAxes", referenced from:
      _l_joystick_tostring in joystick.c.o
      _l_joystick_numAxes in joystick.c.o
  "_SDL_JoystickNumBalls", referenced from:
      _l_joystick_tostring in joystick.c.o
      _l_joystick_numBalls in joystick.c.o
  "_SDL_JoystickNumButtons", referenced from:
      _l_joystick_tostring in joystick.c.o
      _l_joystick_numButtons in joystick.c.o
  "_SDL_JoystickNumHats", referenced from:
      _l_joystick_tostring in joystick.c.o
      _l_joystick_numHats in joystick.c.o
  "_SDL_JoystickOpen", referenced from:
      _l_joystickOpen in joystick.c.o
  "_SDL_JoystickUpdate", referenced from:
      _l_joystickUpdate in joystick.c.o
  "_SDL_LoadBMP_RW", referenced from:
      _l_surface_loadBMP in libcommon.a(surface.c.o)
      _l_surface_loadBMP_RW in libcommon.a(surface.c.o)
  "_SDL_LoadWAV_RW", referenced from:
      _loadWAV in audio.c.o
  "_SDL_LockAudio", referenced from:
      _l_audiodev_lock in audio.c.o
  "_SDL_LockAudioDevice", referenced from:
      _l_audiodev_lock in audio.c.o
  "_SDL_LockMutex", referenced from:
      _l_channel_get in channel.c.o
      _channelClear in channel.c.o
      _channelWait in channel.c.o
      _channelSupply in channel.c.o
      _channelPush in channel.c.o
      _channelPop in channel.c.o
      _channelLast in channel.c.o
      ...
  "_SDL_LockSurface", referenced from:
      _l_surface_lock in libcommon.a(surface.c.o)
  "_SDL_Log", referenced from:
      _l_log in logging.c.o
  "_SDL_LogCritical", referenced from:
      _audioCallback in audio.c.o
      _l_logCritical in logging.c.o
      _callback in thread.c.o
      _timerCallback in timer.c.o
  "_SDL_LogDebug", referenced from:
      _l_logDebug in logging.c.o
  "_SDL_LogError", referenced from:
      _l_logError in logging.c.o
  "_SDL_LogGetPriority", referenced from:
      _l_logGetPriority in logging.c.o
  "_SDL_LogInfo", referenced from:
      _l_logInfo in logging.c.o
  "_SDL_LogMessage", referenced from:
      _l_logMessage in logging.c.o
  "_SDL_LogResetPriorities", referenced from:
      _l_logResetPriorities in logging.c.o
  "_SDL_LogSetAllPriority", referenced from:
      _l_logSetAllPriority in logging.c.o
  "_SDL_LogSetOutputFunction", referenced from:
      _l_logSetOutputFunction in logging.c.o
  "_SDL_LogSetPriority", referenced from:
      _l_logSetPriority in logging.c.o
  "_SDL_LogVerbose", referenced from:
      _l_logVerbose in logging.c.o
  "_SDL_LogWarn", referenced from:
      _l_logWarn in logging.c.o
  "_SDL_LowerBlit", referenced from:
      _surfaceBlit in libcommon.a(surface.c.o)
  "_SDL_LowerBlitScaled", referenced from:
      _surfaceBlit in libcommon.a(surface.c.o)
  "_SDL_MaximizeWindow", referenced from:
      _l_window_maximize in window.c.o
  "_SDL_MinimizeWindow", referenced from:
      _l_window_minimize in window.c.o
  "_SDL_MixAudio", referenced from:
      _mixAudio in audio.c.o
  "_SDL_MixAudioFormat", referenced from:
      _mixAudio in audio.c.o
  "_SDL_MouseIsHaptic", referenced from:
      _l_mouseIsHaptic in haptic.c.o
  "_SDL_NumHaptics", referenced from:
      _l_numHaptics in haptic.c.o
  "_SDL_NumJoysticks", referenced from:
      _l_numJoysticks in joystick.c.o
  "_SDL_OpenAudio", referenced from:
      _openAudio in audio.c.o
  "_SDL_OpenAudioDevice", referenced from:
      _openAudio in audio.c.o
  "_SDL_PauseAudio", referenced from:
      _l_audiodev_pause in audio.c.o
  "_SDL_PauseAudioDevice", referenced from:
      _l_audiodev_pause in audio.c.o
  "_SDL_PeepEvents", referenced from:
      _l_event_peepEvents in events.c.o
      _l_event_quitRequested in events.c.o
  "_SDL_PollEvent", referenced from:
      _eventIterator in events.c.o
  "_SDL_PumpEvents", referenced from:
      _l_event_pumpEvents in events.c.o
      _l_event_quitRequested in events.c.o
  "_SDL_QueryTexture", referenced from:
      _l_texture_query in texture.c.o
      _l_texture_tostring in texture.c.o
  "_SDL_Quit", referenced from:
      _l_quit in SDL.c.o
  "_SDL_QuitSubSystem", referenced from:
      _l_quitSubSystem in SDL.c.o
  "_SDL_RWFromFile", referenced from:
      _loadWAV in audio.c.o
      _l_surface_loadBMP in libcommon.a(surface.c.o)
      _l_surface_saveBMP in libcommon.a(surface.c.o)
      _l_rw_fromFile in libcommon.a(rwops.c.o)
  "_SDL_RaiseWindow", referenced from:
      _l_window_raise in window.c.o
  "_SDL_ReadBE16", referenced from:
      _rw_read16 in libcommon.a(rwops.c.o)
  "_SDL_ReadBE32", referenced from:
      _rw_read32 in libcommon.a(rwops.c.o)
  "_SDL_ReadLE16", referenced from:
      _rw_read16 in libcommon.a(rwops.c.o)
  "_SDL_ReadLE32", referenced from:
      _rw_read32 in libcommon.a(rwops.c.o)
  "_SDL_RegisterEvents", referenced from:
      _l_event_registerEvents in events.c.o
  "_SDL_RemoveTimer", referenced from:
      _l_timer_gc in timer.c.o
      _l_timer_remove in timer.c.o
  "_SDL_RenderClear", referenced from:
      _l_renderer_clear in renderer.c.o
  "_SDL_RenderCopy", referenced from:
      _l_renderer_copy in renderer.c.o
  "_SDL_RenderCopyEx", referenced from:
      _l_renderer_copyEx in renderer.c.o
  "_SDL_RenderDrawLine", referenced from:
      _l_renderer_drawLine in renderer.c.o
  "_SDL_RenderDrawLines", referenced from:
      _l_renderer_drawLines in renderer.c.o
  "_SDL_RenderDrawPoint", referenced from:
      _l_renderer_drawPoint in renderer.c.o
  "_SDL_RenderDrawPoints", referenced from:
      _l_renderer_drawPoints in renderer.c.o
  "_SDL_RenderDrawRect", referenced from:
      _rendererDrawOrFillRect in renderer.c.o
  "_SDL_RenderDrawRects", referenced from:
      _rendererDrawOrFillRects in renderer.c.o
  "_SDL_RenderFillRect", referenced from:
      _rendererDrawOrFillRect in renderer.c.o
  "_SDL_RenderFillRects", referenced from:
      _rendererDrawOrFillRects in renderer.c.o
  "_SDL_RenderGetClipRect", referenced from:
      _l_renderer_getClipRect in renderer.c.o
  "_SDL_RenderGetLogicalSize", referenced from:
      _l_renderer_getLogicalSize in renderer.c.o
  "_SDL_RenderGetViewport", referenced from:
      _l_renderer_getViewport in renderer.c.o
  "_SDL_RenderPresent", referenced from:
      _l_renderer_present in renderer.c.o
  "_SDL_RenderSetClipRect", referenced from:
      _l_renderer_setClipRect in renderer.c.o
  "_SDL_RenderSetLogicalSize", referenced from:
      _l_renderer_setLogicalSize in renderer.c.o
  "_SDL_RenderSetViewport", referenced from:
      _l_renderer_setViewport in renderer.c.o
  "_SDL_RestoreWindow", referenced from:
      _l_window_restore in window.c.o
  "_SDL_SaveBMP_RW", referenced from:
      _l_surface_saveBMP in libcommon.a(surface.c.o)
      _l_surface_saveBMP_RW in libcommon.a(surface.c.o)
  "_SDL_SetClipRect", referenced from:
      _l_surface_setClipRect in libcommon.a(surface.c.o)
  "_SDL_SetClipboardText", referenced from:
      _l_video_setClipboardText in clipboard.c.o
  "_SDL_SetColorKey", referenced from:
      _l_surface_setColorKey in libcommon.a(surface.c.o)
  "_SDL_SetCursor", referenced from:
      _l_setCursor in mouse.c.o
  "_SDL_SetError", referenced from:
      _l_setError in SDL.c.o
      _l_rw_create in libcommon.a(rwops.c.o)
  "_SDL_SetEventFilter", referenced from:
      _l_filter_gc in events.c.o
      _eventAddFilter in events.c.o
  "_SDL_SetHint", referenced from:
      _l_setHint in SDL.c.o
  "_SDL_SetModState", referenced from:
      _l_setModState in keyboard.c.o
  "_SDL_SetRelativeMouseMode", referenced from:
      _l_setRelativeMouseMode in mouse.c.o
  "_SDL_SetRenderDrawBlendMode", referenced from:
      _l_renderer_setDrawBlendMode in renderer.c.o
  "_SDL_SetRenderDrawColor", referenced from:
      _l_renderer_setDrawColor in renderer.c.o
  "_SDL_SetRenderTarget", referenced from:
      _l_renderer_setTarget in renderer.c.o
  "_SDL_SetSurfaceAlphaMod", referenced from:
      _l_surface_setAlphaMod in libcommon.a(surface.c.o)
  "_SDL_SetSurfaceBlendMode", referenced from:
      _l_surface_setBlendMode in libcommon.a(surface.c.o)
  "_SDL_SetSurfaceColorMod", referenced from:
      _l_surface_setColorMod in libcommon.a(surface.c.o)
  "_SDL_SetSurfacePalette", referenced from:
      _l_surface_setPalette in libcommon.a(surface.c.o)
  "_SDL_SetSurfaceRLE", referenced from:
      _l_surface_setRLE in libcommon.a(surface.c.o)
  "_SDL_SetTextInputRect", referenced from:
      _l_setTextInputRect in keyboard.c.o
  "_SDL_SetTextureAlphaMod", referenced from:
      _l_texture_setAlphaMod in texture.c.o
  "_SDL_SetTextureBlendMode", referenced from:
      _l_texture_setBlendMode in texture.c.o
  "_SDL_SetTextureColorMod", referenced from:
      _l_texture_setColorMod in texture.c.o
  "_SDL_SetWindowBrightness", referenced from:
      _l_window_setBrightness in window.c.o
  "_SDL_SetWindowDisplayMode", referenced from:
      _l_window_setDisplayMode in window.c.o
  "_SDL_SetWindowFullscreen", referenced from:
      _l_window_setFullscreen in window.c.o
  "_SDL_SetWindowGammaRamp", referenced from:
      _l_window_setGammaRamp in window.c.o
  "_SDL_SetWindowGrab", referenced from:
      _l_window_setGrab in window.c.o
  "_SDL_SetWindowIcon", referenced from:
      _l_window_setIcon in window.c.o
  "_SDL_SetWindowMaximumSize", referenced from:
      _l_window_setMaximumSize in window.c.o
  "_SDL_SetWindowMinimumSize", referenced from:
      _l_window_setMinimumSize in window.c.o
  "_SDL_SetWindowPosition", referenced from:
      _l_window_setPosition in window.c.o
  "_SDL_SetWindowSize", referenced from:
      _l_window_setSize in window.c.o
  "_SDL_SetWindowTitle", referenced from:
      _l_window_setTitle in window.c.o
  "_SDL_ShowCursor", referenced from:
      _l_showCursor in mouse.c.o
  "_SDL_ShowWindow", referenced from:
      _l_window_show in window.c.o
  "_SDL_StartTextInput", referenced from:
      _l_startTextInput in keyboard.c.o
  "_SDL_StopTextInput", referenced from:
      _l_stopTextInput in keyboard.c.o
  "_SDL_UnionRect", referenced from:
      _l_unionRect in rectangle.c.o
  "_SDL_UnlockAudio", referenced from:
      _l_audiodev_unlock in audio.c.o
  "_SDL_UnlockAudioDevice", referenced from:
      _l_audiodev_unlock in audio.c.o
  "_SDL_UnlockMutex", referenced from:
      _l_channel_get in channel.c.o
      _channelClear in channel.c.o
      _channelWait in channel.c.o
      _channelPush in channel.c.o
      _channelPop in channel.c.o
      _channelLast in channel.c.o
      _channelFirst in channel.c.o
      ...
  "_SDL_UnlockSurface", referenced from:
      _l_surface_unlock in libcommon.a(surface.c.o)
  "_SDL_UnlockTexture", referenced from:
      _l_texture_unlock in texture.c.o
  "_SDL_UpdateWindowSurface", referenced from:
      _l_window_updateSurface in window.c.o
  "_SDL_UpdateWindowSurfaceRects", referenced from:
      _l_window_updateSurfaceRects in window.c.o
  "_SDL_UpperBlit", referenced from:
      _surfaceBlit in libcommon.a(surface.c.o)
  "_SDL_UpperBlitScaled", referenced from:
      _surfaceBlit in libcommon.a(surface.c.o)
  "_SDL_VideoInit", referenced from:
      _l_video_init in display.c.o
  "_SDL_VideoQuit", referenced from:
      _l_video_quit in display.c.o
  "_SDL_WaitEvent", referenced from:
      _l_event_waitEvent in events.c.o
  "_SDL_WaitEventTimeout", referenced from:
      _l_event_waitEvent in events.c.o
  "_SDL_WaitThread", referenced from:
      _l_thread_wait in thread.c.o
  "_SDL_WarpMouseInWindow", referenced from:
      _l_window_warpMouse in window.c.o
  "_SDL_WasInit", referenced from:
      _l_wasInit in SDL.c.o
  "_SDL_WriteBE16", referenced from:
      _rw_write16 in libcommon.a(rwops.c.o)
  "_SDL_WriteBE32", referenced from:
      _rw_write32 in libcommon.a(rwops.c.o)
  "_SDL_WriteLE16", referenced from:
      _rw_write16 in libcommon.a(rwops.c.o)
  "_SDL_WriteLE32", referenced from:
      _rw_write32 in libcommon.a(rwops.c.o)
  "_SDL_free", referenced from:
      _l_video_getClipboardText in clipboard.c.o
      _pushDropFile in events.c.o
      _l_getBasePath in filesystem.c.o
      _l_getPrefPath in filesystem.c.o
  "_SDL_memset", referenced from:
      _getDirection in haptic.c.o
  "_luaL_checkinteger", referenced from:
      _l_getAudioDeviceName in audio.c.o
      _l_getAudioDriver in audio.c.o
      _mixAudio in audio.c.o
      _l_video_getClosestDisplayMode in display.c.o
      _l_video_getCurrentDisplayMode in display.c.o
      _l_video_getDesktopDisplayMode in display.c.o
      _l_video_getDisplayBounds in display.c.o
      ...
  "_luaL_checklstring", referenced from:
      _l_audioInit in audio.c.o
      _openAudio in audio.c.o
      _mixAudio in audio.c.o
      _loadWAV in audio.c.o
      _l_channel_get in channel.c.o
      _l_video_setClipboardText in clipboard.c.o
      _l_video_init in display.c.o
      ...
  "_luaL_checknumber", referenced from:
      _l_haptic_rumblePlay in haptic.c.o
      _l_window_setBrightness in window.c.o
  "_luaL_checktype", referenced from:
      _audioGetCVT in audio.c.o
      _openAudio in audio.c.o
      _l_event_filterEvents in events.c.o
      _eventAddFilter in events.c.o
      _getEffect in haptic.c.o
      _l_logSetOutputFunction in logging.c.o
      _l_enclosePoints in rectangle.c.o
      ...
  "_luaL_checkudata", referenced from:
      _commonGetUserdata in libcommon.a(common.c.o)
      _tableGetUserdata in libcommon.a(table.c.o)
  "_luaL_error", referenced from:
      _audioGetCVT in audio.c.o
      _getEffect in haptic.c.o
      _getConstant in haptic.c.o
      _getPeriodic in haptic.c.o
      _getCondition in haptic.c.o
      _getRamp in haptic.c.o
      _keysIndex in keyboard.c.o
      ...
  "_luaL_loadfilex", referenced from:
      _openAudio in audio.c.o
      _loadfile in thread.c.o
  "_luaL_newmetatable", referenced from:
      _commonBindObject in libcommon.a(common.c.o)
  "_luaL_newstate", referenced from:
      _openAudio in audio.c.o
      _l_thread_create in thread.c.o
      _l_addTimer in timer.c.o
  "_luaL_openlibs", referenced from:
      _openAudio in audio.c.o
      _l_thread_create in thread.c.o
      _l_addTimer in timer.c.o
  "_luaL_optinteger", referenced from:
      _l_glSetSwapInterval in gl.c.o
  "_luaL_ref", referenced from:
      _openAudio in audio.c.o
      _l_event_filterEvents in events.c.o
      _eventAddFilter in events.c.o
      _l_logSetOutputFunction in logging.c.o
      _l_addTimer in timer.c.o
      _l_rw_create in libcommon.a(rwops.c.o)
  "_luaL_setfuncs", referenced from:
      _commonBindObject in libcommon.a(common.c.o)
      _commonBindLibrary in libcommon.a(common.c.o)
      _commonNewLibrary in libcommon.a(common.c.o)
  "_luaL_setmetatable", referenced from:
      _commonPushUserdata in libcommon.a(common.c.o)
  "_luaL_unref", referenced from:
      _openAudio in audio.c.o
      _l_event_filterEvents in events.c.o
      _l_filter_gc in events.c.o
      _l_logSetOutputFunction in logging.c.o
      _l_rw_create in libcommon.a(rwops.c.o)
      _l_rw_gc in libcommon.a(rwops.c.o)
  "_lua_callk", referenced from:
      _eventFilter in events.c.o
      _loggingCustomOutput in logging.c.o
      _rw_size in libcommon.a(rwops.c.o)
      _rw_seek in libcommon.a(rwops.c.o)
      _rw_read in libcommon.a(rwops.c.o)
      _rw_write in libcommon.a(rwops.c.o)
      _rw_close in libcommon.a(rwops.c.o)
      ...
  "_lua_close", referenced from:
      _l_audiodev_gc in audio.c.o
      _openAudio in audio.c.o
      _l_thread_create in thread.c.o
      _destroy in thread.c.o
      _l_addTimer in timer.c.o
      _l_timer_gc in timer.c.o
  "_lua_createtable", referenced from:
      _audioPushCVT in audio.c.o
      _loadWAV in audio.c.o
      _l_event_peepEvents in events.c.o
      _eventPush in events.c.o
      _pushKey in events.c.o
      _l_getKeyboardState in keyboard.c.o
      _pushRendererInfo in renderer.c.o
      ...
  "_lua_dump", referenced from:
      _loadfunction in thread.c.o
  "_lua_getfield", referenced from:
      _getConstant in haptic.c.o
      _getPeriodic in haptic.c.o
      _getCondition in haptic.c.o
      _getRamp in haptic.c.o
      _getDirection in haptic.c.o
      _l_renderer_copyEx in renderer.c.o
      _l_rw_create in libcommon.a(rwops.c.o)
      ...
  "_lua_gettop", referenced from:
      _mixAudio in audio.c.o
      _l_video_init in display.c.o
      _l_event_peepEvents in events.c.o
      _l_event_waitEvent in events.c.o
      _l_enclosePoints in rectangle.c.o
      _l_renderer_copy in renderer.c.o
      _l_quitSubSystem in SDL.c.o
      ...
  "_lua_load", referenced from:
      _loadfunction in thread.c.o
  "_lua_newuserdata", referenced from:
      _l_getKeyboardState in keyboard.c.o
      _commonPushUserdata in libcommon.a(common.c.o)
  "_lua_next", referenced from:
      _commonGetEnum in libcommon.a(common.c.o)
      _variantGet in libcommon.a(variant.c.o)
      _readTable in libcommon.a(video.c.o)
  "_lua_pcallk", referenced from:
      _openAudio in audio.c.o
      _audioCallback in audio.c.o
      _callback in thread.c.o
      _timerCallback in timer.c.o
  "_lua_pushboolean", referenced from:
      _l_enclosePoints in rectangle.c.o
      _l_intersectRect in rectangle.c.o
      _surfaceBlit in libcommon.a(surface.c.o)
      _commonPush in libcommon.a(common.c.o)
      _tableSetBool in libcommon.a(table.c.o)
      _variantPush in libcommon.a(variant.c.o)
  "_lua_pushcclosure", referenced from:
      _l_event_pollEvent in events.c.o
      _l_getKeyboardState in keyboard.c.o
  "_lua_pushfstring", referenced from:
      _l_audiodev_tostring in audio.c.o
      _l_filter_tostring in events.c.o
      _l_gamectl_tostring in gamecontroller.c.o
      _l_joystick_tostring in joystick.c.o
      _l_renderer_tostring in renderer.c.o
      _l_texture_tostring in texture.c.o
      _l_thread_tostring in thread.c.o
      ...
  "_lua_pushinteger", referenced from:
      _audioCallback in audio.c.o
      _eventPush in events.c.o
      _loggingCustomOutput in logging.c.o
      _l_getMouseState in mouse.c.o
      _l_getRelativeMouseState in mouse.c.o
      _l_getPowerInfo in power.c.o
      _pushRendererInfo in renderer.c.o
      ...
  "_lua_pushlstring", referenced from:
      _audioPushCVT in audio.c.o
      _mixAudio in audio.c.o
      _l_rw_read in libcommon.a(rwops.c.o)
      _rw_write in libcommon.a(rwops.c.o)
      _tableSetStringl in libcommon.a(table.c.o)
      _variantPush in libcommon.a(variant.c.o)
  "_lua_pushnil", referenced from:
      _l_channel_first in channel.c.o
      _l_channel_last in channel.c.o
      _l_channel_wait in channel.c.o
      _l_video_getCurrentVideoDriver in display.c.o
      _l_logGetOutputFunction in logging.c.o
      _l_getHint in SDL.c.o
      _commonGetEnum in libcommon.a(common.c.o)
      ...
  "_lua_pushnumber", referenced from:
      _commonPush in libcommon.a(common.c.o)
      _tableSetDouble in libcommon.a(table.c.o)
      _variantPush in libcommon.a(variant.c.o)
  "_lua_pushstring", referenced from:
      _l_video_getClipboardText in clipboard.c.o
      _l_video_getCurrentVideoDriver in display.c.o
      _l_getBasePath in filesystem.c.o
      _l_getPrefPath in filesystem.c.o
      _loggingCustomOutput in logging.c.o
      _pushRendererInfo in renderer.c.o
      _l_getHint in SDL.c.o
      ...
  "_lua_pushvalue", referenced from:
      _l_event_filterEvents in events.c.o
      _eventAddFilter in events.c.o
      _l_logSetOutputFunction in logging.c.o
      _loadfunction in thread.c.o
      _l_rw_create in libcommon.a(rwops.c.o)
  "_lua_rawgeti", referenced from:
      _audioCallback in audio.c.o
      _eventFilter in events.c.o
      _getCondition in haptic.c.o
      _getDirection in haptic.c.o
      _l_logGetOutputFunction in logging.c.o
      _loggingCustomOutput in logging.c.o
      _timerCallback in timer.c.o
      ...
  "_lua_rawseti", referenced from:
      _l_event_peepEvents in events.c.o
      _pushRendererInfo in renderer.c.o
      _l_window_getGammaRamp in window.c.o
      _commonPushEnum in libcommon.a(common.c.o)
  "_lua_setfield", referenced from:
      _audioPushCVT in audio.c.o
      _eventPush in events.c.o
      _pushKey in events.c.o
      _l_getKeyboardState in keyboard.c.o
      _pushRendererInfo in renderer.c.o
      _commonBindEnum in libcommon.a(common.c.o)
      _commonBindObject in libcommon.a(common.c.o)
      ...
  "_lua_setmetatable", referenced from:
      _l_getKeyboardState in keyboard.c.o
  "_lua_settable", referenced from:
      _variantPush in libcommon.a(variant.c.o)
  "_lua_settop", referenced from:
      _audioCallback in audio.c.o
      _getConstant in haptic.c.o
      _getPeriodic in haptic.c.o
      _getCondition in haptic.c.o
      _getRamp in haptic.c.o
      _getDirection in haptic.c.o
      _l_renderer_copyEx in renderer.c.o
      ...
  "_lua_toboolean", referenced from:
      _l_getAudioDeviceName in audio.c.o
      _l_getNumAudioDevices in audio.c.o
      _l_audiodev_pause in audio.c.o
      _eventFilter in events.c.o
      _l_setRelativeMouseMode in mouse.c.o
      _l_showCursor in mouse.c.o
      _l_surface_setColorKey in libcommon.a(surface.c.o)
      ...
  "_lua_tointegerx", referenced from:
      _callback in thread.c.o
      _l_window_setGammaRamp in window.c.o
      _rw_size in libcommon.a(rwops.c.o)
      _rw_seek in libcommon.a(rwops.c.o)
      _rw_read in libcommon.a(rwops.c.o)
      _rw_write in libcommon.a(rwops.c.o)
      _rw_close in libcommon.a(rwops.c.o)
      ...
  "_lua_tolstring", referenced from:
      _openAudio in audio.c.o
      _audioCallback in audio.c.o
      _threadDump in thread.c.o
      _loadfile in thread.c.o
      _loadfunction in thread.c.o
      _callback in thread.c.o
      _timerCallback in timer.c.o
      ...
  "_lua_tonumberx", referenced from:
      _getCondition in haptic.c.o
      _getDirection in haptic.c.o
      _timerCallback in timer.c.o
      _commonGetEnum in libcommon.a(common.c.o)
      _tableGetDouble in libcommon.a(table.c.o)
      _variantGet in libcommon.a(variant.c.o)
  "_lua_type", referenced from:
      _openAudio in audio.c.o
      _audioCallback in audio.c.o
      _getConstant in haptic.c.o
      _getPeriodic in haptic.c.o
      _getCondition in haptic.c.o
      _getRamp in haptic.c.o
      _getDirection in haptic.c.o
      ...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [SDL.so] Error 1
make[1]: *** [CMakeFiles/SDL.dir/all] Error 2
make: *** [all] Error 2

Luarocks builtin recipe

It would be nice if Luarocks could build Lua-SDL2 without requiring Cmake as a build dependency.

Besides the general advantage of one less dependency, Luarocks is probably smarter about the correct way to build Lua modules for different platforms.

Keep in mind that we need to link the platform's SDL2.

Haptic Effect

Hi everyone,

I am on Ubuntu and trying to get a haptic effect with a Microsoft Sidewinder 2. Everything is fine for most of the effects. I get the rumbleEffect and also the LeftRightEffect runing. But as it comes to e.g. the constant effect I seem to be to stupid. I don't manage to specify the effect for a newEffect creation. I always get an error that the direction must be a table. Could some one provide me an example code for an effect definiton?

Thank you so much and sorry for the stupid question,

Tobi

P.S.: My code:

t = {type = SDL.hapticDirection.Cartesian,direction= {18000, 0, 0}}
local id, err = ht:newEffect(t)
That gives me this error: German: "Speicherzugriffsfehler (Speicherabzug geschrieben)" I think the translation is something like "Memory access error (Core dump written)"

What happens after building luasdl2?

I manage to build luasdl2 and I got SDL.so and the rests of .so libs.I tried running an example linking sublime with SDL.so but it wont start the example.How should I make it?

Web export?

Hey guys! The project is so awesome. I love both Lua and SDL2, but I can't see any C code anymore after working in Lua for a while. I really love LOVE2d engine, but looking for a replacement, because it doesn't properly support HTML5 export. The question is: this should compile into HTML5, shouldn't it?

Could I kindly ask you to add a script or something for that? That would be AWESOME! This project has a big future! I totally want to use it for all my next Lua projects <3

Thanks, Egor.

SDL HitTests will make window invalid.

I tried to use HitTests (in lua 5.2 with SDL 2.0.7).
After some mouse movement inside the window, it suddenly turns invalid.

I made a minimal example here:

local sdl = require "sdl"

do -- initialization
	local ok, msg = sdl.init {sdl.flags.Everything}
	if not ok then
		msg = "sdl: " .. tostring (msg)
		error (msg)
	end
end

-- window creation
local window = sdl.createWindow {
	title  = "HitTest Bug",
	width  = 240,
	height = 240,
	flags  = {
		sdl.window.Resizable
	}
}

do -- hittest
	local Draggable   = sdl.hitTestResult.Draggable
	
	local function hittest (window, area)
		print (window)
		print (string.format ("area: %dx%d", area.x, area.y))
		return Draggable
	end
	
	window:setHitTest (hittest)
end

-- main loop
local running = true
while running do
	-- event "sdl.pollEvent"
	for event in sdl.pollEvent ( ) do
		if event.type == sdl.event.Quit then
			running = false
		end
	end
	
	-- error display
	local err = sdl.getError ( )
	if err and #err > 0 then
		print(err)
		sdl.clearError ( )
		running = false
	end
end

expected output:

[...]
window "HitTest Bug": size 240x240
area: 231x204
window "HitTest Bug": size 240x240
area: 230x204
window "HitTest Bug": size 240x240
area: 229x204
window "HitTest Bug": size 240x240
area: 229x203
Invalid window

Integers in Lua 5.3

When running the HitTest example (from #75) the integer value for the area's x and y is way to high.
I guess a double is interpreted as a long long int somewhere.

example output:

[...]
window "HitTest Bug": size 240x240
area: 11530578440487077x11530578440487125
window "": size 1654190018x4448800
area: 11530578440487077x11530578440487125
Invalid window

ALSO: This sample's output has the rare occurance of the window-size going nuts. It sometimes sets to 0x10 or similar invalid values. Note that the window-title is also incorrect/missing.
The most common value is 0x10 (which can be seen when print (window) is added to end of the minimal example.

help with animation

howdy folks,

i know this isnt a problem solving place. but think it would be good to at least bring these things up.

so what i have been trying with SDL is converting c++ code with SDL to lua-SDL2 code. but there have been many problems, things not working etc. so would like some help on this.
plus if this inforamtion is available for others, then at least other can learn without having to ask. if you get me?

so here is my c++/sdl code. but just need help with getting it to work on lua-SDL2. i have gotten to a certain point. but things like SDL.Rect are still being strange to me. have been able to get the image to load, but its the rendering part.

thanks if you can help

#include <iostream>
#include <SDL2/SDL.h>
#include <SDL2_image/SDL_image.h>

int main(int argc, char ** argv){
    bool quit = false;
    SDL_Event event;

    SDL_Init(SDL_INIT_VIDEO);
    IMG_Init(IMG_INIT_PNG);

    SDL_Window * window = SDL_CreateWindow("SDL2 Sprite Sheets", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, 0);
    SDL_Renderer * renderer = SDL_CreateRenderer(window, -1, 0);
    SDL_Surface * image = IMG_Load("image.png");
    SDL_Texture * texture = SDL_CreateTextureFromSurface(renderer, image);
    SDL_SetRenderDrawColor(renderer, 168, 230, 255, 255);
    SDL_RenderClear(renderer);

    while (!quit){
        Uint32 ticks = SDL_GetTicks();
        Uint32 sprite = (ticks / 100) % 3;
        SDL_Rect srcrect = { static_cast<int>(sprite * 32), 0, 32, 32 };
        SDL_Rect dstrect = { 10, 10, 32, 32 };
        SDL_PollEvent(&event);
        switch (event.type){
            case SDL_QUIT:
                quit = true;
                break;
        }
        SDL_RenderClear(renderer);
        SDL_RenderCopy(renderer, texture, &srcrect, &dstrect);
        SDL_RenderPresent(renderer);
    }
    SDL_DestroyTexture(texture);
    SDL_FreeSurface(image);
    SDL_DestroyRenderer(renderer);
    SDL_DestroyWindow(window);
    IMG_Quit();
    SDL_Quit();

    return 0;
}

image

[REQUEST] more examples

the examples given are great, but only really go to a certain point.

SDL in itself is pretty big, and think that addressing things like, drawing shapes, working with and importing other lua files, and interaction are a good thing to have. really it could go on, but i think the main crux would be the have a few more examples for people to dive into further and to keep interested.
if you get me?

plus since there is not really any other info online for this, then would be more useful to others who are using this repo

cheers

Compile error on macOS

I'm trying to install this on macOS and I'm getting a compilation error... and I don't know enough about C to debug myself. I have tried installing from luarocks, installing the dev version off of git and with cmake and all 3 methods result in the same error:

/Users/user/lua-sdl/luasdl2/src/window.c:950:10: error: assigning to 'int' from incompatible type 'void'
        if ((ut = lua_getuservalue(L, 1)) == LUA_TUSERDATA) {
                ^ ~~~~~~~~~~~~~~~~~~~~~~
1 warning and 1 error generated.
make[2]: *** [CMakeFiles/SDL.dir/src/window.c.o] Error 1
make[1]: *** [CMakeFiles/SDL.dir/all] Error 2
make: *** [all] Error 2

Add windows/powershell install instructions

Running luarocks install lua-sdl2 on windows with powershell runs into several problems:

  1. trying to pass the directories manually for SDL2_image (as well as other SDL2 addon libraries) yields an error because luarocks appears to not allow lowercase letters when passing in variables. Doing so yield Invalid assignment as an error.

  2. Placing the lua development headers and binaries in c:\external then runs into the problem of requiring cl.exe to be present in the path of the user - which it is not by default

  3. Adding the directory for cl.exe to the path of the user then results in the inability to find c runtime headers such as stdio.h since cl.exe requires all include directories to be manually specified and has no default directory. Since the rock doesn't specify any include path or environment variable to set for the c runtime, they cannot be found

Currently, as far as I can tell, building through luarocks on windows/Visual C++ is broken. It would be nice to have:

  1. instructions for building on windows specifically
  2. allow a directory to be specified in the luarocks install command for wincrt headers so cl.exe can build correctly
  3. fix the variable names in the rock to remove lowercase letters from the SDL2 directories
  4. provide binary distributions directly for the most common OS/architectures to avoid having to build the binaries yourself, which would make program distribution easier (don't have to distribute your own binaries, and don't have to instruct users to install luarocks and overcome all these obstacles themselves)

LuaDist

Hello,

I have just a little question: Could you offer your bindings for LuaSDL2 on LuaDIST?
(If you want to investigate: have a look at http://luadist.org/ and in the "Links"-section have a look at "How to contribute")

Thanks for an answer in advance
tDwtp

[QUESTION] working with classes that have images

something that has been getting on my nerves, or at least has been bothering, is working with classes/modules with an image player, but its the render stuff that is very confusing.

whilst i can get a window to be in a seperate module and call it in the main one is fine. its actually the rendering of an image from within a module that is troublesome or more so, confusing to say the least.

its when using createRenderer that is confusing me the most. since that calls in a window too it to render to. but you wouldnt need a window setting for each things would you, that wouldnt mak sense.
so how can you get by that?

here is a completely unfinished hodge-podge of code ive been rying to get to work to use an image inside a class to then call up in the main.lua. if anyone can help me just get it working id be happy. sdl/c++ ones have been helpful, but really on putting them to lua-SDL2, its been pretty cack

main.lua

SDL = require 'SDL'
player = require 'player'

local graphics = {}
local pos = {}
local width = 32
local height = 32
local dir = 6

function moveInit()
    assert(SDL.init{SDL.flags.Video})
    -- assert(SDL.joystickOpen(0))
    local win = assert(SDL.createWindow{title = 'moveJoy', width = 640, height = 480})
    -- local rndr = assert(SDL.createRenderer(win, 0, 0))
    -- local image = assert(img.load('player.png'))

    -- local imgTex = assert(rndr:createTextureFromSurface(image))

    -- rndr:setDrawColor(0xFFFFFF)

    -- graphics.win = win
    -- graphics.rndr = rndr
    -- graphics.imgTex = imgTex

    -- ---setting up our image width and height
    -- local f,a,w,h = imgTex:query()
    -- pos.x = width /2 - w / 2
    -- pos.y = height /2 - w / 2
    -- pos.w = w
    -- pos.h = h
end

moveInit()
initPlayer()
local keys = SDL.getKeyboardState()

while true do
    -- graphics.rndr:clear()
    -- graphics.rndr:copy(graphics.imgTex, nil, pos)
    -- graphics.rndr:present()

    SDL.pumpEvents()
    if keys[SDL.scancode.Escape] then
        break
    end

    -- for e in SDL.pollEvent() do
    --  if e.button == 9 then
    --      -- pos.x = pos.x + dir
    --      -- print(string.format("button up: %d", e.button))
    --      break
    --  end
    --  ---axis 0 is the left analog stick but for LEFT/RIGHT
    --  if e.axis == 0 then
    --      ---this will make the image go LEFT on the screen
    --      if e.value < -10 then
    --          pos.x = pos.x - dir
    --          ---this will make the player go RIGHT the screen
    --      elseif e.value > 10 then
    --          pos.x = pos.x + dir
    --      end
    --      ---this just prints our axis 0 [left/right] to know what is happening. good for output test
    --      print(string.format("axis %d: %d", e.axis, e.value))
    --  end
    --  ---axis 1 is the left analog stick but for UP/DOWN
    --  if e.axis == 1 then
    --      ---this will make the image go UP the screen
    --      if e.value < -10 then
    --          pos.y = pos.y - dir
    --      ---this will make the player go DOWN the screen
    --      elseif e.value > 10 then
    --          pos.y = pos.y + dir
    --      end
    --      ---this just prints our axis 1 [up/down] to know what is happening. good for output test
    --      print(string.format("axis %d: %d", e.axis, e.value))
    --  end
    -- end
end

player.lua

local SDLimage = require 'SDL.image'

speed = 6
frameWidth = 32
frameHeight = 32
graphics = {}

function initPlayer()
    assert(SDL.init{SDL.flags.Joystick})
    assert(SDL.joystickOpen(0))

    assert(SDLimage.init{SDL.flags.PNG})
    imageSurface = SDL.Surface

    rndr = assert(SDL.createRenderer())

    image = assert(SDLimage.load('player.png'))
    imgTexture = assert(rndr:createTextureFromSurface(image))

end

-- while true do
--  -- SDL.pumpEvents()
--  -- for e in SDL.pollEvent() do
-- end

SDL.hint not defined

On SDL-setHint documentation page says that the function first argument is a name and ask the user to check "SDL.hint" for the possible values but there is not SDL.hint table defined.

Looking the source code, I noticed that the name that should be used as the first parameter is the original SDL2 Category Hints like "SDL_HINT_RENDER_SCALE_QUALITY" . The complete list (for those looking for those values) is available in this link.

Compiling on OSX Bug Sur (Intel)

Using luarocks to install lua-sdl2 and I am hitting an issue

/usr/local/include/SDL2/SDL_platform.h:87:3: error: SDL for Mac OS X only supports deploying on 10.6 and above.
# error SDL for Mac OS X only supports deploying on 10.6 and above.

Nuking line 87 allows the build to complete but with ton of warnings Building for Intel with Mac OS X Deployment Target < 10.4 is invalid and was built for newer macOS version (10.5) than being linked (10.1)

A quick test with some example scripts shows that it seems to be working

Is this the build process not being set up correctly for Big Sur or are the Apple development tools not ready yet

Opengl Texture binding

I'm a little confused. The Wiki is to me very useful and has solved many of my questions, since the way in which everything is written coincides with the original library. But it seems I can not find the way to create a surface and find the pointer to give it to OpenGL and use textures. I have reviewed the source (with some effort) but each function returns a pointer to surface, and does not expose methods or arrays, or at least can not find the way. May need to see the "texture class" but can not find similar documentation.
It may be a function called "SDL_GL_BindTexture" but it's too much for me and do not know to do.
[Using google translate]

renderer:copyEx doesn't accept textures

The function errors saying it expected a table, instead of userdata for arg 1, which is the texture. Is there a fix for this?

Here is the error-

bad argument #1 to 'copyEx' (table expected, got userdata)

how to install Lua on Ubuntu?

Hello.I've been trying to install Lua using sudo apt-get install liblua5.2-0 and it worked but when I used Cmake 3.2.0 for building luasdl2 it told me I need to download it

lua-SDL2 syntax list?

rather than carry on the yosemite build one, thought id ask here.

but where could i get a list of the lua-SDL2 syntax? with everything. ill work on a cheap auto-complete for it to make it easier coding on say, sublime, or whatever else. just dont know how to get the syntax list. just so when future people use this, there is an option.

thanks

SDL 2.0.0 Backwards-compatability

When support for 2.0.1 features was added, compiling against SDL 2.0.0 stopped working; if feasible, add compile-time checks to support SDL 2.0.0 again.

SDL 2.0.2 Constants

SDL 2.0.2 added a few constants and functions:
http://forums.libsdl.org/viewtopic.php?t=10088

Not all of the functions are necessarily relevant to this binding, but constants like SDL_RENDER_TARGETS_RESET are probably valuable to have exposed.

These constants should be suitably ifdef'd so that compiling with older SDL2 versions still works.

Texture Scaling on Renderers

I don't seem to see any options to choose between nearest-neighbor scaling and bilinear when copying textures to a renderer. Am I just not finding it in the right place?

(Using LuaSDL2 on Ubuntu 16.04)

easier build?

hi, I don't know enough about CMake to e.g. make a pull request; It seems weird to me that the INSTALL instructions require users to manually mkdir build and cd there. Couldn't the CMake itself create the directory?

[Question] How to share ?

Hello,
I just discovered this repo and I am interested in using it but I have a question.

How can we share a game made with luasdl2 ? Is this possible to create some sort of installer ? Or self containing folder ?

trouble after install with luarocks

installed using luarocks, downloaded example and tried to run it but get errors that SDL can't be found:

$ lua tutorial.lua
lua: tutorial.lua:6: module 'SDL' not found:
	no field package.preload['SDL']
	no file '/usr/share/lua/5.3/SDL.lua'
	no file '/usr/share/lua/5.3/SDL/init.lua'
	no file '/usr/lib64/lua/5.3/SDL.lua'
	no file '/usr/lib64/lua/5.3/SDL/init.lua'
	no file './SDL.lua'
	no file './SDL/init.lua'
	no file '/usr/lib64/lua/5.3/SDL.so'
	no file '/usr/lib64/lua/5.3/loadall.so'
	no file './SDL.so'
stack traceback:
	[C]: in function 'require'
	tutorial.lua:6: in main chunk
	[C]: in ?
$ lua -v
Lua 5.3.5  Copyright (C) 1994-2018 Lua.org, PUC-Rio

Which install step did I miss?

Any news regarding android?

Hello! A while ago I asked the same question regarding android.Do you got any news? Can we access opengl and opengl es?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.