Hey, a while back I wrote an article on this subject:
[https://16bpp.net/page/hot-loading-code-in-nim](https://16bpp.net/page/hot-loading-code-in-nim)
Neat work you've done though.
I know there are packages out there such as `glm` (which I'm already using).
But are there any good **pure Nim** packages/libraries for doing geometric
computations? I'm looking to target JS.
I think the Leap Motion C API docs look quite nice:
[https://developer.leapmotion.com/documentation/v4/index.html](https://developer.leapmotion.com/documentation/v4/index.html)
I've been playing around with the db_sqlite module a bit. Looking at the procs
for exec() and getRow()/getAllRows() It can take an option args parameter. are
these arguments automatically sanitized for me, or do I manually need to do it
myself. I'd like to avoid a "Bobby Tables" incident in the
Hi, it's been a while since I posted here in the community (or done much with
Nim), but here at least is my $0.02:
I'm not a big fan right now of how inline documentation comments/strings work.
1. This may be more of a personal preference, but I don't like putting the
documentation right in
Does it live update to when the style changes? That's one of the benefits
CSSStyleDeclaration is that if you change the CSS for an object, you don't need
to query for the style declaration again.
I'm writing an app right now and I need to figure out what the width & height
of div, with it's applied CSS styling. Back in vanilla JS, there is the
function
[getComputedStyle()](https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle)
which will give me
Sorry for the belated reply.
I'm a little confused at what you're trying to achieve here. Can you explain it
in a few words what you want? It it something with trying to get dynamically
allocated memory to place nice with hot-loaded code?
I wrote this article a while back:
[https://16bpp.net/page/hot-loading-code-in-nim](https://16bpp.net/page/hot-loading-code-in-nim)
Sorry to be a bit of a pest, but I want to know if this is the thing I should
be doing or not for my Nim code now?
Okay, that sounds better to me. So for in my case with my stb_image wrapper,
should I switch the API now to use seq[byte] or should I hold off on it for a
little longer?
This stems from some discussion I've had on the stb_image bindings:
[https://gitlab.com/define-private-public/stb_image-Nim/issues/4#note_40535183](https://gitlab.com/define-private-public/stb_image-Nim/issues/4#note_40535183)
I'd like some discussion on the use of the string datatype for
Yeah, I have the killServer = true in a block somewhere.
Adding return after server.close() does work, but I need to mark server with
{.threadsafe.}. It also causes an issue with the HTTP Request (on the browser
side) doesn't get finished and just hangs. Interestingly enough this doesn't
It now compiles successfully, but it doesn't seem to be killing the server when
I trip that killServer block. It will run over the line and continue on with
execution.
So I've got some code like this:
import asyncDispatch
import asynchttpserver
# Create the server object and state data
var
server = newAsyncHttpServer()
let port = 8000
# ...
proc handleRequest(req: Request) {.async.}=
## Handle an
So this is a fun issue now...
I've gotten the bindings to work, but when you want to do something with
Textures, they won't display on the screen. The raylib tracelog says everything
is okay when it came to loading the assets. I'm tracking the issue here:
Taking a look [at the man page for
dlopen(3)](http://man7.org/linux/man-pages/man3/dlopen.3.html), I think the
easiest thing to do would to be to wrap the dlopen() call in the Nim code in
something that sets and then resets the LD_LIBRARY_PATH environment variable.
Taking a look at the
I consider it something that Nim should be concerned about. It's already caused
me a fair bit of grief trying to get the bindings working on Linux and I'm sure
anyone else will run into the same issue down the road. Keep in mind it's not
my .so that it was failing to find, but an .so that mine
I think I figured out why setting export LD_LIBRARY_PATH=/usr/local/lib was
necessary to make it work. [The dlopen()
function](http://man7.org/linux/man-pages/man3/dlopen.3.html) is used under the
hood for the dynlib macro on Linux. dlopen() will not search /usr/local/lib by
default. It needs
I use ubuntu (well, xubuntu... technically). I doubt it's a bug on their side.
Someone else would have tripped over this way before I would have and fixed it
too.
I've been able to get the Nim bindings to work on Linux using .so files!! There
is still a bit of an odd quirk:
1. GLFW 3.2.1 needs to be installed (with cmake -DBUILD_SHARED_LIBS=ON) from
source (sudo make install). So those get put in /usr/local/lib
2. raylib needs to be installed (with
I found out some more information about the issue on Linux. If you read the
link to my edited post at the top it explains a little more. tl;dr the
raylib.so Linux .so is broken.
I'm trying to get some Nim bindings for [this neat little game programming
library called raylib](https://github.com/raysan5/raylib/). But well, I'm
having some difficulties trying to do so.
After cleaning up raylib.h, I was able to use c2nim to auto-generate a .nim. I
commented out a few
I made a game called "Pucker Up," for the Linux Game Jam 2017. The original
entry's source can be found here:
[https://gitlab.com/define-private-public/LGJ2017](https://gitlab.com/define-private-public/LGJ2017)
I also was able to (with moderate ease) pull out the OpenGL & SDL2 stuff, and
I was looking into using that stuff to port what I did for the Game Jam to JS,
but I was wondering about how to get SDL_Mixer compiled to JS.
Also, I can't remember who here runs the Hookrace.net blog, but they talked
about how they got NimES their (Nim & SDL2 NES emulator) ported to JavaScript:
[https://hookrace.net/blog/porting-nes-go-nim](https://hookrace.net/blog/porting-nes-go-nim)/
Also, I can't remember who here runs the Hookrace.net blog, but they talked
about how they got NimES their (Nim & SDL2 NES emulator) ported to JavaScript:
[https://hookrace.net/blog/porting-nes-go-nim](https://hookrace.net/blog/porting-nes-go-nim)/
> Honey badgers are admired precisely for their capacity and inclination to do
> violence. A Nim honey badger should look meaner than most I'd think.
Should we have it ripping apart a Snake? Or gnawing down on a Gopher?
@jester, those designs do look a lot better IMO.
Aww man, and here I was hoping for some sort of cutesy anime girl for a mascot.
Oh well : P (Just kidding)
I think having a mascot is a good idea, but I don't think that having him front
and center everything would be good. Having the crown logo in more places would
be better. I also think the
Is it something related to stdin's default buffer size? Default is around 4096
character IIRC.
When I ran a debug build, I got this stack of errors:
Traceback (most recent call last)
random_art.nim(185) random_art
equationParser.nim(51) parseEquation
equationParser.nim(73) buildEquation
ModExpr.nim(72) buildMod
equationParser.nim(75)
One of my favorite things from C#/Java are interfaces and I've been trying to
work on writing some macros can generate an interface and allow you to
implement it. So far I've played around with getting some sort of "toy
interface," working as well as some of the macros too.
Here is my initial
You need to add the export marker right after the proc's id. Try this:
proc testEcho*() =
echo "hello world"
You can also drop that : void part too.
Sounds like a cool idea, but I'd be interested in reading a newsletter first.
You will need to add this proc for the add:
proc add*(es: var ExtSeq; x: int) {.inline.}=
es.s.add(x)
The inline pragma isn't necessary, but it speeds things up a little.
For using the index tokens ([ and ]), you just need to override that proc too:
# Get
Wow. Thanks for that post. I think this belongs in the docs somewhere or on a
wiki.
I came across this issue when I was change the prototype of a base method but
forgot to change one of the child objects. So for that specific child object it
was using the base method. Would using the base
Let's have a code example. When I'm using ref object of ... This code:
type
Animal = ref object of RootObj
name: string
method makeNoise(this: Animal) {.base.} =
echo "..."
type
Human = ref object of Animal
Dog = ref object of
I put the source of the header in it's own .nim file so my users wouldn't have
to add a \--cincludes: option at the compilation step.
I do find it odd that import had different behavior on Linux vs. OS X in
regards to this, and it effected a return value.
Well, I got the unit tests run without any segfaults (on OS X).
On a whim, I decided to change the import stb_image_header line (in
stb_image.nim) to use the include statement instead; it worked. Is this a bug I
should report?
Alright, I tried that and it does echo out a pointer address (e.g. 0xFFff08b7e).
Where this is getting kind of weird for me is that I have this raytracer that
I'm working on that uses stb_image.h as well and it able to load an image on OS
X without throwing a seg fault. The code for the
It shouldn't be an issue with the test suite. I added this line right after the
let data = stbi_load(... call
echo x
echo y
echo channels_in_file
echo data.repr
And it gave me this output:
2
2
4
Traceback (most recent call last)
I'm working on my stb_image wrapper right now. It's almost ready for release.
But to be a good little developer I want to test it on the three major
platforms (Linux, OS X, and Windows) before saying it's v1.0.
I developed it on Linux and it passes all of the unit tests. But when I tried
to
I went with yglukhov's solution (since it seemed to be the simplest to use),
but It's really what I wanted to avoid doing.
Thanks for that post, it definitely gave me a lot of insight into what is going
on in Nim. I'm working with a lot of pixel data and wanted to return it from a
function as a seq[uint8]. I want to avoid it doing an necessary copy (on
return) for a lot of data (which I assume is happening right
How does Nim return values from a proc? Are basic datatypes (like int and
float) returned by copy? What about more complex structures like sequences and
strings?
For example, would this proc:
proc fillWith(n, count: int): seq[int] =
var s: seq[int] = @[]
for i in
I want to work on a
[stb_image](https://github.com/nothings/stb/blob/master/stb_image.h) wrapper.
I'm trying to figure out the best (and most efficient) way of storing pixel
data in Nim's data structures.
stb_image stores the pixel data in an unsigned char * type. I had a chat with
the person
I'm working on porting over some ray tracing code from a C++ project. So far
things have been fine, but they used this library called
[stb_image.h](https://github.com/nothings/stb/blob/master/stb_image.h) to load
in textures.
I thought I would try to create a wrapper for the single function
I'm trying to map my "quadruplet" object to an unsigned 32-bit number, that is
supposed to represent an RGBA pixel. I'm able to convert my floating point
quadruplet values to their respective R, G, B, and A components, but when I try
to do an and on all of the components, I'm getting a 0. Here
That second one "with force," is what did the trick. (That first one didn't
compile).
Thanks!
Right now I'm trying to get a simple OpenGL ES example working with Nimious' GL
ES bindings. I'm hitting a bit of a wall when trying to get the proc
glShaderSource() to accept my shader's source code (which is gotten through the
readFile() proc, which outputs a nim string). Here is a link to
Oh, did not know that. Thanks! I didn't find any mention of that in the Nim
manual, it might be something to add here:
Right now I'm trying to do a very tiny OpenGL in nim. I'm at the stage where I
need to bind my buffer data. The compiler is giving me this error:
Error: expression has no address
Here is the C code I'm trying to port:
float points = [
0.0, 0.5, 0.0,
No, that's for the proc that returns a boolean. I meant for the one that
returns a TaintedString.
Thanks. What would readLine() return though (using the proc I linked) if it
reached EOF?
I know that this exists to cover what I want to do:
for line in lines filename:
echo line
But how would I go about it using the [readLine() function
here](http://forum.nim-lang.org///nim-lang.org/docs/system.html#readLine,File)?
56 matches
Mail list logo