The GetSubsystem<Graphics>()->SetMode(screenRes.x_, screenRes.y_);
seems to work when i used it directly before GetSubsystem<Graphics>()->ToggleFullscreen();
however to to toggle full screen off i use GetSubsystem<Graphics>()->SetMode(screenRes.x_ / 2, screenRes.y_ / 2);
but this seems to minimize the screen.
here is the code in total:
if (input->GetKeyPress(KEY_P))
{
if (GetSubsystem<Graphics>()->GetFullscreen() == true)
GetSubsystem<Graphics>()->SetMode(screenRes.x_ / 2, screenRes.y_ / 2);
else
GetSubsystem<Graphics>()->SetMode(screenRes.x_, screenRes.y_);
GetSubsystem<Graphics>()->ToggleFullscreen();
}