When it comes to programming games from the old school sega games like sonic to indie games or angry birds or even to more advance games like Diablo, how exactly is level design done? As in, are the levels sometimes designed straight out of code in an IDE? Or do they create a visual level design editor where things can be placed at the click of a mouse button? I'm imagining old school games or very simple ones like indies are done via code, where extremely complicated ones require a visual editor. Is this correct?
Also, when it comes to libraries like SDL or XNA, how often are these used rather than just utilizing OpenGL or DirectX? What about creating your own game engine vs utilizing one already made? Do most use already built engines? This question is directed toward the whole gaming spectrum of indie/big game development.