Yeah it finally works and doesn't use like 100 useless variables (though it does use some) WASD and arrow keys
Thanks to @Putney_Cat for Cohen-Sutherland's clipping algorithm. Yeah it's still kinda broken with the intersections but i gave up on the whole filling thing so it doesnt matter