vladar4 / libtcod_nim Goto Github PK
View Code? Open in Web Editor NEWWrapper of the libtcod library for the Nim language.
License: Other
Wrapper of the libtcod library for the Nim language.
License: Other
Using Nim stable and tried it on devel, windows x64.
So running a simple main or the samples I get the following error:
λ nim c samples.nim
Hint: used config file 'C:\Users\rskar\.choosenim\toolchains\nim-0.19.0\config\nim.cfg' [Conf]
Hint: system [Processing]
Hint: samples [Processing]
Hint: libtcod [Processing]
Hint: strutils [Processing]
Hint: parseutils [Processing]
Hint: math [Processing]
Hint: bitops [Processing]
Hint: algorithm [Processing]
Hint: unicode [Processing]
..\..\..\..\.nimble\pkgs\libtcod_nim-0.99\src170\parser.nim(117, 5) Error: expected closing ')'
Looking at the line there doesn't seem to be anything wrong with it though.
EDIT: removing the comment made it compile even though nim check threw a bunch of errors at me.
How would one go about adding support for 1.6.x?
https://libtcod.readthedocs.io/en/latest/upgrading.html
As far as I know 1.5.1 works well enough for most cases, so upgrading might not be even worth it.
If I have the following project structure:
-- data/font.png
-- src/main.nim ( and related dll's)
--out/main.exe
and in my main.nim a const set as
const font = "../data/font.png"
I get the following error when running the main binary :
SDL : cannot load ../data/font.png
However putting the main.exe and dll's in the src folder and then running the executable it works perfectly fine.
Not a big thing and maybe even my fault, but is this something known? Googling get's me an answer saying it should be in the same folder as your source files.
This command:
./build_samples
results in this error:
/home/david/.nimble/pkgs/sdl1-1.0.0/sdl.nim(1064, 27) Error: undeclared identifier: 'expr'
just for cross referencing
c:\users\ransel\.babel\pkgs\libtcod-nim-0.95.1\libtcod\console.nim(218, 22) Info: instantiation from here
c:\users\ransel\.babel\pkgs\libtcod-nim-0.95.1\libtcod\console.nim(211, 6) Error: undeclared identifier: 'allocWideCString'
Getting this error when trying to compile on Windows.
I got this error when compiling the samples in the latest Nim version 1.2.2:
C:\...\samples112\samples.nim(1489, 31) Error: type mismatch: got <tuple of (string, proc (first: bool, key: ptr Key, mouse: ptr Mouse){.cdecl, locks: <unknown>.})> but expected 'tuple of (string, proc (first: bool, key: ptr Key, mouse: ptr Mouse){.cdecl, gcsafe, locks: 0.})'
To make it work I added the gcsafe
pragma to this line:
libtcod_nim/samples112/samples.nim
Line 1145 in 8c443ae
But it throws this warning, though:
C:\...\libtcod_nim\samples112\samples.nim(1145, 6) Warning: 'renderName' is not GC-safe as it accesses 'names' which is a global using GC'ed memory [GcUnsafe2]
By the way, there's also this warning lying around there:
C:\...\.nimble\pkgs\libtcod_nim-1.112.0\src112\sys.nim(161, 53) Warning: use `csize_t` instead; csize is deprecated [Deprecated]
I've been using these bindings, but they're quite outdated for some time now. There are some more recent features that I'd love to be using.
Sadly I don't have the knowledge to do this myself and help you out with a pull request...
Congratulations!!!
The GitHub(notreally) team has awarded you with the needed website of the week. If you want to win a lot of FAME and rock EVERYWHERE you go, please follow these steps to claim your new and FREE website:
babel install gh_nimrod_doc_pages
.$ cd path/to/your/git/libtcod-nim-checkout
$ git checkout --orphan gh-pages
$ git rm -rf .
$ gh_nimrod_doc_pages -b
gh_nimrod_doc_pages.ini
file to contain the following lines:["gh-pages"]
update_html=index.html
doc_dir=docs
branches="""
master
"""
doc2_modules="""
libtcod/libtcod.nim
"""
link_html="""
README.html
libtcod/libtcod.html
"""
$ gh_nimrod_doc_pages -c .
$ git add . && git commit -v
$ git push --set-upstream origin gh-pages
Enjoy your new FREE website for your project!!!
Disclaimers:
When running build_samples.sh, I first get this error:
samples.nim(7, 8) Error: cannot open file: libtcod
I need to work around that by editing samples.nim line 7, and changing this line:
import libtcod, os, parseutils, math
To this:
import ../libtcod, os, parseutils, math
My next problem after that is this error:
../libtcod_nim/private/console.nim(163, 14) Error: usage of 'isNil' is a user-defined error
Which I can work around by adding a sample.nims file with these contents:
--nilseqs:on
After which, the 'samples' binary compiles and runs fine.
The samples work fine so I'm not sure why this small snippet isn't working:
when isMainModule:
consoleSetCustomFont(font, FONT_LAYOUT_ASCII_INROW)
consoleInitRoot(ScreenWidth, ScreenHeight, "Demo", false, renderer)
while not consoleIsWindowClosed():
consoleSetDefaultForeground(nil, WHITE)
consolePutChar(nil, 1, 1, '@', BKGND_NONE)
consoleFlush()
discard sysCheckForEvent((EVENT_KEY_PRESS.ord or EVENT_MOUSE.ord), addr(key), addr(mouse))
if key.vk == K_ESCAPE: break
libtcod.quit()
renderer
is set to RENDERER_SDL2
and I get the following error:
Traceback (most recent call last)
C:\Users\rishiPC\stack\dev\gamedev\ndtrl\src\main.nim(15) main
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
line 15 being the consoleInitRoot
call.
When running the samples (112), when I select the name generator something goes out of bounds:
main.nim(1607) main
main.nim(1169) renderName
system.nim(2918) sysFatal
Error: unhandled exception: index out of bounds [IndexError]
(I'm not running the samples along with the repo, though, I just copied the code from samples.nim
into a file, placed the fonts in data/fonts
next to it, changed the DATA_PATH
const in the code from "../data/"
to "./data/"
and compiled it. Not sure if any of that makes a difference.)
I've tried running it a few more times and it's happening every time I select the name generator, but just a few minutes ago I was able to select it for some reason, and it was throwing this into the console repeatedly:
Registered syllable sets are:
The name "" has not been found.
I never tried libtcod samples before, so I don't know what the normal behavior for the name generator is, but I found it odd that when I pressed +
and -
it showed something like =====
(iirc, or maybe it was """""""
) on the screen. I supposed it should be showing generated names.
Trying to run a very basic project:
Traceback (most recent call last)
wizx_roguelike.nim(54) wizx_roguelike
wizx_roguelike.nim(23) handle_keys
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
Error: execution of an external program failed: '/home/david/learning/dev/LATER/roguelike_tutorials/BAD_roguelike_tutorial_in_nim/my_new_project/wizx-roguelike/src/wizx_roguelike '
Tip: 8 messages have been suppressed, use --verbose to show them.
Error: Execution failed with exit code 1
... Command: "/home/david/dev/learning/misc/nim/github/Nim/bin/nim" c --noNimblePath --path:"/home/david/.nimble/pkgs/libtcod_nim-0.98" --path:"/home/david/.nimble/pkgs/sdl1-1.0.0" "-r" "src/wizx_roguelike.nim"
Have attached wizx_roguelike.nim for reference.
Renamed to .nim.txt, since github doesn't like uploading of .nim files.
Warning: Package 'libtcod_nim' has an incorrect structure. The top level of the package source directory should contain at most one module, named 'libtcod_nim.nim', but a file named 'libtcod.nim' was found. This will be an error in the future.
Hint: If this is the primary source file in the package, rename it to 'libtcod_nim.nim'. If it's a source file required by the main module, or if it is one of several modules exposed by 'libtcod_nim', then move it into a 'libtcod_nim/' subdirectory. If it's a test file or otherwise not required to build the the package 'libtcod_nim.nim', prevent its installation by adding `skipFiles = @["libtcod.nim"]` to the .nimble file. See https://github.com/nim-lang/nimble#libraries for more info.
/home/david/.nimble/pkgs/libtcod_nim-0.98/libtcod_nim/private/console.nim(163, 14) Error: usage of 'isNil' is a user-defined error
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.