Added function to set frame size based on resolution (from stack overflow)