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

2020-03-16 Thread Denis Feklushkin via Digitalmars-d-learn
On Tuesday, 17 March 2020 at 04:17:41 UTC, Denis Feklushkin wrote: Years ago I wrote this unfinished 2D platformer engine on D: https://github.com/denizzzka/Platformer It ises SFML (graphics and sound), Spine (animation engine) and dchip (2d physics engine) Physics engine used only for

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

2020-03-16 Thread Denis Feklushkin via Digitalmars-d-learn
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 D for learning? Should I just start

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

2020-03-16 Thread aberba via Digitalmars-d-learn
On Tuesday, 17 March 2020 at 03:13:02 UTC, aberba 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

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

2020-03-16 Thread aberba via Digitalmars-d-learn
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 D for learning? Should I just start

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

2020-03-16 Thread aberba via Digitalmars-d-learn
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 D for learning? Should I just start

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

2020-03-16 Thread aberba via Digitalmars-d-learn
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 D for learning? Should I just start

Re: Pattern matching via switch?

2020-03-16 Thread DanielG via Digitalmars-d-learn
I've been playing around with this via inheritance lately (I'm aware of the sumtype package but specifically wanted to use objects instead of structs), had some good results. It involves a bit of boilerplate though. I'm essentially using the visitor pattern + an anonymous class implementing a

Re: How to import C/C++ module from D?

2020-03-16 Thread Andre Pany via Digitalmars-d-learn
On Monday, 16 March 2020 at 19:26:29 UTC, Quantium wrote: If it is possible to import C/C++ , module or C/C++ Header from D, how to do it? See example here https://github.com/atilaneves/dpp/files/4158227/dpp.zip Kind regards Andre

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

2020-03-16 Thread Murilo via Digitalmars-d-learn
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 D for learning? Should I just start

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

2020-03-16 Thread Arine via Digitalmars-d-learn
On Monday, 16 March 2020 at 16:42:56 UTC, Mike Parker wrote: On Monday, 16 March 2020 at 16:19:26 UTC, Arine wrote: There's no need for someone learning 2D games to even bother with SDL2 to begin with. If you use SDL2 you are going to be using something no one else uses, you'll be wasting

How to import C/C++ module from D?

2020-03-16 Thread Quantium via Digitalmars-d-learn
If it is possible to import C/C++ , module or C/C++ Header from D, how to do it?

Re: need help to get member function const address

2020-03-16 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/14/20 5:06 AM, 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 function address: =

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

2020-03-16 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/15/20 1:58 PM, 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 D for learning? Should I just start with another language and

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

2020-03-16 Thread Mike Parker via Digitalmars-d-learn
On Monday, 16 March 2020 at 16:19:26 UTC, Arine wrote: There's no need for someone learning 2D games to even bother with SDL2 to begin with. If you use SDL2 you are going to be using something no one else uses, you'll be wasting your by using something that isn't that good and what you learn

Re: How does one read file line by line / upto a specific delimeter of an MmFile?

2020-03-16 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Mar 16, 2020 at 01:09:08PM +, Adnan via Digitalmars-d-learn wrote: [...] > Would it be wasteful to cast the entire content into a const string? Why would it be? It's just reinterpreting a pointer. > Can a memory mapped file be read with a buffer? That totally defeats the purpose

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

2020-03-16 Thread Arine via Digitalmars-d-learn
On Monday, 16 March 2020 at 03:03:15 UTC, Mike Parker wrote: On Sunday, 15 March 2020 at 21:33:29 UTC, Arine wrote: I wouldn't use SDL2 for rendering. It is really just there for legacy. The only thing people use SDL2 is for setting up a window and creating a render context for

Re: Get symbols (and/or UDAs) of subclass from superclass

2020-03-16 Thread James Blachly via Digitalmars-d-learn
On 3/15/20 5:28 PM, Simen Kjærås wrote: ... Since toStringImpl will always call toStringBase, this could perhaps better be modeled with a template mixin: mixin template DerivedToString() {     override string toStringImpl() {     return this.toStringBase();     } } class Derived2 :

Re: How does one read file line by line / upto a specific delimeter of an MmFile?

2020-03-16 Thread Patrick Schluter via Digitalmars-d-learn
On Monday, 16 March 2020 at 13:09:08 UTC, Adnan wrote: On Sunday, 15 March 2020 at 00:37:35 UTC, H. S. Teoh wrote: On Sat, Mar 14, 2020 at 10:37:37PM +, Adnan via Digitalmars-d-learn wrote: [...] That's because a memory-mapped file appears directly in your program's memory address space

Re: How does one read file line by line / upto a specific delimeter of an MmFile?

2020-03-16 Thread Adnan via Digitalmars-d-learn
On Monday, 16 March 2020 at 13:09:08 UTC, Adnan wrote: On Sunday, 15 March 2020 at 00:37:35 UTC, H. S. Teoh wrote: On Sat, Mar 14, 2020 at 10:37:37PM +, Adnan via Digitalmars-d-learn wrote: https://dlang.org/library/std/mmfile/mm_file.html doesn't seem to specify anything similar to

Re: How does one read file line by line / upto a specific delimeter of an MmFile?

2020-03-16 Thread Adnan via Digitalmars-d-learn
On Sunday, 15 March 2020 at 00:37:35 UTC, H. S. Teoh wrote: On Sat, Mar 14, 2020 at 10:37:37PM +, Adnan via Digitalmars-d-learn wrote: https://dlang.org/library/std/mmfile/mm_file.html doesn't seem to specify anything similar to lines() or byLine() or byLineCopy() etc. That's because a

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

2020-03-16 Thread SashaGreat via Digitalmars-d-learn
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 D for learning? Should I just start

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

2020-03-16 Thread Jacob Carlborg via Digitalmars-d-learn
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 D for learning? Should I just start

Re: What is the wrong with my C++ interfacing

2020-03-16 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Monday, 16 March 2020 at 09:28:15 UTC, drug wrote: On 3/16/20 12:24 PM, Ferhat Kurtulmuş wrote: Ok, here is a solution. I opened my lib (yielded by my auxilary cpp) using 7zip. There are two files containing symbol names, 1.txt and 2.txt. I searched for names of member functions. They

Re: What is the wrong with my C++ interfacing

2020-03-16 Thread drug via Digitalmars-d-learn
On 3/16/20 12:24 PM, Ferhat Kurtulmuş wrote: Ok, here is a solution. I opened my lib (yielded by my auxilary cpp) using 7zip. There are two files containing symbol names, 1.txt and 2.txt. I searched for names of member functions. They were not there because c++ compiler does not compile

Re: What is the wrong with my C++ interfacing

2020-03-16 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Monday, 16 March 2020 at 07:46:00 UTC, drug wrote: On 3/16/20 10:11 AM, Ferhat Kurtulmuş wrote: On Sunday, 15 March 2020 at 22:25:27 UTC, Arine wrote: On Sunday, 15 March 2020 at 21:27:32 UTC, Ferhat Kurtulmuş extern(C++, cv){ extern(C++, class) struct Size_(_Tp){     @disable this();    

Re: What is the wrong with my C++ interfacing

2020-03-16 Thread drug via Digitalmars-d-learn
On 3/16/20 10:11 AM, Ferhat Kurtulmuş wrote: On Sunday, 15 March 2020 at 22:25:27 UTC, Arine wrote: On Sunday, 15 March 2020 at 21:27:32 UTC, Ferhat Kurtulmuş extern(C++, cv){ extern(C++, class) struct Size_(_Tp){     @disable this(); ~this() { }     final _Tp area() const;     final

Re: What is the wrong with my C++ interfacing

2020-03-16 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Sunday, 15 March 2020 at 22:25:27 UTC, Arine wrote: On Sunday, 15 March 2020 at 21:27:32 UTC, Ferhat Kurtulmuş extern(C++, cv){ extern(C++, class) struct Size_(_Tp){ @disable this(); ~this() { } final _Tp area() const; final double aspectRatio() const; final bool

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

2020-03-16 Thread Mike Parker via Digitalmars-d-learn
On Monday, 16 March 2020 at 05:45:52 UTC, bauss wrote: Please don't recommend Derelict to anyone :-) bindbc-sdl is what folks should be using now. I'm not maintaining Derelict anymore. Haven't even heard of that! Does it work in similar fashion? Yes. The loader is @nog and betterC