Re: Indexed graphics for retro engine?

2019-09-19 Thread Shadowblitz16 via Digitalmars-d-learn
On Friday, 20 September 2019 at 00:41:58 UTC, Adam D. Ruppe wrote: On Thursday, 19 September 2019 at 03:47:05 UTC, Shadowblitz16 wrote: [...] My color.d actually can do it. [...] cool does this store image data as raw byte[]'s? I might have to use this :D

Re: Indexed graphics for retro engine?

2019-09-19 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 19 September 2019 at 03:47:05 UTC, Shadowblitz16 wrote: Is there a way to make a indexed graphics library that can handle importing and exporting true color images? I would guess something like this could be simulated with pointers and references right? My color.d actually can

Re: Indexed graphics for retro engine?

2019-09-19 Thread Shadowblitz16 via Digitalmars-d-learn
On Thursday, 19 September 2019 at 23:32:13 UTC, norm wrote: On Thursday, 19 September 2019 at 20:47:45 UTC, Shadowblitz16 wrote: [...] I'd create a fragment shader to convert each pixel to 8 bit. There are many examples on the web about creating fragment shaders and 2d opengl scenes, i.e. a

Re: String of templated struct at compile time

2019-09-19 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 19 September 2019 at 21:55:57 UTC, divi wrote: You know what, just because I want to watch the world burn gross but hey if it works it works

Re: Indexed graphics for retro engine?

2019-09-19 Thread norm via Digitalmars-d-learn
On Thursday, 19 September 2019 at 20:47:45 UTC, Shadowblitz16 wrote: On Thursday, 19 September 2019 at 19:16:03 UTC, Mike Parker wrote: On Thursday, 19 September 2019 at 18:25:05 UTC, Shadowblitz16 wrote: I wanted to do 4bpp 16 color graphics. and I didn't want to load anything unnecessary

Re: Indexed graphics for retro engine?

2019-09-19 Thread rikki cattermole via Digitalmars-d-learn
On 20/09/2019 8:47 AM, Shadowblitz16 wrote: On Thursday, 19 September 2019 at 19:16:03 UTC, Mike Parker wrote: On Thursday, 19 September 2019 at 18:25:05 UTC, Shadowblitz16 wrote: I wanted to do 4bpp 16 color graphics. and I didn't want to load anything unnecessary in the image like the

Re: Why must a bidirectional range also be a forward range?

2019-09-19 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, September 19, 2019 3:31:32 AM MDT Joseph Rushton Wakeling via Digitalmars-d-learn wrote: > Hello folks, > > A question that occurred to me while implementing a new data > structure recently, which I'm not sure I've ever seen a reason > for. > > Why must bidirectional ranges also be

Re: String of templated struct at compile time

2019-09-19 Thread divi via Digitalmars-d-learn
You know what, just because I want to watch the world burn I did the horrible hacky way. mixin template Magic() { import std.array : split; static if (is(typeof(this) == T!(A), alias T, A...)) { mixin(`alias Other = ` ~ T.stringof.split('(')[0] ~ `!(K.B);`); } else { static

Re: String of templated struct at compile time

2019-09-19 Thread divi via Digitalmars-d-learn
On Thursday, 19 September 2019 at 20:16:49 UTC, Adam D. Ruppe wrote: The reason for this is kinda crazy: the token `S` inside that struct (and thus inside its template mixin) refers to the *current instantiation*. Which includes the conflicting constraint. I didn't know that, and it explains

Re: The biggest issue in Dlang

2019-09-19 Thread Daniel Kozak via Digitalmars-d-learn
On Thursday, 19 September 2019 at 20:50:30 UTC, Daniel Kozak wrote: auto main() { return int(0); } for some reasons does not work WOW :-D this works ok: void main() { return other(); } auto other() { return; } so I believe even this should work: auto main() { return; } I

The biggest issue in Dlang

2019-09-19 Thread Daniel Kozak via Digitalmars-d-learn
auto main() { return int(0); } for some reasons does not work WOW :-D this works ok: void main() { return other(); } auto other() { return; } so I believe even this should work: auto main() { return; }

Re: Indexed graphics for retro engine?

2019-09-19 Thread Shadowblitz16 via Digitalmars-d-learn
On Thursday, 19 September 2019 at 19:16:03 UTC, Mike Parker wrote: On Thursday, 19 September 2019 at 18:25:05 UTC, Shadowblitz16 wrote: I wanted to do 4bpp 16 color graphics. and I didn't want to load anything unnecessary in the image like the palette but instead supply it myself as a

Re: combining libraries into 1 or 1 for each system?

2019-09-19 Thread Shadowblitz16 via Digitalmars-d-learn
On Thursday, 19 September 2019 at 19:10:26 UTC, Mike Parker wrote: On Thursday, 19 September 2019 at 18:28:25 UTC, Shadowblitz16 wrote: I mean I don't want to have multiple dependency dll's but instead just my own dll with the dependencies packed inside. of course dll is only for windows so

Re: String of templated struct at compile time

2019-09-19 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 19 September 2019 at 19:49:02 UTC, divi wrote: Due to prior design choices, I have the following setup: enum K { A, B } mixin template Magic() { mixin(`alias Other = ` ~ magic() ~ `!(K.B);`); } Just how constrained are you? I'd be inclined to completely remove the magic()

String of templated struct at compile time

2019-09-19 Thread divi via Digitalmars-d-learn
Due to prior design choices, I have the following setup: enum K { A, B } mixin template Magic() { mixin(`alias Other = ` ~ magic() ~ `!(K.B);`); } struct S(K k) if (k == K.B) {} struct S(K k) if (k == K.A) { mixin Magic; // magic() returns "S" } struct T(K k) if (k == K.B) {} struct T(K

Re: Indexed graphics for retro engine?

2019-09-19 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 19 September 2019 at 18:25:05 UTC, Shadowblitz16 wrote: I wanted to do 4bpp 16 color graphics. and I didn't want to load anything unnecessary in the image like the palette but instead supply it myself as a Color[16]; I see. In that case, I suggest you find some tutorials on

Re: combining libraries into 1 or 1 for each system?

2019-09-19 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 19 September 2019 at 18:28:25 UTC, Shadowblitz16 wrote: I mean I don't want to have multiple dependency dll's but instead just my own dll with the dependencies packed inside. of course dll is only for windows so I would like this done for mac and linux too Then statically

Re: combining libraries into 1 or 1 for each system?

2019-09-19 Thread Shadowblitz16 via Digitalmars-d-learn
On Thursday, 19 September 2019 at 05:16:33 UTC, Mike Parker wrote: On Thursday, 19 September 2019 at 03:44:28 UTC, Shadowblitz16 wrote: let's say I have a project the relies on multiple packages.. is it possible to combine these libraries into a single one (or 1 per os) for final shipment of a

Re: Indexed graphics for retro engine?

2019-09-19 Thread Shadowblitz16 via Digitalmars-d-learn
On Thursday, 19 September 2019 at 05:22:37 UTC, Mike Parker wrote: On Thursday, 19 September 2019 at 03:47:05 UTC, Shadowblitz16 wrote: Is there a way to make a indexed graphics library that can handle importing and exporting true color images? I don't see why not. I would guess something

Re: Why must a bidirectional range also be a forward range?

2019-09-19 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 19 September 2019 at 09:31:32 UTC, Joseph Rushton Wakeling wrote: For context, the use-case I have is a data structure which stores an internal buffer as an array. A robust `save` method would therefore have to duplicate the array (or at least the active subset of its contents).

Re: Problem with using std.math: abs and std.complex: abs at the same time

2019-09-19 Thread berni via Digitalmars-d-learn
On Thursday, 19 September 2019 at 11:16:12 UTC, Simen Kjærås wrote: Might I ask what specifically you're working on? Of course. It's about issue 15881 (and 15763), namely approxEqual not always doing, what people think it should do. (As a side note: I stumbled over this, when I wanted to

Re: Problem with using std.math: abs and std.complex: abs at the same time

2019-09-19 Thread Simen Kjærås via Digitalmars-d-learn
On Thursday, 19 September 2019 at 10:25:01 UTC, berni wrote: On Thursday, 19 September 2019 at 07:26:17 UTC, Simen Kjærås wrote: That does indeed fail to compile, and there's no easy way to introduce the module-level abs() function to the scope. Again though, MergeOverloads to the rescue:

Re: Problem with using std.math: abs and std.complex: abs at the same time

2019-09-19 Thread berni via Digitalmars-d-learn
On Thursday, 19 September 2019 at 07:26:17 UTC, Simen Kjærås wrote: That does indeed fail to compile, and there's no easy way to introduce the module-level abs() function to the scope. Again though, MergeOverloads to the rescue: I'm not sure, if MergeOverloads will be accepted into

Why must a bidirectional range also be a forward range?

2019-09-19 Thread Joseph Rushton Wakeling via Digitalmars-d-learn
Hello folks, A question that occurred to me while implementing a new data structure recently, which I'm not sure I've ever seen a reason for. Why must bidirectional ranges also be forward ranges (as opposed to just input ranges)? It doesn't seem to me that the `save` property is

Re: Problem with using std.math: abs and std.complex: abs at the same time

2019-09-19 Thread Simen Kjærås via Digitalmars-d-learn
On Wednesday, 18 September 2019 at 13:24:05 UTC, berni wrote: On Wednesday, 18 September 2019 at 12:37:28 UTC, Simen Kjærås wrote: How to resolve this, though? The simplest solution is to not use selective imports: import std.math; import std.complex;