Get difficulties with variadics

evilrat evilrat666 at gmail.com
Sat May 11 06:40:13 PDT 2013


On Saturday, 11 May 2013 at 13:00:42 UTC, Flamaros wrote:
> On Saturday, 11 May 2013 at 01:48:12 UTC, evilrat wrote:
>> On Friday, 10 May 2013 at 21:11:57 UTC, Flamaros wrote:
>>>
>>> In the load(...) method I am getting filePath without issue, 
>>> but for next parameters I am little confused on how to do.
>>
>> what all that stuff in ur load method? O_O
>>
>> look at my example in this thread, that at least should give 
>> you idea on how get related types from it - 
>> http://forum.dlang.org/thread/kmepi8$1tjp$1@digitalmars.com
>
> I think my major mistake is to call load method with _arguments 
> in my ResourceManager:
>
> instance.load(filePath, _arguments);
>
> Passing _argptr doesn't seems to be the right solution neither, 
> because I am receiving a void* in the load method of my 
> Resource object instead of a ushort[].

uhm well now i see what you are doing, in your getResource() 
method you will need to pack args somehow, as Variant[] array for 
example and then pass them to load(which now should have 
load(Variant[] params) signature), also you may want to restrict 
func to accept just few types, or at least push enum control 
values before data for distinction purposes.

maybe it is possible to do what you are trying to do, but 
_arguments and their typeinfo valid only in current scope, maybe 
it is possible to hack it somehow but it would be easier and 
safer just to pack all arguments in array.

and concerning ur resource stuff - moving primitive types as raw 
data isn't good idea, using minimalistic structs instead would 
give you lot more control(and safety) later as long as easier API 
tweaking later

p.s. i hope this just for testing, that vbo/resource api isn't 
convenient at all, and if you need vertex data loader i recommend 
you try assimp/derelict3 pair -_-


More information about the Digitalmars-d-learn mailing list