stetre / moonsdl2 Goto Github PK
View Code? Open in Web Editor NEWLua bindings for SDL2
License: Other
Lua bindings for SDL2
License: Other
I built it using mingw and ran the example with lua 5.2. The build seemed successful but when I went to run the example code it gave me this error.
C:\zbstudio\bin\lua52.exe: error loading module 'SDL2' from file 'C:\zbstudio\bin\clibs52\moonsdl2.dll':
Procedure not found.
stack traceback:
[C]: in ?
[C]: in function 'require'
C:\games\sdltest\main.lua:4: in main chunk
[C]: in ?
Im using the example with lua 5.4 and I'm on windows
local sdl = require("moonsdl2")
sdl.init()
local window = sdl.create_window("Hello, triangle!", nil, nil, 800, 600, sdl.WINDOW_SHOWN)
local renderer = sdl.create_renderer(window, nil, sdl.RENDERER_ACCELERATED|sdl.RENDERER_PRESENTVSYNC)
local vertices =
{ -- position color
{ { 400, 150 }, { 255, 0, 0, 255 } },
{ { 200, 450 }, { 0, 0, 255, 255 } },
{ { 600, 450 }, { 0, 255, 0, 255 } },
}
local quit = false
while not quit do
e = sdl.poll_event()
if e then
print(e[item])
if e.type == 'quit' then quit = false end
end
renderer:set_draw_color({0, 0, 0, 255})
renderer:clear()
renderer:render_geometry(nil, vertices, nil)
renderer:present()
end
I built the moonsdl2 library on windows using mingw64 and msys2. Thing is, running the example gives this:
`C:\Lua\5.4\lua54.exe: error loading module 'moonsdl2' from file '.\moonsdl2.dll':
%1 is not a valid Win32 application.
stack traceback:
[C]: in ?
[C]: in function 'require'
main.lua:1: in main chunk
[C]: in ?`
Important to note that i dont think i properly built it, it gave this error many times:
When the window becomes unfocused running the Wayland SDL driver (SDL_VIDEODRIVER=wayland
) there is a segfault in the event handling. Can be reproduced with e.g. the hello.lua example.
https://github.com/stetre/moonsdl2/blob/master/src/events.c#L126
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.