1
General / Re: Making a Lua binding, questions
« on: June 07, 2012, 01:19:39 am »
Yay, I finally found out what makes it work! It took me hours of testing to isolate the cause as the behaviour seemed totally random.
To sum it up:
and NOT sf::WindowHandle.
Here are updated, working sources: Download link
(By the way main.cpp in the previous archive was obviously the wrong one, sorry for that ^^')
Window executable demo using the handle at main.lua:21 and 22. The window "stops responding" however, not sure if that's normal behaviour or not as I've never played with these functions before.
It's really annoying that I'd have to make the binding OS-specific though, and it looks like it's going to bring lots of problems. Maybe it's better if I left it out of the binding, or only include it with a compilation option? :/
To sum it up:
- In general, no matter how I did it, compilation will crash when binding something with sf::WindowHandle, the trick mentioned in the link didn't seem to work.
- It turns out that by great luck, I tried binding the window in a file that included "Window.h" for completely unrelated reasons, and it worked!
- I put everything back how it was and just included "Windows.h" in the file for window binding, and it worked as well.
luabind::scope register_WindowHandle()
{
#ifdef BUILD_WINDOWS
return
class_<HWND__>("HWND__")
;
#endif
}
{
#ifdef BUILD_WINDOWS
return
class_<HWND__>("HWND__")
;
#endif
}
and NOT sf::WindowHandle.
Here are updated, working sources: Download link
(By the way main.cpp in the previous archive was obviously the wrong one, sorry for that ^^')
Window executable demo using the handle at main.lua:21 and 22. The window "stops responding" however, not sure if that's normal behaviour or not as I've never played with these functions before.
It's really annoying that I'd have to make the binding OS-specific though, and it looks like it's going to bring lots of problems. Maybe it's better if I left it out of the binding, or only include it with a compilation option? :/