Skip to main content
gamedev.net
🔒 Locked

Using classes with my basecode, but has errors help!

Started by Elfs1der Sep 7, 2003 at 4:11 PM 9 replies 350+ views
Original Post
Elfs1der
Elfs1der
Ok here is my code: LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { // Handle a few of the msg''s that window sends to our program switch(msg) { case WM_ACTIVATE: // Handle window creation { if(!HIWORD(wParam)) { OGL_Window.active = true; } else { OGL_Window.active = false; } return 0; break; } case WM_CLOSE: // Handle when the window is closed { PostQuitMessage(0); // Tell windows that we want it to exit return 0; // Quit } case WM_SIZE: // Handle the painting to the window(resizing etc...) { OGL_Window.ResizeGLScene(LOWORD(lParam), HIWORD(lParam)); } case WM_KEYDOWN: { OGL_Window.keys[wParam] = true; return 0; } case WM_KEYUP: { OGL_Window.keys[wParam] = false; return 0; } default: { break; } } // end switch return DefWindowProc(hwnd, msg, wParam, lParam); } now, I get 10 of these syntax error : missing '';'' before ''.'' and the arrow points to OGL_Window.keys[wParam] = false; for example and all of the other ones... what does that mean i cant see it
Elfs1der
Elfs1der
OGL_Window is a class, and i do have those variables under public
Sneftel
Sneftel
It''s a class? You can''t access non-static members of a class, only of an object.


How appropriate. You fight like a cow.
Elfs1der
Elfs1der
see, in the WinMain function i declared OGL_Window OGL_Window; and i use the variables in that class fine but its in the wndproc that it doesnt work, and i declared the wndproc as a friend function of that class so i dunno whats going on
Raloth
Raloth
Dear God, at least put the code between [ source ] and [ /source ] (without spaces).

[edited by - Raloth on September 7, 2003 5:32:04 PM]
____________________________________________________________AAAAA: American Association Against Adobe AcrobatYou know you hate PDFs...
Sneftel
Sneftel
quote:
Original post by Elfs1der
see, in the WinMain function i declared OGL_Window OGL_Window; and i use the variables in that class fine but its in the wndproc that it doesnt work

Variables declared in one function are in the scope of that function, and can''t be accessed elsewhere. Period.


How appropriate. You fight like a cow.
Elfs1der
Elfs1der
Oh well, i fixed it anyways hehe

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.