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

2020-03-15 Thread bauss via Digitalmars-d-learn
On Monday, 16 March 2020 at 02:52:56 UTC, Mike Parker wrote: On Sunday, 15 March 2020 at 18:14:44 UTC, bauss wrote: I would recommend using Derelict and SDL with D since it's the most mature. Please don't recommend Derelict to anyone :-) bindbc-sdl is what folks should be using now. I'm

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

2020-03-15 Thread Mike Parker via Digitalmars-d-learn
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 OpenGL/Vulkan/Directx, along with handling input/events. There's no

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

2020-03-15 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 15 March 2020 at 18:14:44 UTC, bauss wrote: I would recommend using Derelict and SDL with D since it's the most mature. Please don't recommend Derelict to anyone :-) bindbc-sdl is what folks should be using now. I'm not maintaining Derelict anymore.

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

2020-03-15 Thread dwdv via Digitalmars-d-learn
On 2020-03-15 18:58, Steven Schveighoffer via Digitalmars-d-learn wrote: I'd prefer to do it with D. How about raylib in conjunction with thin d bindings? I prefer it over sdl, sfml and the like. https://www.raylib.com/examples.html (make sure to enable js for embedded examples)

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

2020-03-15 Thread Sebastiaan Koppe 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. No resources but I remember the serpent framework mentioned on this forum here recently. It looks pretty decent.

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

2020-03-15 Thread Arine via Digitalmars-d-learn
On Sunday, 15 March 2020 at 21:27:32 UTC, Ferhat Kurtulmuş wrote: On Sunday, 15 March 2020 at 21:16:43 UTC, Arine wrote: On Sunday, 15 March 2020 at 20:53:49 UTC, Ferhat Kurtulmuş I wouldn't use a class on the D side, unless your C++ type uses virtual functions. Classes in D are different

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

2020-03-15 Thread Basile B. via Digitalmars-d-learn
On Sunday, 15 March 2020 at 20:18:03 UTC, James Blachly wrote: I would like to programmatically retrieve members of a subclass to create a self-documenting interface. I am afraid that my approach is not possible due to need for compile time __traits / std.traits, and runtime typeinfo. My

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

2020-03-15 Thread Arine via Digitalmars-d-learn
On Sunday, 15 March 2020 at 20:19:17 UTC, Steven Schveighoffer wrote: On 3/15/20 4:12 PM, Jordan Wilson 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

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

2020-03-15 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Sunday, 15 March 2020 at 21:16:43 UTC, Arine wrote: On Sunday, 15 March 2020 at 20:53:49 UTC, Ferhat Kurtulmuş I wouldn't use a class on the D side, unless your C++ type uses virtual functions. Classes in D are different from structs, it is not the same as C++ where they are basically the

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

2020-03-15 Thread Simen Kjærås via Digitalmars-d-learn
On Sunday, 15 March 2020 at 20:18:03 UTC, James Blachly wrote: I would like to programmatically retrieve members of a subclass to create a self-documenting interface. I am afraid that my approach is not possible due to need for compile time __traits / std.traits, and runtime typeinfo. My

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

2020-03-15 Thread Arine via Digitalmars-d-learn
On Sunday, 15 March 2020 at 20:53:49 UTC, Ferhat Kurtulmuş wrote: On Sunday, 15 March 2020 at 20:46:14 UTC, drug wrote: 15.03.2020 23:25, Ferhat Kurtulmuş пишет: On Sunday, 15 March 2020 at 20:21:57 UTC, drug wrote: 15.03.2020 22:39, Ferhat Kurtulmuş пишет: What is the D version of

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

2020-03-15 Thread drug via Digitalmars-d-learn
15.03.2020 23:53, Ferhat Kurtulmuş пишет: I doubt it because in https://dlang.org/spec/cpp_interface.html#using_cpp_classes_from_d cpp code: Derived *createInstance(int i) d code: extern (C++){     ...     Derived createInstance(int i); } Ah, really, you use classes on D side.

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

2020-03-15 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Sunday, 15 March 2020 at 20:46:14 UTC, drug wrote: 15.03.2020 23:25, Ferhat Kurtulmuş пишет: On Sunday, 15 March 2020 at 20:21:57 UTC, drug wrote: 15.03.2020 22:39, Ferhat Kurtulmuş пишет: What is the D version of `createSizeIntWH`? In C++ it returns a pointer but in D version it

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

2020-03-15 Thread drug via Digitalmars-d-learn
15.03.2020 23:25, Ferhat Kurtulmuş пишет: On Sunday, 15 March 2020 at 20:21:57 UTC, drug wrote: 15.03.2020 22:39, Ferhat Kurtulmuş пишет: What is the D version of `createSizeIntWH`? In C++ it returns a pointer but in D version it returns an instance. extern(C++){     cv.Size_!int

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

2020-03-15 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Sunday, 15 March 2020 at 20:21:57 UTC, drug wrote: 15.03.2020 22:39, Ferhat Kurtulmuş пишет: What is the D version of `createSizeIntWH`? In C++ it returns a pointer but in D version it returns an instance. extern(C++){ cv.Size_!int createSizeInt(); cv.Size_!int

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

2020-03-15 Thread drug via Digitalmars-d-learn
15.03.2020 22:39, Ferhat Kurtulmuş пишет: The original C++ class https://github.com/opencv/opencv/blob/master/modules/core/include/opencv2/core/types.hpp#L315: template class Size_ { public:     typedef _Tp value_type;     //! default constructor     Size_();     Size_(_Tp _width, _Tp

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

2020-03-15 Thread James Blachly via Digitalmars-d-learn
I would like to programmatically retrieve members of a subclass to create a self-documenting interface. I am afraid that my approach is not possible due to need for compile time __traits / std.traits, and runtime typeinfo. My proposed approach is as follows: class Base { string whatever;

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

2020-03-15 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/15/20 4:12 PM, Jordan Wilson 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

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

2020-03-15 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/15/20 3:03 PM, Ferhat Kurtulmuş wrote: On Sunday, 15 March 2020 at 19:02:11 UTC, Ferhat Kurtulmuş wrote: On Sunday, 15 March 2020 at 18:45:14 UTC, Steven Schveighoffer wrote: [...] I refer this ugly site a lot for basics of SDL. Since one could easily convert c code to d, transition is

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

2020-03-15 Thread Jordan Wilson 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: Integer without restrictions

2020-03-15 Thread Dennis via Digitalmars-d-learn
On Sunday, 15 March 2020 at 19:07:05 UTC, ... wrote: And if I need to create very large value, how to use GMP library (It isn't described in that post)? You can use C bindings [1], look up examples in C and do the same in D, or use a high-level wrapper [2]. [1]

What is the wrong with my C++ interfacing

2020-03-15 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
The original C++ class https://github.com/opencv/opencv/blob/master/modules/core/include/opencv2/core/types.hpp#L315: template class Size_ { public: typedef _Tp value_type; //! default constructor Size_(); Size_(_Tp _width, _Tp _height); Size_(const Size_& sz);

Re: Integer without restrictions

2020-03-15 Thread ... via Digitalmars-d-learn
On Sunday, 15 March 2020 at 19:03:54 UTC, Paul Backus wrote: On Sunday, 15 March 2020 at 19:02:00 UTC, ... wrote: How to create an integer without restrictions of size? Do I need to create a new class or there is a type of integer that doesn't have any restrictions in size?

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

2020-03-15 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Sunday, 15 March 2020 at 19:02:11 UTC, Ferhat Kurtulmuş wrote: On Sunday, 15 March 2020 at 18:45:14 UTC, Steven Schveighoffer wrote: [...] I refer this ugly site a lot for basics of SDL. Since one could easily convert c code to d, transition is very fast. My favorite 2d game engine is

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

2020-03-15 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Sunday, 15 March 2020 at 18:45:14 UTC, Steven Schveighoffer wrote: On 3/15/20 2:14 PM, bauss wrote: [...] [snip] [...] Thanks, I'm pretty much starting from zero as I have very little experience in what is necessary to actually do the drawing parts, or how to store/manipulate sprites

Integer without restrictions

2020-03-15 Thread ... via Digitalmars-d-learn
How to create an integer without restrictions of size? Do I need to create a new class or there is a type of integer that doesn't have any restrictions in size?

Re: Integer without restrictions

2020-03-15 Thread Paul Backus via Digitalmars-d-learn
On Sunday, 15 March 2020 at 19:02:00 UTC, ... wrote: How to create an integer without restrictions of size? Do I need to create a new class or there is a type of integer that doesn't have any restrictions in size? http://dpldocs.info/experimental-docs/std.bigint.html

Re: Pattern matching via switch?

2020-03-15 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/15/20 2:22 PM, 12345swordy wrote: On Sunday, 15 March 2020 at 17:55:59 UTC, Steven Schveighoffer wrote: On 3/14/20 3:04 PM, 12345swordy wrote: I.E. switch (object) case Type1 t1: case Type2 t2: case Type3 t3: Is this a class object and you are trying to determine at

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

2020-03-15 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/15/20 2:14 PM, bauss 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 D for

Re: Pattern matching via switch?

2020-03-15 Thread 12345swordy via Digitalmars-d-learn
On Sunday, 15 March 2020 at 17:55:59 UTC, Steven Schveighoffer wrote: On 3/14/20 3:04 PM, 12345swordy wrote: I.E. switch (object)     case Type1 t1:     case Type2 t2:     case Type3 t3: Is this a class object and you are trying to determine at runtime which derived type it is and

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

2020-03-15 Thread bauss 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-15 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/14/20 3:04 PM, 12345swordy wrote: I.E. switch (object)     case Type1 t1:     case Type2 t2:     case Type3 t3: Is this a class object and you are trying to determine at runtime which derived type it is and perform an action based on that? Or are you trying to switch on the type of

Best way to learn 2d games with D?

2020-03-15 Thread Steven Schveighoffer via Digitalmars-d-learn
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 then migrate to D later? Anyone recommend any

Re: exporting function from betterc to windows dll

2020-03-15 Thread Ahmet Sait via Digitalmars-d-learn
On Saturday, 14 March 2020 at 20:53:45 UTC, Abby wrote: I would like to export some functions from my bettec dll for dotnet core application in windows. You can check my library documentation to understand how to do some fancy interop between C# and D: https://github.com/ahmetsait/IDL/wiki

Re: Does anyone have gdb pretty printers for buildin types like associative arrays?

2020-03-15 Thread Dennis via Digitalmars-d-learn
On Sunday, 15 March 2020 at 16:42:52 UTC, Panke wrote: Should this just work and by box is not correctly configured or do I need some pretty printers? If so, has someone already made them? Take a look at: https://forum.dlang.org/post/ztyhmmxalpiysgjkv...@forum.dlang.org

Re: Is it possible to dynamically load a @safe function from a shared library ?

2020-03-15 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/13/20 5:06 PM, H. S. Teoh wrote: On Fri, Mar 13, 2020 at 04:31:16PM -0400, Steven Schveighoffer via Digitalmars-d-learn wrote: [...] I would expect that something could be written to turn a signature string into a mangling and also provide the correct type upon return. Something like:

Re: Is it possible to dynamically load a @safe function from a shared library ?

2020-03-15 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/14/20 6:06 AM, wjoe wrote: On Friday, 13 March 2020 at 20:31:16 UTC, Steven Schveighoffer wrote: On 3/13/20 4:22 PM, wjoe wrote: I would expect that something could be written to turn a signature string into a mangling and also provide the correct type upon return. Something like: auto

Does anyone have gdb pretty printers for buildin types like associative arrays?

2020-03-15 Thread Panke via Digitalmars-d-learn
At least on my installation they are printed as just a pointer. Should this just work and by box is not correctly configured or do I need some pretty printers? If so, has someone already made them?