Screen only renders if mouse moves?
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]
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]
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
and DXMain funciton rendersceene renders the scene
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
Move :
App.ProcessInput();
App.UpdateScene();
outside of the loop, right after:
return (int)msg.wParam;
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]
[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:
You can also look at the DirectX SDK samples'' implementation.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement