On Friday, 6 April 2018 at 14:15:08 UTC, Kayomn wrote:
On Friday, 6 April 2018 at 13:55:55 UTC, nkm1 wrote:
[...]
Figured I had a handle on how it worked doing but guess not.
One final question, however.
[...]
Nevermind, I'm blind. I missed the post-increment in newID().
On Friday, 6 April 2018 at 13:55:55 UTC, nkm1 wrote:
On Friday, 6 April 2018 at 13:10:23 UTC, Kayomn wrote:
ID tags are unique and spsecific to the class type. There
shouldn't be more than one type ID assigned to one class type.
The idea behind what it is I am doing is I am implementing a
sol
On Friday, 6 April 2018 at 13:10:23 UTC, Kayomn wrote:
ID tags are unique and spsecific to the class type. There
shouldn't be more than one type ID assigned to one class type.
The idea behind what it is I am doing is I am implementing a
solution to getting a type index, similar to
std.variant
Besides this, I tried something with types used as user defined
attributes.
https://dlang.org/spec/attribute.html#uda
Automatic compile time tagging is not my speciality, however, I
think is also achievable with mixins somehow?
But I don't know how to workaround the bug
https://issues.dlang.
On Friday, 6 April 2018 at 02:20:29 UTC, Kayomn wrote:
Wrong example code, here's the correct example:
switch (queryString(childJson,"type")) {
case (typeof (Sprite).name):
child = this.addCh
On Friday, 6 April 2018 at 02:20:29 UTC, Kayomn wrote:
Wrong example code, here's the correct example:
switch (queryString(childJson,"type")) {
case (typeof (Sprite).name):
child = this.addCh
On Friday, 6 April 2018 at 02:18:28 UTC, Kayomn wrote:
On Friday, 6 April 2018 at 01:22:42 UTC, Kayomn wrote:
On Friday, 6 April 2018 at 01:14:37 UTC, ketmar wrote:
Kayomn wrote:
[...]
it is already done for you, free of charge.
class Node {}
class RootNode : Node {}
On Friday, 6 April 2018 at 01:22:42 UTC, Kayomn wrote:
On Friday, 6 April 2018 at 01:14:37 UTC, ketmar wrote:
Kayomn wrote:
[...]
it is already done for you, free of charge.
class Node {}
class RootNode : Node {}
class SpriteNode : Node {}
void main () {
On Friday, 6 April 2018 at 01:14:37 UTC, ketmar wrote:
Kayomn wrote:
[...]
it is already done for you, free of charge.
class Node {}
class RootNode : Node {}
class SpriteNode : Node {}
void main () {
auto nodeId1 = typeid(Node);
On Friday, April 06, 2018 00:35:39 Kayomn via Digitalmars-d-learn wrote:
> On Friday, 6 April 2018 at 00:21:54 UTC, H. S. Teoh wrote:
> > On Thu, Apr 05, 2018 at 11:53:00PM +, Kayomn via
> > Digitalmars-d-learn wrote: [...]
> >
> >> [...]
> >
> > [...]
> >
> >> [...]
> >
> > `lastID`, as declar
Kayomn wrote:
I'll give a better example of what it is I'm trying to do.
These are node types. Their contents are not important in this
explanation, only that they operate as a tree structure.
class Node;
class RootNode : Node;
class SpriteNode : Node;
The result of getNodeID on a specifi
I'll give a better example of what it is I'm trying to do.
These are node types. Their contents are not important in this
explanation, only that they operate as a tree structure.
class Node;
class RootNode : Node;
class SpriteNode : Node;
The result of getNodeID on a specific type is always
On Friday, 6 April 2018 at 00:21:54 UTC, H. S. Teoh wrote:
On Thu, Apr 05, 2018 at 11:53:00PM +, Kayomn via
Digitalmars-d-learn wrote: [...]
[...]
[...]
[...]
`lastID`, as declared above, are runtime variables. The
'static' in this case just means it's thread-local, rather than
allocat
On Thu, Apr 05, 2018 at 11:53:00PM +, Kayomn via Digitalmars-d-learn wrote:
[...]
> ---
> alias NodeTypeID = uint;
>
> enum NodeTypeID getNodeID() {
> static NodeTypeID lastID = 0;
>
> return lastID++;
> }
Hi,
I've got a scene graph which contains multiple inheriting types.
As such, I've been tagging them with a type enum for whenever I
need to do things such as loading a structure from binary.
Up until now I've been using an enum that looks like this:
-
On Wednesday, 28 March 2018 at 23:42:26 UTC, Simen Kjærås wrote:
On Wednesday, 28 March 2018 at 23:02:53 UTC, Chris Katko wrote:
There's many things that can be done to make the code easier to
follow. These lines:
[...]
[...]
WOW. Thank you. That's the kind of tricks for (or more properly:
On Wednesday, 28 March 2018 at 23:02:53 UTC, Chris Katko wrote:
There's many things that can be done to make the code easier to
follow. These lines:
static if (!hasPosition)
{
assert(0, "Need to pass a position!");
}
Can be replaced with thi
On Wednesday, 28 March 2018 at 17:42:45 UTC, Steven Schveighoffer
wrote:
On 3/28/18 11:46 AM, Chris Katko wrote:
enum hasRotate = anySatisfy!( isa(pos), a); //if of type
"pos"
anySatisfy!(isa!pos, a)
anySatisfy takes a template alias (in this case, an
instantiation of isa with a speci
On Wednesday, 28 March 2018 at 17:08:39 UTC, Chris Katko wrote:
On Wednesday, 28 March 2018 at 15:49:39 UTC, Chris Katko wrote:
On Wednesday, 28 March 2018 at 15:46:42 UTC, Chris Katko wrote:
[...]
Whoops! Wrong error message. That's if I replace isa(pos) with
IsIntegral.
[...]
Okay, the
On 3/28/18 11:46 AM, Chris Katko wrote:
enum hasRotate = anySatisfy!( isa(pos), a); //if of type "pos"
anySatisfy!(isa!pos, a)
anySatisfy takes a template alias (in this case, an instantiation of isa
with a specific type), and then applies the template to all the elements
of the alias
On Wednesday, 28 March 2018 at 15:49:39 UTC, Chris Katko wrote:
On Wednesday, 28 March 2018 at 15:46:42 UTC, Chris Katko wrote:
[...]
Whoops! Wrong error message. That's if I replace isa(pos) with
IsIntegral.
[...]
Okay, the key appears to be here:
funct2(123); //a function call
void fu
clean, elegant solution that simply
passes through each parameter, and then reacts to the
combined result, and end up with something that has to "step
toward" the result, or perhaps, test every possible
permutation individually--so as to not need variables.
D does not have compile-
and then reacts to the combined
result, and end up with something that has to "step toward"
the result, or perhaps, test every possible permutation
individually--so as to not need variables.
D does not have compile-time variables. The way you'd generally
do what you descri
thing that has to "step toward" the result, or
perhaps, test every possible permutation individually--so as to
not need variables.
D does not have compile-time variables. The way you'd generally
do what you describe is with the templates in std.meta. Instead
of something like thi
I have a static foreach that goes through the parameter list and
if it sees a class like "rotate", ideally, I want it to mark a
boolean "has_rotate=true"
Then simply later on, once I've parsed the list, I pick an output
path:
static if(has_rotate && has_position && has_scale)
{
/
25 matches
Mail list logo