Reading Analog value from GPIO on STMF103RCT6
The short answer is you will need, at some point, to connect the joystick to the ADC. D0 and D1 are not suitable pins for reading an analog signal. 

Before you get to plugging things in though, you are missing quite a bit of information. I suggest reading though MC's Data Acquisition handbook. It is short enough to be approachable and doesn't assume too much prior information. You can find it here: https://www.mccdaq.com/support/Data-Acquisition-Handbook.aspx

Once you have read it, you'll be in a position to revise your question to make it answerable. For this question to be answerable by us, we'll need to have you 
posting schematics of the circuit you're working on, specific part numbers (and possibly datasheet links), and code snippets.