I am having an issue where if I use the openfl drawing API with neko as the target, whenever I move an object, the entire frame jitters back and forth by about a pixel. Does anyone know why this happens? The following code illustrates the problem:
package;
import openfl.display.Sprite;
import openfl.Lib;
import openfl.events.Event;
/**
* ...
* @author Graham Reid
*/
class Main extends Sprite
{
var theta:Float = 0;
public function new()
{
super();
}
public function update(e:Event):Void
{
theta += 0.01;
var testx:Float = 10 * Math.cos(theta);
var testy:Float = 10 * Math.sin(theta);
this.graphics.clear();
this.graphics.lineStyle(1, 0xFF0000);
this.graphics.moveTo(testx, testy);
this.graphics.lineTo(testx + 10, testy);
this.graphics.lineTo(testx + 10, testy + 10);
this.graphics.lineTo(testx, testy + 10);
this.graphics.lineTo(testx, testy);
this.graphics.drawRect(160, 160, 50, 50);
}
}
If I modify the line drawing to:
this.graphics.clear();
this.graphics.lineStyle(1, 0xFF0000);
this.graphics.moveTo(Std.int(testx), Std.int(testy));
this.graphics.lineTo(Std.int(testx + 10), Std.int(testy));
this.graphics.lineTo(Std.int(testx + 10), Std.int(testy + 10));
this.graphics.lineTo(Std.int(testx), Std.int(testy + 10));
this.graphics.lineTo(Std.int(testx), Std.int(testy));
there is no jitter, but there are significant aliasing effects