I'm so lost, need help

Me [M17] and my girlfriend [F18] broke up last night but when it happened I felt almost relieved because I've noticed her acting strange the past few days so I suspected something was up. (Her ex is friends with her brother and has been hanging around her house more). I was sadder the days leading up to it than I was when it initially happened. Then i told her that I'm not mad or anything and that we can still talk and stuff and maybe even date again in the future. I sorta ended our conversation with a joke that hurt her feelings that I regret and only said because I wasn't trying to be too depressed about her. But when it came time to go to bed she was the only thing on my mind, I kept waking up in the middle of the night. Then in first period today she texted me saying "good morning thanks for replying" followed by a second text saying "gtg". Then I said "I'm sorry I'm sad, I didn't even feel like going to school today". Then I opened up to her saying I'm not over her and she said that she'll leave me alone and I said no you don't have to do that and now we're just texting like friends.

Tldr; Me and my girlfriend broke up, I thought I was good but I'm not. It hurts to talk to her and it hurts to not talk to her.