Original Post
Hey guys. Even though I'm not very new to the comunity I still haven't had the chance to talk and share info with you guys. I'd like to change that since we're all here to make games and learn from one another. I made this topic because I've started working on my second GameEngine since the first one didn't turn out exactly as I wanted and now I have more experience. I'd like to put all my questions and stuff I figure out here so anyone can see the eventual problems and solutions. First of all my game engine is called HammerEngine but it might change (not the important right now). Next in line, I work with Visual Studio 2008 c++(for the engine programming) and I also make C# bindings. I use OpenGL for graphics. The engine uses deferred lighting. I want to split it up as Hammer3D,HammerInput,HammerPhysics,HammerAi etc. Currently only Hammer3D and HammerInput are in development. Hammer3D let's you bind the a engine to a HWND or creates a window for you and binds an engine to it. HammerInput takes a HWND and attaches a input loop to it so that you don't have to do anything but call functions like KeyDown(KEY_A) First problem: I'm not sure on how to make a window that updates automatically without me having to call a certain function. My code for the example looks like this:
#include <windows.h>
#include "..\..\..\Hammer3D\Hammer3D.h"
#include "..\..\..\HammerInput\HammerInput.h"
TEngine engine;
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hprev, PSTR cmdline, int ishow)
{
InitializeHammer3D();
InitializeHammerInput();
engine = CreateEngineWindow(800,600,32);
CreateInput(GetEngineHWND(engine));
while(!KeyDown(KEY_ESCAPE))
{
}
}
Problem is that I can't move or do anything with the window. Oh and for who might ask. HammerInput uses subclassing for getting acces to the input without calling something like Update(); Could anyone point me somewhere with this issue? Thank you. Edit: I found a way to do this but it has one problem. Using this function that is called on every function like KeyHit:
void SystemPoll(){
MSG msg;
while( PeekMessage( &msg,0,0,0,PM_REMOVE ) ){
switch( msg.message ){
case WM_KEYDOWN:case WM_KEYUP:
case WM_SYSKEYDOWN:case WM_SYSKEYUP:
switch( msg.wParam ){
case VK_SHIFT:
case VK_CONTROL:
case VK_MENU:
break;
}
break;
}
TranslateMessage( &msg );
DispatchMessage( &msg );
}
} This way the window works well but Im not sure what happens if for example you don't use any of those functions. It's a good temporary solution but not the best i think. [Edited by - LorinAtzberger on December 25, 2009 8:20:12 AM]