Based on fancy2D‘s framework