1
SFML projects / Lua Binding
« on: December 14, 2013, 12:18:50 pm »
Hi,
During a long time I was looking for a simple and fast GameEngine but I could find something as simple and light weight as SFML. So I found myself writing one, but more the time pass, less I wanted to lost time with C++. I wanted to be able to fast prototyping like it can be done with GameMaker for example. And here I am porting SFML to Lua.
I wanted it to be simple (mirroiring SFML API) light weight (no Boost at all). It's not finished yet (no network for example). I've added some extra classes like TileMap or SceneGraph Item.
I've not reach yet my objective to fast prototyping but it's been pretty fun. I hope you will enjoy it.
The source code is avaible https://github.com/Canadadry/luaSFML
On the repo you will find some test project I've made in the demo folder. There is a Tetris, a pong, and a Minesweeper.
Here an example of script :
math.randomseed(os.time())
window = sfRenderWindow.new(sfVideoMode.new(640,480,32),"Test",sfWindowStyle.Default);
window:setFramerateLimit(30)
circle = sfeSGItem.new();
circle:move(50,50);
circle:setWidth(100);
circle:setHeight(100);
child1 = sfeSGItem.new(circle);
child1:setWidth(50);
child1:setHeight(50);
clearColor = sfColor.new(math.random(256)-1,math.random(256)-1,math.random(256)-1);
event = sfEvent.new();
while window:isOpen() do
i = 0;
while window:pollEvent(event) do
if(event:type() == sfEventType.Closed) then window:close(); end
if(event:type() == sfEventType.KeyReleased and event:key():code() == sfKey.Escape ) then window:close(); end
if(event:type() == sfEventType.KeyReleased and event:key():code() == sfKey.Q and event:key():system() == true ) then window:close(); end
end
circle:rotate(1);
child1:rotate(-2);
window:clear(clearColor);
window:draw(circle);
window:display();
end
Thanks for reading me
During a long time I was looking for a simple and fast GameEngine but I could find something as simple and light weight as SFML. So I found myself writing one, but more the time pass, less I wanted to lost time with C++. I wanted to be able to fast prototyping like it can be done with GameMaker for example. And here I am porting SFML to Lua.
I wanted it to be simple (mirroiring SFML API) light weight (no Boost at all). It's not finished yet (no network for example). I've added some extra classes like TileMap or SceneGraph Item.
I've not reach yet my objective to fast prototyping but it's been pretty fun. I hope you will enjoy it.
The source code is avaible https://github.com/Canadadry/luaSFML
On the repo you will find some test project I've made in the demo folder. There is a Tetris, a pong, and a Minesweeper.
Here an example of script :
math.randomseed(os.time())
window = sfRenderWindow.new(sfVideoMode.new(640,480,32),"Test",sfWindowStyle.Default);
window:setFramerateLimit(30)
circle = sfeSGItem.new();
circle:move(50,50);
circle:setWidth(100);
circle:setHeight(100);
child1 = sfeSGItem.new(circle);
child1:setWidth(50);
child1:setHeight(50);
clearColor = sfColor.new(math.random(256)-1,math.random(256)-1,math.random(256)-1);
event = sfEvent.new();
while window:isOpen() do
i = 0;
while window:pollEvent(event) do
if(event:type() == sfEventType.Closed) then window:close(); end
if(event:type() == sfEventType.KeyReleased and event:key():code() == sfKey.Escape ) then window:close(); end
if(event:type() == sfEventType.KeyReleased and event:key():code() == sfKey.Q and event:key():system() == true ) then window:close(); end
end
circle:rotate(1);
child1:rotate(-2);
window:clear(clearColor);
window:draw(circle);
window:display();
end
Thanks for reading me