<< 13-07-2023 >>

00:20:47FromDiscord<ringabout> In reply to @Elegantbeef "<@658563905425244160>\: an inane wiki": Thanks for informing me. But all I can do is delete it.
00:27:17*mahlon joined #nim
00:31:19NimEventerNew Nimble package! DxLib - A Nim binding for DX Library, see https://github.com/777shuang/DxLib
01:16:31*azimut joined #nim
01:21:21*disso-peach joined #nim
01:46:05FromDiscord<odexine> Recursion good only if language has good support for it, which most don’t :baqua:
02:10:34FromDiscord<Benjamin> \Tail recursion
02:21:33FromDiscord<odexine> Not even just tail recursion I believe
02:22:48FromDiscord<takemichihanagaki3129> In reply to @odexine "Recursion good only if": I'm curious now. What should be considered a good support and what language does it well?↵(Genuine question)↵↵I particularly avoid recursion due to stack overflow...
02:23:57FromDiscord<Elegantbeef> Exactly the point of tail call optimisation and friends
02:24:11FromDiscord<Elegantbeef> Some languages rewrite recursion to not grow the stack more than once
02:25:05FromDiscord<takemichihanagaki3129> Impressive! I'll look for this.
02:25:18FromDiscord<odexine> CPS can generalise any recursion into tail recursion IIRC
02:25:40FromDiscord<michaelb.eth> In reply to @takemichihanagaki3129 "I'm curious now. What": Racket thoroughly supports and promotes use of recursion, and combines it with support for delimited continuations (not the same thing as call/cc) for extreme flexibility in program control flow
02:26:41FromDiscord<Elegantbeef> C does have limited optimisation for TCO iirc
02:27:07FromDiscord<michaelb.eth> I think maybe Guile offers a similar level of support for recursion and delimited continuations, but there aren't too many langs that do, though maybe it's available in some extensions for OCaml and Haskell in hyper-brain Oleg
02:27:23FromDiscord<michaelb.eth> (edit) "in" => "created by"
02:27:43FromDiscord<Elegantbeef> I say C, but I mean GCC, Clang, MSVC can optimise it
02:28:21FromDiscord<Elegantbeef> I do wonder how fugly a macro that did TCO would be
02:30:35*rockcavera quit (Remote host closed the connection)
02:30:54FromDiscord<takemichihanagaki3129> @odexine @elegantbeef and @michaelb.eth ↵Thanks you guys, I'll search these terms. ↵Sounds very interesting to me.
02:36:22FromDiscord<Elegantbeef> I was playing around with Odin and wrote a fractal tree generator originally using recursion, moved it to iterative and allowed me to spawn more nodes
05:17:17*ovenpasta joined #nim
06:05:45FromDiscord<bung8954> I have a object with some functions, when I compile with `vcc` and echo repr all functions have address, when come up to `gcc` one of them shows `nil`, any idea ?
06:14:23*ntat joined #nim
06:16:26FromDiscord<demotomohiro> It means you have an object that contains pointers to functions?
06:18:02FromDiscord<bung8954> yes it's windows com interface,only functions
06:19:30FromDiscord<demotomohiro> How they are initialized?
06:19:33FromDiscord<bung8954> sent a code paste, see https://play.nim-lang.org/#ix=4Atn
06:19:55FromDiscord<bung8954> the `Invoke` become nil
06:23:34FromDiscord<demotomohiro> `result.lpVtbl = vtbl.addr` seems unsafe code.↵It stores the pointer to `vtbl`that is in stack.
06:25:14FromDiscord<bung8954> what's the correct way?
06:25:48FromDiscord<Elegantbeef> likely just `result.lpVtbl`
06:25:51FromDiscord<Elegantbeef> or a heap allocated version
06:26:37FromDiscord<Elegantbeef> whoops
06:26:48FromDiscord<Elegantbeef> likely just `result.lpVtbl = vtbl`
06:27:03FromDiscord<Elegantbeef> Or a manually allocated version
06:28:58FromDiscord<demotomohiro> `var vtbl = ICoreWebView..()` is right hand side (ICoreWebView...VTBL) is a type or procedure?
06:30:11FromDiscord<bung8954> `var vtbl = create(ICoreWebView2CreateCoreWebView2ControllerCompletedHandlerVTBL); result.lpVtbl = vtbl` seems work
06:32:30FromDiscord<demotomohiro> It that a correct way and not undefined behaiver code?↵Did you read microsofts document about it?
06:32:34*ovenpasta quit (Ping timeout: 252 seconds)
06:32:50*ovenpasta joined #nim
06:33:02FromDiscord<arathanis> In reply to @odexine "Recursion good only if": or if its not a primitive recursive function and you have no choice
06:33:16FromDiscord<arathanis> but that is pretty rare
06:34:52*dv^_^ quit (Quit: dv^_^)
06:35:51FromDiscord<bung8954> In reply to @demotomohiro "It that a correct": I've read some documents and source code, well I didn't aware the difference between nim object initialization and `create`
06:36:53FromDiscord<bung8954> the program now pass this step and come to another error, so I think it's fine with that
06:37:11*dv^_^ joined #nim
06:40:01*PMunch joined #nim
06:59:55FromDiscord<demotomohiro> I think everyone who use C/C++ library should read books or documents about C and pointers so that they can use them safely.↵But learning about C and pointers might sounds like stupid for people using modern languages as C is an old language.
07:02:48FromDiscord<Elegantbeef> Well if you're using a system language you ought to do the due diligence and learn how low level things work
07:05:41FromDiscord<Elegantbeef> Though even in like C# knowing how stack memory works is important
07:08:16FromDiscord<bung8954> sent a code paste, see https://play.nim-lang.org/#ix=4Att
07:09:05FromDiscord<Elegantbeef> Inside a procedure named embed\_\_webview
07:09:08FromDiscord<Elegantbeef> Did you compile with `--debugger:native`?
07:12:32FromDiscord<bung8954> wow, that's amazing!
07:13:30FromDiscord<bung8954> https://media.discordapp.net/attachments/371759389889003532/1128947294767681548/3.PNG
07:15:21FromDiscord<Elegantbeef> you didnt do `vtabl[] = ICoreWebView2CreateCoreWebView2ControllerCompletedHandlerVTBL()` did you?
07:15:25FromDiscord<Elegantbeef> is `ICoreWebView2CreateCoreWebView2ControllerCompletedHandlerVTBL` a type or a procedure?
07:15:40FromDiscord<Elegantbeef> It has `create` in the name so it's... a procedure right, please say yes, my life depends on it
07:17:54FromDiscord<bung8954> `var vtbl = create(ICoreWebView2CreateCoreWebView2ControllerCompletedHandlerVTBL)`
07:18:10FromDiscord<Elegantbeef> Right but if that's a type you didnt populate it
07:18:56FromDiscord<Elegantbeef> Wait `ICoreWebView2CreateCoreWebView2ControllerCompletedHandlerVTBL` is a type eh?
07:19:05FromDiscord<Elegantbeef> It's unpopulated in your usage afaict
07:20:36FromDiscord<bung8954> it's a type
07:21:19FromDiscord<Elegantbeef> Well it's still unpopulated afaict
07:21:19FromDiscord<Elegantbeef> It's just a 0'd pointer until something writes to it
07:24:30FromDiscord<bung8954> sent a code paste, see https://play.nim-lang.org/#ix=4Atw
07:25:00FromDiscord<Elegantbeef> sure but `vtbl[]` is presently `0'd`
07:25:03FromDiscord<Elegantbeef> there is no data written to it
07:25:06FromDiscord<Elegantbeef> I doubt that's correct
07:26:31Amun-Rait a virtual table for accessing the API from the C world
07:26:45Amun-Rait's*
07:28:30FromDiscord<bung8954> yeah, it's like c++ object in c
07:28:52Amun-Rayes, that works like vtable in C++ classes
07:51:57FromDiscord<ambient3332> In reply to @sys64 "toposort? Also output call": https://en.wikipedia.org/wiki/Topological_sorting it makes it so that you don't have to do any recursive calls for computing a node graph, you can just do a for loop and some caching
07:54:24FromDiscord<ambient3332> I mean as long you don't have any loop. but modular synth is a DAG (at least should be)
07:58:34FromDiscord<ambient3332> In reply to @demotomohiro "I think everyone who": Nobody can use C or C++ safely. There are always memory issues. Always.
08:01:42FromDiscord<ambient3332> Also about tail calls: if your function naturally uses a tail call, it could be useful to try and see what happend with -d:lto. A tail call is actually my fastest version, can't beat it in either writing it out or trying to manually wrangle AVX2
08:02:10FromDiscord<ambient3332> (by writing it out I mean expanding it so as to remove the tail call)
08:20:02FromDiscord<System64 ~ Flandre Scarlet> In reply to @ambient3332 "I mean as long": My synth is like a tree↵There is never loops
08:34:25*ovenpasta quit (Ping timeout: 240 seconds)
08:35:19*ovenpasta joined #nim
08:54:03FromDiscord<4zv4l> I was just wondering, for what reasons did Nim choose `try except` for error handling over returning an error value like in Go, Rust, Zig ?
08:55:11FromDiscord<System64 ~ Flandre Scarlet> In reply to @4zv4l "I was just wondering,": Try Catch takes a lot of resources
08:57:24FromDiscord<4zv4l> so that's a reason against `try except`
08:57:45FromDiscord<System64 ~ Flandre Scarlet> No idea
09:05:11FromDiscord<gogolxdong666> Does memory leaks with orc for chronos backend?
09:05:37FromDiscord<ieltan> In reply to @4zv4l "I was just wondering,": The reason Nim choose `try: ... except:` is because it's the creator's preference. You can search `from: _araq exception` if you wonder why
09:05:37FromDiscord<gogolxdong666> (edit) "leaks" => "leak"
09:06:40FromDiscord<ieltan> Now i'm sure he's not the only one who prefers them too, etc...
09:09:54Amun-RaI like nim and zig error handling, I'm not a fan of rust/go one
09:10:14PMunchOne argument for exceptions is that it keeps the good path fast. Basically when nothing goes wrong there is no return values to handle, no stack space allocated for them, etc.
09:11:07PMunchOne of the reasons why you shouldn't use exceptions for control flow is because they are comparatively expensive compared to a check because they need to do things like stack unrolling and such.
09:12:11FromDiscord<4zv4l> In reply to @Amun-Ra "I like nim and": I am a huge fan of Zig error handling
09:12:36FromDiscord<ieltan> Yeah, if you expect your code to "error" a lot (which probably means 'not the value I want'), use options to handle your special case
09:13:26FromDiscord<4zv4l> you mean using std/options ?
09:13:34FromDiscord<ieltan> Yeah
09:13:45FromDiscord<4zv4l> I didn't find lot of library using it
09:16:15FromDiscord<gogolxdong666> What's the effect of useMalloc, does it return memory to OS sooner?
09:17:15FromDiscord<ieltan> In reply to @4zv4l "I didn't find lot": Well, that's because in Nim you're not supposed to use Options to express errors 🙂 you only use them to express a missing value and a lot of libraries do use options for this usecase
09:17:16FromDiscord<odexine> I believe the usual use case is so that tooling that tracks memory like Valgrind could work properly
09:17:50FromDiscord<odexine> The Nim standard library doesn’t contain an Either type
09:18:05FromDiscord<odexine> External libraries provide a result (specialised either) type
09:18:51FromDiscord<odexine> The nice thing about Nim’s exceptions is that they’re not necessarily heap allocated
09:24:19FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4AtU
09:25:21FromDiscord<heysokam> If I have two different libraries, and they contain the exact same type declaration...↵are the types compatible by default, or do they need conversion because they come from different modules/libs? 🤔
09:26:44FromDiscord<ieltan> In reply to @heysokam "If I have two": Can you even have two exact type declaration that coexist ?
09:27:01FromDiscord<ieltan> I dont think you can unless im mistaken
09:27:44FromDiscord<heysokam> In reply to @ieltan "Can you even have": definitely not in the same file... but i'm asking when the declarations are in different files/libraries
09:29:37FromDiscord<ieltan> sent a code paste, see https://play.nim-lang.org/#ix=4AtV
09:29:45FromDiscord<ieltan> (edit) "https://play.nim-lang.org/#ix=4AtV" => "https://play.nim-lang.org/#ix=4AtW"
09:29:54FromDiscord<ieltan> (edit) "https://play.nim-lang.org/#ix=4AtW" => "https://play.nim-lang.org/#ix=4AtX"
09:33:50*Guest99 joined #nim
09:34:00FromDiscord<odexine> In reply to @heysokam "If I have two": They are different
09:34:04FromDiscord<odexine> You will need conversion
09:35:42FromDiscord<System64 ~ Flandre Scarlet> In reply to @ieltan "Wrap `eval()` return type": I didn't understood very well
09:43:53FromDiscord<heysokam> In reply to @odexine "You will need conversion": is `lib1.Type1( myType2 )` enough, or does it need to be per-field?
09:43:56FromDiscord<ieltan> sent a code paste, see https://play.nim-lang.org/#ix=4AtZ
09:44:08FromDiscord<ieltan> Made some assuptions about the type you were using since you're checking for `NaN`
09:44:23FromDiscord<ieltan> which is `float64` according to Nim docs
09:44:35FromDiscord<ieltan> as you can see, no exceptions in sight
09:44:42FromDiscord<ieltan> use options 🙂
09:45:40FromDiscord<ieltan> also putting `{.raises: [].}` pragma is to disallow having procedures that can raise exceptions inside `eval` since you have performance constraint so definitively use it.
09:45:53FromDiscord<ieltan> (edit) "constraint" => "constraints"
09:49:45FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4Au1
09:56:24FromDiscord<ieltan> In reply to @sys64 "Oh I didn't know": I don't know your code, I just suggest you put it in the `eval` prog or in any proc that you don't want to raise exceptions in
09:56:32FromDiscord<ieltan> (edit) "prog" => "proc"
09:57:23FromDiscord<System64 ~ Flandre Scarlet> In reply to @ieltan "I don't know your": The eval proc comes from mathexpr module
09:57:45FromDiscord<ieltan> Ohh I see it's not your own, my bad
09:58:08FromDiscord<odexine> In reply to @heysokam "is `lib1.Type1( myType2 )`": Per field IIRC
10:00:13FromDiscord<System64 ~ Flandre Scarlet> In reply to @ieltan "Ohh I see it's": Yeah, so that's the problem
10:11:06*ovenpasta quit (Ping timeout: 258 seconds)
10:11:50*xet7 quit (Quit: Leaving)
10:29:58*Guest99 quit (Quit: Client closed)
11:09:30FromDiscord<jmgomez> @heysokam you could just do a `converter` that iterates over the fields and assign them
11:11:55FromDiscord<odexine> Or a regular procedure then just call that when needed
11:16:30FromDiscord<heysokam> In reply to @jmgomez "<@186489007247589376> you could just": problem is that the data could be large↵so was thinking of any potential way to avoid the processing step, since im already processing it twice (load from file, and then convert to lib1.Type)
11:16:57FromDiscord<heysokam> but the library that actually uses the data is lib2, which also has the same Type mapped
11:19:13FromDiscord<jmgomez> why dont you use the same type again?
11:19:34FromDiscord<jmgomez> also if they are an exact match a cast may work too
11:21:17*jmdaemon quit (Ping timeout: 246 seconds)
11:31:41FromDiscord<heysokam> In reply to @jmgomez "why dont you use": because lib2 is can have dependencies, but lib1 doesn't↵but the type is shared, so i would force lib1 to depend on lib2 just for the type only
11:32:25FromDiscord<heysokam> In reply to @jmgomez "also if they are": i guess, didn't think of that. gotta try 🤔
11:50:39FromDiscord<craciu25_YT> whats the fastest way to read a file? I tried using streams and memfile and both are pretty slow compared to python
11:52:29FromDiscord<ambient3332> What are you trying to achieve? Quick dump or entire data to memory, or some kind of random access?
11:52:53FromDiscord<craciu25_YT> I just want to read a file and loop in it
11:53:16FromDiscord<ambient3332> Also operating systems do cache file access, so Python might not actually be faster
11:54:33FromDiscord<craciu25_YT> nim takes 20s while python takes 2 seconds using the same file
11:54:51FromDiscord<craciu25_YT> (edit) "using" => "reading"
11:54:54FromDiscord<ambient3332> Did you use the readData in streams?
11:55:05FromDiscord<ambient3332> and what kind of code you used for Python?
11:55:39FromDiscord<craciu25_YT> in python I used open and in nim I tried newFileStream
11:58:17FromDiscord<ambient3332> Nim also has open and you can just read and dump the file into memory
11:58:54FromDiscord<craciu25_YT> I tried it too but I can't because the file needs to be opened with an encode and open does not has any arguments for encode
11:59:32FromDiscord<ambient3332> UTF-8?
11:59:40FromDiscord<craciu25_YT> latin 1
12:00:52FromDiscord<ambient3332> https://nim-lang.org/docs/encodings.html
12:01:49FromDiscord<craciu25_YT> I already took a look to that and you need to like have the string to convert it and the issue is that how I can't open it I can't convert it
12:15:20FromDiscord<ambient3332> sent a code paste, see https://play.nim-lang.org/#ix=
12:18:24FromDiscord<ambient3332> it's slow?
12:30:12FromDiscord<craciu25_YT> oh, I didn't know I could just add it after. I tought it would be an arg for readFile. Yes it works. Thanks
13:34:41FromDiscord<4zv4l> is there a way to readLine from stdin in a async way so that while it's not complete it still runs the other tasks ?
13:52:34FromDiscord<bung8954> sent a code paste, see https://play.nim-lang.org/#ix=4AuM
13:53:13FromDiscord<bung8954> (edit) "https://play.nim-lang.org/#ix=4AuM" => "https://play.nim-lang.org/#ix=4AuN"
14:17:41*PMunch quit (Quit: Leaving)
15:06:59Amun-Ra4zv4l: select(2)?
15:11:44FromDiscord<mratsim> In reply to @4zv4l "is there a way": you need to put that on another thread. stdin always block
15:11:56FromDiscord<mratsim> (edit) "block" => "blocks"
15:12:29FromDiscord<mratsim> see: https://github.com/dom96/nim-in-action-code/blob/master/Chapter3/ChatApp/src/client.nim#L48-L50
15:18:29FromDiscord<4zv4l> I’ll use spawn, thanks ! But it should be possible to use async io with stdin right ?
15:47:37FromDiscord<odexine> yet again i am surprised how nim does not have divmod
15:58:50FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4Avu
16:10:32FromDiscord<4zv4l> Is it easy to add a function to the stdlib ? I guess a pull request isn’t enough ? Need to argument etc. ? Otherwise could add it
16:13:32FromDiscord<Chronos [She/Her]> In reply to @demotomohiro "divmod is something like": Do we really need that as a separate stdlib function tho?
16:13:45FromDiscord<Chronos [She/Her]> Also, why exportc? And it could be a template, no need for a proc
16:14:26FromDiscord<Chronos [She/Her]> In reply to @yu.vitaqua.fer.chronos "Do we really need": I feel like it isn't something that'd be used by people often, which is why it probably already isn't in the stdlib
16:16:14FromDiscord<demotomohiro> In reply to @4zv4l "Is it easy to": At least, it needs good reason to add to stdlib.↵That function is commonly used by many people and not so hard to maintain by Nim devs.
16:17:20FromDiscord<demotomohiro> In reply to @yu.vitaqua.fer.chronos "Do we really need": I just copied it from godbolt.↵It doesn't need exportc.
16:17:47FromDiscord<demotomohiro> https://godbolt.org/z/6efd9f6aE
16:21:39FromDiscord<Chronos [She/Her]> Ah
16:35:07FromDiscord<graveflo> In reply to @odexine "yet again i am": I added divmod to devel. It's in `math`
16:35:21FromDiscord<odexine> on stable?
16:35:25FromDiscord<odexine> i am not using devel
16:35:42FromDiscord<graveflo> nah I doubt its back ported
16:35:45FromDiscord<odexine> good to know its there for 2 though
16:35:54FromDiscord<odexine> such a strange omission
16:36:10FromDiscord<graveflo> eh well. it happens ig
17:02:22*jmd_ joined #nim
17:17:28*oprypin quit (Remote host closed the connection)
17:42:13*hohlerde quit (Quit: Connection closed for inactivity)
17:53:57*rockcavera joined #nim
17:56:37*jmd_ quit (Ping timeout: 245 seconds)
18:02:42FromDiscord<nixfreak> is is possible to get the actual IP header and ethernet header using std/net ? I want to parse the actual packet header information.
18:09:36*jmd_ joined #nim
18:13:01*ntat quit (Quit: Leaving)
18:14:30FromDiscord<graveflo> os usually handles that. Prob cant do that with the std lib
18:15:13Amun-Rait should be doable with raw sockets
18:16:04FromDiscord<nixfreak> so can I use nativesockets ?
18:31:10*jmd_ quit (Ping timeout: 252 seconds)
18:34:38*oddish_ joined #nim
18:42:10*oddish quit (*.net *.split)
18:44:01*jmd_ joined #nim
18:47:05*oprypin joined #nim
18:47:55*jmd_ quit (Remote host closed the connection)
18:48:15*jmd_ joined #nim
18:54:46FromDiscord<nnsee> In reply to @nixfreak "so can I use": yes
18:54:54FromDiscord<nnsee> i've done exactly this
18:55:45FromDiscord<nnsee> I've also taken it a step further and incorporated an ebpf filter in my program in order to do it "passively"
18:59:52FromDiscord<nixfreak> nice , do you have an example of this?
19:04:46FromDiscord<nnsee> http://ix.io/4Awd
19:04:52FromDiscord<nnsee> ignore the very ugly code
19:05:30FromDiscord<nnsee> this captures icmpv6 packets depending on the type
19:05:44FromDiscord<nnsee> you will have to adapt your bpf program accordingly
19:06:48FromDiscord<nnsee> I crafted mine manually, but tcpdump is excellent for compiling bpf programs from a more human-readable syntax
19:08:20FromDiscord<nixfreak> how did you connect ebpf to your nim program?
19:09:28FromDiscord<nnsee> it's all in the code I sent, once you've attached the filter, you can start .recv()-ing on it
19:10:19FromDiscord<nnsee> there's certainly more elegant ways you can do it, depending on what your use case is, but in my case I just wanted all ICMPv6 packets of certain types
19:10:23FromDiscord<nnsee> fits my use case
19:13:31FromDiscord<nixfreak> Ok, so I'm looking for a way to get better information for banner grabbing from a remote IP. My thinking is to recv IP header and Ethernet Header to grab the information. I know very little of ebpf , so I need to do some research on this. Could ebpf work in my case ? Building security tools and scanners
19:29:33FromDiscord<yandall> Is there an easy way to replace special characters in a string so it is SEO freindly? Eg: "Jägermeister" -> "Jagermeister"
19:30:33FromDiscord<nixfreak> Can't strutils do that ?
19:31:02FromDiscord<yandall> Didn't find any proc for that
19:31:15FromDiscord<yandall> Maybe `normalize`? haven't tested it yet
19:31:30FromDiscord<nixfreak> https://nim-lang.github.io/Nim/unicode.html#%24%2CRune
19:32:37FromDiscord<nixfreak> https://nim-lang.github.io/Nim/unidecode.html
19:32:53FromDiscord<nixfreak> proc unidecode(s\: string)\: string {.raises\: [], tags\: [], forbids\: [].}
19:33:06FromDiscord<yandall> In reply to @nixfreak "https://nim-lang.github.io/Nim/unicode.html#%24%2CR": This is exactly what I was looking for. Thank you
19:34:15FromDiscord<nixfreak> nice ... `nim> import unidecode nim> var x = unidecode("Jägermeister") nim> echo x Jagermeister`
19:35:51FromDiscord<spotlightkid> If you want to create URL slugs, you usually make the string lowercase too and replace all non-alphanumric ascii chars with a hyphen.
19:37:08FromDiscord<yandall> Yeah, was going to use `replace()` and `toLowerAscii()` for that
19:58:43*jmd_ quit (Ping timeout: 250 seconds)
20:10:41*jmdaemon joined #nim
20:27:30FromDiscord<_alkamist_> Does anyone have any insight into how text rendering is usually done in production apps? I've been experimenting for a while and I have no idea how something like VS Code can handle millions of wordwrapped characters at a high framerate.
20:28:08FromDiscord<Elegantbeef> Font atlassing
20:28:45FromDiscord<_alkamist_> Is that how it's usually done? Like every glyph is in an atlas and every letter is a quad?
20:29:30FromDiscord<Elegantbeef> That's one way of doing high speed rendering
20:29:30FromDiscord<_alkamist_> That's how I am doing it right now and it is definitely fast.
20:29:39FromDiscord<Elegantbeef> It's then just a case of uploading rects and their uvs
20:31:29*azimut quit (Remote host closed the connection)
20:31:36FromDiscord<_alkamist_> I am using Nanovg at the moment and that is essentially how it handles it I believe. I was thinking of trying to use Boxy but it seems way too slow to try to render images of text and draw them.
20:31:57*azimut joined #nim
20:32:25FromDiscord<Elegantbeef> I mean I use pixie and my own atlaser for my font rendering in my gui
20:33:20FromDiscord<_alkamist_> Well I'm sure it can be used to create an atlas that you then draw quads from, I just mean I was trying to literally render the end result to a quad itself and display it.
20:33:44FromDiscord<Elegantbeef> Why would you render it to a quad?
20:34:00FromDiscord<Elegantbeef> Upload all your rectangles with their texture index
20:35:13FromDiscord<_alkamist_> So like make a texture index for every single possible glyph?
20:36:07FromDiscord<Elegantbeef> not every single possible glyph
20:36:07FromDiscord<Elegantbeef> The atlas only has glyphs you've used
20:37:00FromDiscord<spotlightkid> sent a code paste, see https://paste.rs/cqXLj
20:38:48FromDiscord<_alkamist_> In reply to @Elegantbeef "The atlas only has": I guess then I would need to work out how to deal with positioning and dealing with kerning and stuff on my own which currently I haven't dealt with at all, since Nanovg does it for me.
20:39:08FromDiscord<Elegantbeef> https://github.com/beef331/truss3d/blob/master/src/truss3D/fontatlaser.nim
20:39:12FromDiscord<Elegantbeef> Pixie does kerning
20:39:17FromDiscord<Elegantbeef> Pixie does positioning aswell 😄
20:40:04FromDiscord<_alkamist_> But only if you are drawing an image right? If you make your own font atlas arent you responsible for positioning everything on your own?
20:40:48FromDiscord<Elegantbeef> Pixie allows you to query the positioning of rectangels
20:42:01FromDiscord<Elegantbeef> https://github.com/beef331/truss3d/blob/master/src/truss3D/gui.nim#L155-L167
20:42:44FromDiscord<Elegantbeef> That gives me layout of characters
20:42:59FromDiscord<Elegantbeef> It's then as simple as https://github.com/beef331/truss3d/blob/master/src/truss3D/gui.nim#L181-L193
20:43:13FromDiscord<_alkamist_> Hmmm, I might need to look into it. Although I am still not sure how to accomplish drawing other things in the gui. Nanovg works sort of like Dear Imguis draw list, where geometry is actually vectorized instead of rasterized.
20:43:42FromDiscord<Elegantbeef> I mean my text renders as a single draw call
20:43:52FromDiscord<Elegantbeef> Aside from the atlas teture it's purely vector
20:44:14FromDiscord<_alkamist_> But what about non-text things? Like rounded rects and lines and polygons
20:44:40FromDiscord<Elegantbeef> I don't have any thing but rects and text presently, but I'd make those likely single drawcall aswell
20:44:47FromDiscord<Elegantbeef> Using shaders for making rounded rects
20:45:29FromDiscord<_alkamist_> That's why I'm kind of stuck on Nanovg, since there is this barrier between gpu accelerated and not.
20:46:02FromDiscord<spotlightkid> sent a code paste, see https://play.nim-lang.org/#ix=4Awy
20:46:27FromDiscord<Elegantbeef> I was going to show my render pipeline but I forgot my entire gui rendered in a single call 😄
20:47:48FromDiscord<Elegantbeef> Some perspective issue
20:47:49FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1129152221733474414/image.png
20:47:49FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1129152224329744384/image.png
20:48:18FromDiscord<Elegantbeef> I do not have textures on rects yet, but each quad has a `index` which points to a specific letter I calculate the UVs for
20:48:40FromDiscord<Elegantbeef> https://github.com/beef331/truss3d/blob/master/src/truss3D/gui.nim#L36-L63 which is here if you want to see the shader
20:52:17FromDiscord<Elegantbeef> No clue if this is helpful or just spam
20:53:02FromDiscord<_alkamist_> Seems like there's a lot of cool stuff in there. I'll have to dig through it. 👀
20:54:33FromDiscord<_alkamist_> Can I get your opinion on my Gui library? I think it might work on linux now, not 100% sure.
21:02:37FromDiscord<Elegantbeef> I mean it's not stateful iirc, so it r bad ;D
21:02:47FromDiscord<Elegantbeef> What's the link to it again?
21:03:54FromDiscord<_alkamist_> In reply to @Elegantbeef "I mean it's not": It's changed a bit since before. I'm not sure what it is at this point but I did a readme so hopefully it explains my thoughts well https://github.com/Alkamist/nimgui
21:12:18FromDiscord<Elegantbeef> Is this a general purpose gui?
21:16:24FromDiscord<_alkamist_> Yeah that's the ultimate goal
21:16:53FromDiscord<Elegantbeef> I don't know if this is just cause I havent dragged a window since 2003, but the window dragging feels off
21:17:08om3gaalkamist, can it work in macos?
21:17:15FromDiscord<_alkamist_> In reply to @Elegantbeef "I don't know if": It's actually running though?
21:17:24FromDiscord<Elegantbeef> Yea it's running
21:17:41FromDiscord<_alkamist_> In reply to @om3ga "alkamist, can it work": I think it should, I'm using staticglfw for backends other than windows and emscripten. I haven't tested though
21:17:57FromDiscord<Elegantbeef> Ah I see the issue the window is lagging behind
21:17:57FromDiscord<Elegantbeef> I had to change the font to iosevka though
21:18:00FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1129159818754662540/image.png
21:18:04om3gawow, nice!
21:18:09FromDiscord<Elegantbeef> Works fine aside from having to modify that `readFile`
21:18:37om3gaI'll try it now
21:19:09FromDiscord<_alkamist_> Awesome, glad it is working properly with no testing haha. Yeah it lags behind slightly, not sure if there's a way to fix that, it's the same with Dear Imgui.
21:19:49FromDiscord<_alkamist_> Also hold Ctrl for low sensitivity sliders
21:20:08FromDiscord<_alkamist_> It's a thing in audio plugins that no one ever does anywhere else and I have no idea why
21:20:26om3ga Error: cannot open file: staticglfw
21:20:47FromDiscord<_alkamist_> Yeah you'll have to `nimble install staticglfw` i think
21:20:55FromDiscord<_alkamist_> I should probably put that in the readme
21:21:06FromDiscord<Elegantbeef> Well the reason they don't do it like you is you do not hide the cursor
21:21:07om3gaok, one min
21:21:08FromDiscord<Elegantbeef> You should hide the cursor if you enter precision mode
21:21:26FromDiscord<Elegantbeef> Actually your slides suck cause you have to click the handle
21:21:26FromDiscord<Elegantbeef> Cmon! 😛
21:21:40FromDiscord<_alkamist_> I might do that at some point, although that's not possible in the browser
21:21:59FromDiscord<Elegantbeef> It's possible to hide a cursor
21:22:05FromDiscord<_alkamist_> In the browser?
21:22:10FromDiscord<Elegantbeef> Yea
21:22:32FromDiscord<_alkamist_> Oh wait, it was that you can't set the cursor's position
21:22:37FromDiscord<Elegantbeef> Just add `cursor:none` to the html element
21:22:49FromDiscord<_alkamist_> The ideal behavior is to hide the cursor and keep it on top of the handle
21:22:55FromDiscord<_alkamist_> so it's there when you let go
21:23:00FromDiscord<_alkamist_> But I can't do that in the browser
21:23:03FromDiscord<Elegantbeef> Right
21:23:14FromDiscord<Elegantbeef> Well only hide it when you enter precision
21:23:17FromDiscord<_alkamist_> But I could conditionally do it based on what platform you are on i guess
21:23:51FromDiscord<Elegantbeef> I guess that depends on if you want infinite slide or not
21:23:54FromDiscord<Elegantbeef> I personally prefer seeing my cursor on sliders
21:24:36FromDiscord<_alkamist_> I'm modelling the behavior off of what I'm used to in audio plugins I suppose
21:24:46FromDiscord<_alkamist_> But yeah I might take a shot at hiding the cursor and stuff
21:25:27om3gaalkamist, segfaults unfortunately, ERROR: 0:1: '' : version '150' is not supported
21:25:49om3gaShader shader/vert error:
21:26:15FromDiscord<_alkamist_> Hmm, maybe an opengl thing with nanovg? I am not sure. I don't have a macos system to test on unfortunately.
21:26:53om3gayeah, I understand
21:27:09FromDiscord<_alkamist_> I do eventually want it to work on mac os though
21:28:23FromDiscord<Elegantbeef> I do appreciate that you've got no dynamic typing yet 😄
21:28:24om3gapm me if you need tests or smth
21:28:43FromDiscord<Elegantbeef> The irc user telling the discord user to pm them
21:28:45FromDiscord<Elegantbeef> Interesting 😄
21:29:32FromDiscord<_alkamist_> In reply to @om3ga "pm me if you": I appreciate it! Will do, although I am stumped at the moment on what the issue might be.
21:29:56FromDiscord<_alkamist_> In reply to @Elegantbeef "I do appreciate that": I've tried all sorts of cursed things, believe me
21:30:00om3gahaha, yeah.. I not use discord
21:35:58*cedb quit (Ping timeout: 252 seconds)
22:04:02FromDiscord<yandall> sent a code paste, see https://play.nim-lang.org/#ix=4AwR
22:08:35FromDiscord<spotlightkid> Yes\: `" $ Español-" -> "espanol" (expected: "espanol")`
22:46:27NimEventerNew post on r/nim by Artistic_Speech_1965: Execute code before and after test with testament, see https://reddit.com/r/nim/comments/14yyz3y/execute_code_before_and_after_test_with_testament/
22:54:55*jmdaemon quit (Ping timeout: 240 seconds)
23:44:55*jmd_ joined #nim