   Anyone else Creating a 2D Strategy Game using MFC?
  A couple of people over on the game progamming forum suggested that I move this topic over here-Over the past several years I have been dabbling in C++/MFC/DirectX and have many, many books, but little time to dedicate to my "weekend coding" hobby. I am essentially making slow progress in creating a 2D turn-based, overhead-based strategy game. Since I am a complete beginner, my objective has always been to initially use MFC so I would not have to spend all the time fighting the GUI and could focus more on the game/data portions of programming and then convert the GDI calls to a DirectX system. I am posting this b/c I know there are "weekend coders" out there trying to do the same thing I am with MFC, and what I would like to do, is share code snippets, ideas, etc. for how to accomplish such things specific to creating such games in MFC, such as using the OnIdle function to move the map when you hit an edge, etc. I have searched various websites, and while there are general MFC-related ones out there, I have not seen any dealing with developing 2D MFC games. PLEASE, I DO NOT WANT THIS THREAD TO TURN INTO A MFC/OR NOT TO MFC DEBATE (WHICH IS ALL MY SEARCH ON THIS TOPIC TURNED UP). So anyone else out there trying to create a 2D turn-based game in MFC? -TG 
  In the early stages of learning/developing a game, it is quite reasonable to use the GDI approach. By using a small window, the GDI system will be fast enough to evaluate how your ideas work. I''m using a scheme where, currently, over half of the screen is just displays of internal data. That helps me to debug the program. Using preexisting GUI items for displaying the data is really a boost to debugging. As my project progresses, the debug data will eventually thin out and I will delete the data display items. When its time for the game display to occupy most of, or all of, the screen, I''ll have to go with straight DirectX. but for now, I can hold off on that additional complexity while the game itself is my focus.(I''m using a different development environment, but the underlying concept is the same.)If you have any specific questions, go ahead and ask; who knows... someone might actually answer! ;quote:Original post by Doctor J   (I'm using a different development environment, but the underlying concept is the same.)If you have any specific questions, go ahead and ask; who knows... someone might actually answer!   Which one are you using?  My current problem has to do with implementation of two tasks for the "OnIdle" function: (1) implementation of a scrolling mechanism that scrolls the screen when you move the cursor against the sides of the client area/screen; and (2) implementation of background animation cycles (i.e. circling planets or gyrating spacecraft).  My specific problem is running these codes inside the OnIdle function without lock-ups are access violations.  Any links to articles on these topics are code snippets would be greatly appreciated.Thanks-TG [edited by - Tampa_Gamer on February 2, 2004 12:38:58 AM];  I use Delphi. The technique there is to write your own function "MyIdleHandler" (eg.) and, in the main form''s create routine, specify that the "OnIdle" message will call "MyIdleHandler". That works well in Delphi... but, I know, you need something similar for MFC. Here is a link to some information from the evil empire itself:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_idle_loop_processing.asp ;  My current problem relates to using a window (derived from CWnd) inside a window (derived from CFrameWnd).  The purpose of the CWnd derived window is to overlay the client area of the frame window so that I don 't have to worry about constantly adjusted GetClient Rect for menu/toolbars/dialogbars, etc. that are in the frame window.  For solving the "repaint" problem, I use a virtual window which the application draws to and then blit the virtual window to the screen during OnPaint.  The problem is when I use the function CClientDC DC (this) within the CWnd constructor to create the compatible bitmap for the virtual window, I get an assertion error on the use of CClient DC (this).  Is there some limitation as to getting a CClientDC within a CWnd derived window contained in a CFrameWnd?  Is there a better way to solving the "repaint" problem (leaving aside the issue of DirectX for now)?  Thanks in advance,-TGB/T/W/ Thanks for the link to MSDN.  I did not know about PeekMessage. [edited by - Tampa_Gamer on February 6, 2004 11:38:01 AM]