im working on a win32 game, and im getting an error in while setting up my window class. the error says "argument of type 'LRESULT (sys_c::)(HWND_*,UINT,WPARAM,LPARAM)'does not match'LRESULT(*)(HWND_*,UINT,WPARAM,LPARAM)'" i have made many win32 programs before and the only difference here is that im calling wndproc from a class. are you able to do that or is it something else?
here the function to create the window
BOOL setup_c::create_window( int width, int height )
{
WNDCLASSEX wc;
RECT rect;
DWORD style;
DWORD exstyle;
wc.cbSize = sizeof( WNDCLASSEX );
wc.style = 0;
wc.lpfnWndProc = sys.main_wndproc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = wstate.hInstance;
wc.hIcon = NULL;
wc.hCursor = LoadCursor( NULL, IDC_ARROW );
wc.hbrBackground = NULL;
wc.lpszMenuName = NULL;
wc.lpszClassName = wstate.winclass;
if( !RegisterClassEx( &wc ) )
{
MessageBox( NULL, "Could Not Register Window Class!", "Error", MB_ICONEXCLAMATION | MB_OK );
return FALSE;
}
if( !fullscreen )
{
style = WS_OVERLAPPEDWINDOW;
exstyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
}
rect.left = 0;
rect.top = 0;
rect.right = width;
rect.bottom = height;
AdjustWindowRectEx( &rect, style, FALSE, exstyle );
width = rect.right - rect.left;
height = rect.bottom - rect.top;
wstate.hWnd = CreateWindowEx( exstyle, wstate.winclass, "title", WS_CLIPSIBLINGS
| WS_CLIPCHILDREN | style, 0, 0, 0, 0, NULL, NULL,
wstate.hInstance, NULL );
if( wstate.hWnd == NULL )
{
MessageBox( NULL, "Could Not Create Window!", "Error", MB_ICONEXCLAMATION | MB_OK );
return FALSE;
}
ShowWindow( wstate.hWnd, SW_SHOW );
UpdateWindow( wstate.hWnd );
if( !setupgl.init_window() );
{
return FALSE;
}
SetForegroundWindow( wstate.hWnd );
SetFocus( wstate.hWnd );
return TRUE;
}
and heres the wndproc
LRESULT CALLBACK sys_c::main_wndproc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
switch( msg )
{
case WM_SYSCOMMAND:
{
switch( wParam )
{
case SC_SCREENSAVE:
case SC_MONITORPOWER:
return 0;
}
}
break;
case WM_CLOSE:
{
shutdown();
return 0;
}
break;
case WM_DESTROY:
{
PostQuitMessage( 0 );
return 0;
}
break;
case WM_KEYDOWN:
{
// key press function( key, down )
return 0;
}
break;
case WM_KEYUP:
{
// key press function( key, up )
return 0;
}
break;
case WM_SIZE:
{
resize_window();
return 0;
}
break;
}
return DefWindowProc( hWnd, msg, wParam, lParam );
}
thanks in advance