It has been a busy couple days since my "I'll get the wrapper up here that night" post. A few more last minute issues, including a weird race condition with different .NET runtimes that I think I ironed out, held this up, but now it is ready.
C# Wrapper
Lua Wrapper
The C# wrapper is now powering magecrawl, which is a pretty significant codebase, so hopefully most of the issues there are ironed out. With Lua, the "hello world" demo works, but I don't know lua well enough to test it beyond that.
Please note, that the libtcod these use is the svn of the upcoming 1.5.x release, and is therefor unstable. The API might change, it might crash, it could steal your girlfriend and watch TV while you're at work, so report bugs you find so they can ironed out early.
Beyond that, I finished all the C# documentation for the new release, so when that comes out, C# will be a first class citizen. My todo list for libtcod is just about done now, so expect a new post in the next few days talking about scheduling magecrawl and "rebooting" this iteration.
Subscribe to:
Post Comments (Atom)
12 comments:
Excellent!
Awesome news !
I'll try the lua kit tonight.
Thanks for all the work done !
Looking forward to the next magecrawl release too ;)
This version does not have an executable in the zip file ?
T.
Which version, lua or c#? lua has a lua script you can run, and c# should have TestApp.exe?
With this version an exception is thrown when using TCODConsole.root.printLine():
System.EntryPointNotFoundException was unhandled
Message=Unable to find an entry point named 'CSharp_TCODConsole_printLine' in DLL 'libtcod-net-unmanaged.dll'.
Source=libtcod-net
TypeName=""
StackTrace:
at libtcod.libtcodPINVOKE.TCODConsole_printLine(HandleRef jarg1, Int32 jarg2, Int32 jarg3, Int32 jarg4, Int32 jarg5, String jarg6)
at libtcod.TCODConsole.printLine(Int32 x, Int32 y, TCODBackgroundFlag flag, TCODPrintLocation location, String fmt)
at MidAge.Program.Main(String[] args) in C:\Users\nmelzer\Documents\Visual Studio 2010\Projects\MidAge\MidAge\Program.cs:line 34
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
Im using MSVS 2010 RC, C# and .net 4.0
Two things:
One do you have all of these in the directory you are running your application from:
libtcod-net.dll
libtcod-net-unmanaged.dll
libtcod-VS.dll
SDL.dll
zlib1.dll
terminal.png (or your font of choice)
Two, your project needs to be set to .net 3.5 since that's what libtod-net is set for. It's under:
Right Click Project
Properties
Application
Target Framework
I have changed to .net 3.5, doesn't help.
It worked with the last version of the swigged lib. After changing the *.dlls with the new ones, it doesn't work anymore
Oh, the problem is that your using PrintLine(). Jice changed all the printing APIs:
http://doryen.eptalys.net/forum/index.php?topic=499.0
You need to update your code:
http://doryen.eptalys.net/data/libtcod/doc/1.5.1/html2/console_print.html
Is there any way you could give a short tutorial on how to use the TCODConsole.isWindowClosed() and TCODConsole.isKeyPressed() functions? I swear, I am using the correctly, but I can't get my game to exit at all. Here's a snippet of the code I am using (note, lots of stuff has been removed):
//using stuff
public class Program
{
public static void Main(String[] args)
{
//init code here
while (true)
{
//Do stuff
TCODConsole.flush();
if (TCODConsole.isKeyPressed(TCODKeyCode.Escape) || TCODConsole.isWindowClosed())
break;
}
}
}
Try:
//using stuff
public class Program
{
public static void Main(String[] args)
{
//init code here
while (!(TCODConsole.isKeyPressed(TCODKeyCode.Escape) && !TCODConsole.isWindowClosed() )
{
//Do stuff
TCODConsole.flush();
}
}
I found out the problem. You need something similar to the following in the while loop for any key or window close to be recognized:
TCODKey key = TCODConsole.checkForKeypress((int)TCODKeyStatus.KeyPressed);
You don't even really need the "TCODKey key = " part, but I find it could come in useful later.
Thanks for your help.
Wow, I can't believe I missed that. Yeah, you need to check for keypress in some way in your main loop. That pumps messages under the hood, which is how you'll get events.
Post a Comment