Re: need help to get member function const address

2020-03-19 Thread Boris Carvajal via Digitalmars-d-learn
On Thursday, 19 March 2020 at 14:43:53 UTC, Steven Schveighoffer wrote: I think this is an invalid limitation, you should file an issue at https://issues.dlang.org essentially, with your sample A struct: const f1 = &A.fn; // OK const f2 = &A.d; // Error, not constant expression Both these sho

Re: Best way to learn 2d games with D?

2020-03-19 Thread Kagamin via Digitalmars-d-learn
On Thursday, 19 March 2020 at 13:10:29 UTC, Steven Schveighoffer wrote: Similar for me but not GameMaker but RPG Maker. I've seen all your work on the language, and this is a pretty good endorsement. Not sure if I'm ready to pay for it though, I want to make sure his motivation/drive is not

Re: @future attribute / @future keyword?

2020-03-19 Thread Mathias Lang via Digitalmars-d-learn
On Wednesday, 18 March 2020 at 14:23:28 UTC, Steven Schveighoffer wrote: Honestly, I think that concept was never fully implemented (or maybe followed properly). Simply because there has not been much complaint about symbols being added "too quickly". 99.99% of the time, you add a symbol to

Re: need help to get member function const address

2020-03-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/19/20 9:40 AM, Calvin P wrote: On Monday, 16 March 2020 at 18:43:47 UTC, Steven Schveighoffer wrote: enum A0 = &A.d; Note that you can't call it at all, but you can get the function pointer, and put it into a delegate later by assigning .funcptr. void main() {     A a;     void delegat

Re: need help to get member function const address

2020-03-19 Thread Calvin P via Digitalmars-d-learn
On Thursday, 19 March 2020 at 13:23:41 UTC, Adam D. Ruppe wrote: Check the error message there... you already have a function pointer, no need to use the .funcptr metod. It is a bit weird though because it actually EXCLUDES the hidden argument for `this`. I prefer doing wrapper functions us

Re: need help to get member function const address

2020-03-19 Thread Calvin P via Digitalmars-d-learn
On Monday, 16 March 2020 at 18:43:47 UTC, Steven Schveighoffer wrote: enum A0 = &A.d; Note that you can't call it at all, but you can get the function pointer, and put it into a delegate later by assigning .funcptr. void main() { A a; void delegate() dg; dg.ptr = &a; dg.func

Re: need help to get member function const address

2020-03-19 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 19 March 2020 at 04:30:32 UTC, Calvin P wrote: my question is, how to get it in compile time like static function address: = struct A { void d(){}; static void fn(){}; } enum FN = &A.fn; // static method address is ok enum A1 = (&__traits(getMember, A,"d")).func

Re: Best way to learn 2d games with D?

2020-03-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/19/20 2:22 AM, dangbinghoo wrote: On Sunday, 15 March 2020 at 17:58:58 UTC, Steven Schveighoffer wrote: I want to try and learn how to write 2d games. I'd prefer to do it with D. I've found a ton of tutorials on learning 2d gaming with other languages. Is there a place to look that uses

Re: Best way to learn 2d games with D?

2020-03-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/18/20 1:37 AM, bauss wrote: On Tuesday, 17 March 2020 at 23:09:32 UTC, Dennis wrote: On Tuesday, 17 March 2020 at 22:47:43 UTC, Sebastiaan Koppe wrote: Dont trust that marketing, there is actually decent scripting in gamemaker, which you'll need if you get creative. Second that. GameMake

Re: need help to get member function const address

2020-03-19 Thread Calvin P via Digitalmars-d-learn
On Thursday, 19 March 2020 at 06:34:40 UTC, Alex wrote: A non-static member method can use the context of the struct where it is defined in. E.g. it could alter a member variable. This context has to be constructed at run time (and there could be many instances of the context) and does not exist

Re: need help to get member function const address

2020-03-19 Thread Boris Carvajal via Digitalmars-d-learn
On Thursday, 19 March 2020 at 04:30:32 UTC, Calvin P wrote: I use this code to get member function address on runtime: = struct A { this(){}; } auto ctor = (&__traits(getMember, A.init,"__ctor")).funcptr; = my question is, how to get it in compile time like static funct

Re: Best way to learn 2d games with D?

2020-03-19 Thread German Diago via Digitalmars-d-learn
My two cents doing some 2D stuff for a while (a cards game). 1. stick to SDL2 if you want to have something that will work in many places. SFML AFAIK is not so compatible. From there, maybe I would start by mixing SDL2* libraries and using D with extern(C) interfaces if needed unless there is