libtcod binding (version 1.5.1)
libtcod binding (version 1.5.1)
A binding for libtcod is available now.
TCOD = The Chronic Of Doryen. It's a library for 'roguelike' developers. For details see the original webpage.
The download contains the header for using the C-part of the library in FreeBasic, connecting the library and making its functions avialable:
TCOD = The Chronic Of Doryen. It's a library for 'roguelike' developers. For details see the original webpage.
The download contains the header for using the C-part of the library in FreeBasic, connecting the library and making its functions avialable:
Last edited by TJF on Sep 19, 2012 8:20, edited 3 times in total.
You're wellcome.rdc wrote:Very cool indeed. Thanks for the work on this.
I made the translation as a test for the new h_2_bi release (0.2). I was pretty surprised that it translated without manual fine tuning. I did just some settings in the config file.Ryan wrote:... h_2_bi and swig failed me, so I was steeling myself to do it manually. What did you use to do it?
Hopefully it works. I don't know how to use the lib (and I'm too busy to learn), so I did not test it.
-
- Posts: 272
- Joined: May 28, 2005 10:21
- Contact:
TJF, I'm a little confused on how to use this. ; )
What files from the libtcod download do I need to have, and where do they need to be located in relation to your .bi when I include it? Do I have to manually include something else? Also, because I'm getting the line ending problem in fbEdit, I'm guessing you made this on Linux? If so, will the same wrapper still work for the Windows DLL?
What files from the libtcod download do I need to have, and where do they need to be located in relation to your .bi when I include it? Do I have to manually include something else? Also, because I'm getting the line ending problem in fbEdit, I'm guessing you made this on Linux? If so, will the same wrapper still work for the Windows DLL?
Yes, the header is made on LINUX. FB has no problem with the line endings, it's only an FbEdit issue. Ie see this post, where you also can find a quick-and-dirty solution for converting the header. Also, you may consider using Geany.Ryan wrote:Also, because I'm getting the line ending problem in fbEdit, I'm guessing you made this on Linux?
On LINUX I need to include the libtcod-1.5.1/libtcod.so file, which includes others too. I used this code:What files from the libtcod download do I need to have, and where do they need to be located in relation to your .bi when I include it? Do I have to manually include something else?
Code: Select all
' set a path to the binaries of the library (DLL-files)
#LIBPATH "libtcod-1.5.1"
' include the header (must be located in CURRDIR or FreeBasic/inc)
#INCLUDE "libtcod.bi"
This is a cross-platform library. It has different binaries (ie .dll on win, .so on LINUX). But the libraries include the same functions, so the header works for all systems supported simultaneously by TCOD and fbc.If so, will the same wrapper still work for the Windows DLL?
I was able to finish it on time. Got my little winner's Badge.Ryan wrote:Alrighty, well thanks for giving it a go. I'll see what I can do about getting some tests in... and rdc, any luck on that novel? : D
I have started working on LBAR again. Trying to remember what I was doing is the hard part. :)
I'm still not getting anywhere on this. I've made my .bas file in the same directory as the .dll files and added a lib path to the lib directory where the .a files are found. I also copied the .a files directly into my compiler's lib directory. Whenever I try to compile, it just fails with:
(Oh, and rdc, I downloaded and am reading through your novel. ; )..\..\fbc -s gui "libtcod.bas"
C:\FreeBASIC-0.21.1\bin\win32\ld.exe: cannot find -ltcod
-
- Posts: 272
- Joined: May 28, 2005 10:21
- Contact:
The easiest way is:Jocke The Beast wrote:*bump*
Same problem for me as Ryan here above. How to make it work (Windows here too)?
Cheers!
- switch to LINUX.
- Copy libtcod...dll into your project folder.
Copy libtcod...dll.a into your project folder.
Prepend a #LIBPATH "." to your code.
lol You think switching to Linux is easier for someone than copying a couple of files and adding a line of code? : P
Is there something more to the workaround that I'm not seeing? Like will it only partially support the DLL or something? Booting my Windows machine to give it a shot right now.
Is there something more to the workaround that I'm not seeing? Like will it only partially support the DLL or something? Booting my Windows machine to give it a shot right now.
Last edited by Ryan on Sep 23, 2011 21:23, edited 1 time in total.
-
- Posts: 272
- Joined: May 28, 2005 10:21
- Contact:
Hey Jocke! Things are going great for me - work's keeping me busy, but I still have visions of roguelikes. : P
I still can't get it to work even with TJF's hints. I created a libtcod.bas file in the same directory as his .bi header. The contents are:
Inside that same directory I copied libtcod-mingw.dll, libtcod-mingw.a, and SDL.dll. I still get the exact same error message on compile that I posted above:
I still can't get it to work even with TJF's hints. I created a libtcod.bas file in the same directory as his .bi header. The contents are:
Code: Select all
#LibPath "."
#Include "libtcod-1.5.1_TJF.bi"
Print "hi"
Sleep
The thing is, I have no clue why it's trying to find -ltcod. Perhaps it's really supposed to be looking for "-l tcod" and a space is missing somehow?Build error(s)
C:\freebasic\fbc -s console "libtcod.bas"
C:\freebasic\bin\win32\ld.exe: cannot find -ltcod