Make WindowProc a static member, so we can hide processEvent...() methods. #29
@@ -9,6 +9,7 @@
|
||||
#include <ReWindow/types/MouseButton.h>
|
||||
#include <ReWindow/types/WindowEvents.h>
|
||||
#include <queue>
|
||||
#include <Windows.h>
|
||||
|
||||
|
||||
namespace ReWindow {
|
||||
@@ -45,6 +46,7 @@ public:
|
||||
/// RWindow is a class implementation of a platform-independent window abstraction.
|
||||
/// This library also provides abstractions for user-input devices, and their interaction with the window.
|
||||
class ReWindow::RWindow {
|
||||
|
||||
protected:
|
||||
class Platform;
|
||||
Platform* platform;
|
||||
@@ -332,7 +334,11 @@ public:
|
||||
|
||||
/// Updates internals to account for the latest calculated frame time.
|
||||
void UpdateFrameTiming(float frame_time);
|
||||
public:
|
||||
|
||||
#ifdef WIN32
|
||||
static LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
#endif
|
||||
protected:
|
||||
/// These unfortunately *have* to be public because of the poor design of the windows event loop.
|
||||
void processKeyRelease(Key key);
|
||||
void processKeyPress(Key key);
|
||||
|
@@ -95,7 +95,7 @@ void RWindow::PollEvents() {
|
||||
focused = local_focused;
|
||||
}
|
||||
|
||||
LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
||||
LRESULT CALLBACK RWindow::WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
||||
auto* window = reinterpret_cast<RWindow*>( GetWindowLongPtr(hwnd, GWLP_USERDATA) );
|
||||
switch (uMsg) {
|
||||
case WM_CLOSE: {
|
||||
@@ -415,7 +415,7 @@ bool OpenGLWindow::Open() {
|
||||
platform->hInstance = GetModuleHandle(nullptr);
|
||||
|
||||
WNDCLASS wc = { };
|
||||
wc.lpfnWndProc = WindowProc;
|
||||
wc.lpfnWndProc = RWindow::WindowProc;
|
||||
wc.hInstance = platform->hInstance;
|
||||
wc.lpszClassName = "RWindowClass";
|
||||
RegisterClass(&wc);
|
||||
|
Reference in New Issue
Block a user