You are talking about template matching, in which one provides a template and a scene, and OpenCV outputs the matches. However, for this to work, you need to provide static images as templates. It does not matter if your scene is dynamic, but your templates should be static.
If your game is continuously running, this means it changes its frames every second and gets always new frames, how do you expect OpenCV to match the template(s) over thousands of frames? You need a match, if you do not have any commonality between your template (sample frames from your game) and your scene (your real time running game in this case), then do not expect OpenCV to achieve what you want. Remember, what you are looking for in the scene, should have something in common with the template. If you are looking for a character in your game screen for instance, and if that character is always present, then you can achieve this with template matching, like here in the bottom there is an example from a Mario game. But the whole frame you cannot match, since there would not be any commonality between your template frames and real-time frames.
So the answer to your question is no.
However, if all you want is to detect the window where your game is running, this is an easier task, and in that case the question should be rephrased. Or if your question is to detect an object or a character that is always present in your game screen, that can also be achieved, but you cannot match the whole frame without any commonality between the template.
take a look at "How to capture the desktop" https://stackoverflow.com/q/14148758/...