Screen only renders if mouse moves?

Started by
7 comments, last by DevLiquidKnight 20 years, 3 months ago
I dont get it it only updates the scene if my mouse move any ideas on what might cause this?
Advertisement
Do you call your rendering code at the event of WM_PAINT?

EDIT: Because that's probably not what you'd want to do in an action game

[edited by - Nik02 on January 11, 2004 7:18:59 PM]

Niko Suni

Or maybe you use GetMessage instead of PeekMessage.
And the rockets' red glare, the bombs bursting in air,gave proof through the fight that our flag was still there.Oh say, does that star-spangled banner yet waveover the land of the free and the home of the brave?
well yea i was.. but I also had this
App.UpdateScene();
in my main file which called the window class function UpdateScene() which "updated the scene" in this loop
// WinMain.cpp	App.SetInstance(hInstance);	App.SetWndClassName(TEXT("WndClass"));	App.SetWndCaption(TEXT("Game"));	App.SetWndStyle(WS_OVERLAPPEDWINDOW&~WS_THICKFRAME&~WS_MAXIMIZEBOX);	if(App.Create())	{		MSG msg;		//DWORD time;		while(GetMessage(&msg,NULL,0,0))		{			TranslateMessage(&msg);			DispatchMessage(&msg);			//time = timeGetTime();			App.ProcessInput();			App.UpdateScene();		}		return (int)msg.wParam;	}// WinMainClass.cppvoid CWndMain::UpdateScene(){	game.Update();}// GameMain.h#include <windows.h>#include <stdio.h>#include <stdlib.h>#include "DXMain.h"#include "DXInput.h"#ifndef _GAME_MAIN_H_#define _GAME_MAIN_H_class CGameMain : private DXMain{	public:				CGameMain();				~CGameMain();		void	InitGame(HWND);		void	Update();	private:	protected:};#endif// GameMain.cppvoid CGameMain::Update(){	RenderScene();}

and DXMain funciton rendersceene renders the scene
I believe GetMessage doesn''t return until it recieves a message.

tj963
tj963
Move :
App.ProcessInput();
App.UpdateScene();

outside of the loop, right after:

return (int)msg.wParam;
There is only one loop if i moved it out there it would erm.. not be executed until the window closed? Maybe its set up wrong x.x its rather laggy

[edited by - DevLiquidKnight on January 11, 2004 7:43:56 PM]
You will generally want to use PeekMessage in your loop. The loop would look similar to this:
while( WM_QUIT != msg.message  ){    if( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) )    {        TranslateMessage( &msg );        DispatchMessage( &msg );    }    else    {        App.ProcessInput();        App.UpdateScene();    }}

You can also look at the DirectX SDK samples'' implementation.
ok that fixed it

This topic is closed to new replies.

Advertisement