Float to Int in windows target

There is a way to convert float to Int in windows target? Std.int only work in flash taget

Haxe documentation states that it’s available for all targets, and I’m certain I have used it crossplatform. Here it is working for JS target - http://try.haxe.org/#8735c . If you don’t want to use Std.int there’s always Math.round, Math.ceil, and Math.floor (of course a little more processing expensive than Std.int)

Things that work on the Windows target:

var i:Int = Std.int(0.5);

var i:Int = Math.round(0.5);

var i:Int = cast 0.5;

Why does that last one work? Because it generates this C++ code:

int i = (int)0.5;

In fact, “cast 0.5” will compile on all targets, and it will generally run without errors. However, this isn’t recommended. On targets like JS, it won’t perform any conversion at all, so you’ll end up storing 0.5 in a variable that’s supposed to be an integer.