Get difficulties with variadics

Flamaros flamaros.xavier at gmail.com
Sat May 11 15:01:32 PDT 2013


On Saturday, 11 May 2013 at 13:40:15 UTC, evilrat wrote:
> 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 -_-

Thanks a lot, I think using Variant[] is a better way. For the 
moment (maybe for few minutes) it's necessary to always give the 
Variant array to the getResource method, but it can be null.

I actually use derelict3, but for this VBO isn't not necessary to 
have something much more advanced as it's only for a Quad 
generated by hand. I am sharing the indexes VBO of Quads.

The operational parameters can be useful to load a Texture from 
an Image instance instead of only the filePath for exemple. 
filePath also act as key to be able to get resources.


More information about the Digitalmars-d-learn mailing list