I am trying top port this code :

float interpolate( float from, float to, float amount, float
(*easing)(float) )
{
     return from + ( to-from )*( easing( amount ) );
}

float linear_interpolation( float p )
{
     return p;
}


the "float (*easing)(float) " part needs to be rewritten as
"float function(float) easing" as far as I know and could find
here http://dlang.org/deprecate.html#C-style function pointers.

so my code is written as:

import std.stdio;

float interpolate(float from, float to, float amount, float
function(float) easing)
{
   return from + (to - from) * (easing(amount));
}

float lineair_interpolation(float p)
{
   return p;
}

void main()
{
   writeln(interpolate(100,100,10, lineair_interpolation));
}

this errors witha : Error: function test.lineair_interpolation
(float p) is not callable using argument types (), but I don't
really know where to go from here.

Reply via email to