Help with windowed app
Hey,
I''m trying to make a directX application in windowed mode. I have it so that it fills when it initializes to blue using DDraw_Fill_Surface from TOTWGPG by Andre LaMothe. When I minimize or set the window to the background I lose whatever is covered and it goes back again. What can be done about this besides filling every screen? And what problems am I going to run into when the game is actually running and it goes into the background. I''m pretty sure I have to handle window messages am I correct?
Thanks
This probably isn''t going to be much help, but I''ll tell you I had a little trouble figuring that same thing out my self, I would look at the tutorial in the "Articles & Resources" section here at Gamedev, there is actually a article that deals with just that issue, well actually with going from Windowed to Full Screen.. but that will show you the difference and it worked for me...
Your right that you have to handle Windows Messages because they will help you know where to draw the screen..
Good Luck..
Please visit Turt99 Productions
Your right that you have to handle Windows Messages because they will help you know where to draw the screen..
Good Luck..
Please visit Turt99 Productions
Ok I got it figured out how to get it on the screen and constantly work. But I''m having a problem. Whenever it starts up I can move my mouse around fine for a while and then at times my computer just freezes. Doesn''t do anything. I have a fullscreen variable to tell if its windowed (Fullscreen is not yet implemented) and bRunGame which is boolean for if the window is active or not. here is the code for my main portion of the program
as you can see I have lppdsprimary and lpddsbackground which is the same size as the client area. It is filled blue and has one bitmap for a test. Any idea''s as to why it would cause my computer to seize up momentarily at times?
int Game_Main(void *parms = NULL, int num_parms = 0){// this is the main loop of the game, do all your processing// here // make sure this isn''t executed againif (window_closed) return(0);// for now test if user is hitting ESC and send WM_CLOSEif(!full_screen && bRunGame){ RECT dest_rect; GetClientRect(main_window_handle, &dest_rect); POINT p1; POINT p2; p1.x = dest_rect.left; p1.y = dest_rect.top; p2.x = dest_rect.right; p2.y = dest_rect.bottom; // convert it to screen coordinates (like DirectDraw uses) ClientToScreen(main_window_handle, &p1); ClientToScreen(main_window_handle, &p2); // copy the two points'' data back into the rect dest_rect.left = p1.x; dest_rect.top = p1.y; dest_rect.right = p2.x; dest_rect.bottom = p2.y; lpddsprimary->Blt(&dest_rect, lpddsbackground, NULL, DDBLT_WAIT | DDBLT_KEYSRC, NULL);}// return success or failure or your own return code herereturn(1);} // end Game_Main
as you can see I have lppdsprimary and lpddsbackground which is the same size as the client area. It is filled blue and has one bitmap for a test. Any idea''s as to why it would cause my computer to seize up momentarily at times?
I just had a thought. Could it be because my background surface is as large as the primary surface. 800x600? This windowed mode application programming combined with DirectX stuff sucks donkey balls!
I feel like I''m talking to myself here.. Has anyone tried to ever blt a background surface on a windowed app? Well I know its obvious. But this problem is really stumping me. I''m not understanding why blitting to the primary surface of 800x600 with an 800x600 bitmap is tying up my computer so much.
quote: Original post by Space_Panda
I''m not understanding why blitting to the primary surface of 800x600 with an 800x600 bitmap is tying up my computer so much.
Thats why your crashing, I would try using smaller Bitmaps... the larger the image the more ram its going to take to store the image, I really don''t think you should be moving large images around like that
Please visit Turt99 Productions
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement