Pisze pod winapi przy uzyciu opengl iprogram: bcb :)
I mam fragment kodu (który jest w każdym programie pod api windows )
a)
case WM_KEYDOWN:
switch (wParam)
{
case VK_ESCAPE:
PostQuitMessage(0);
return 0;
}
b) i funkce :
void demo(HDC bufor){
glEnable( GL_TEXTURE_2D );
glEnable(GL_BLEND);
[...] /* jest tutaj inicjalizacja p_lewa i petla=true i fragment kodu nie do
udostępnienioa */
while(petla){
if (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
{
switch (msg.message){
case WM_QUIT:
petla=false;
break;
case WM_KEYDOWN:
switch(msg.wParam){
case VK_LEFT: p_lewa=true;
break;
case VK_RIGHT: p_prawa=true;
break;
case VK_END:p_kop=true;
break;
case VK_HOME:p_piesc=true;
break;
}
if (p_lewa)
{
postacie info;
info.parametry("lewo");
}
}
}
}
}
c) I inicjalizacje funkcji:
/**************************
* Function Declarations
*
**************************/
LRESULT CALLBACK WndProc (HWND hWnd, UINT message,
WPARAM wParam, LPARAM lParam);
void EnableOpenGL (HWND hWnd, HDC *hDC, HGLRC *hRC);
void DisableOpenGL (HWND hWnd, HDC hDC, HGLRC hRC);
int numertekstury=0;
void tekstura(AnsiString path);
void demo(HDC bufor);
I nie działają klawisze. Może trzeba gdzieś jeszcze wywołać tą funkcje ??