Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ASDAlexander77 committed May 28, 2020
1 parent 58f38ff commit 87612b1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
3 changes: 2 additions & 1 deletion Experiment/SimpleVulkanApp/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
"queue": "cpp",
"shared_mutex": "cpp",
"stack": "cpp",
"xtree": "cpp"
"xtree": "cpp",
"*.rh": "cpp"
}
}
6 changes: 5 additions & 1 deletion Experiment/SimpleVulkanApp/src/appwindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ enum Messages {
Destroy = 0x0002,
Size = 0x0005,
Paint = 0x000f,
Close = 0x0010,
KeyDown = 0x0100,
Erasebkgnd = 0x0014
}
Expand All @@ -37,6 +38,9 @@ export class AppWindow {

protected onMessage(uMsg: uint64_t, wParam: uint64_t, lParam: uint64_t): uint32_t {
switch (uMsg) {
case Messages.Close:
close_window(0);
break;
case Messages.Erasebkgnd:
return 1;
case Messages.Paint:
Expand All @@ -58,6 +62,6 @@ export class AppWindow {
return 0;
}

return 0;
return 0xffff;
}
}
16 changes: 10 additions & 6 deletions Experiment/SimpleVulkanApp/src/native/window.win32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,21 @@ intptr_t create_window(js::string title, intptr_t parent_hwnd, callback_function
return reinterpret_cast<intptr_t>(hwnd);
}

void messages_loop() {
int messages_loop() {
MSG msg = { };
while (GetMessage(&msg, NULL, 0, 0))
{
if (msg.message == WM_QUIT) {
return (int)msg.wParam;
}

TranslateMessage(&msg);
DispatchMessage(&msg);

RedrawWindow(main_hwnd, nullptr, nullptr, RDW_INTERNALPAINT);
}

return 0;
}

extern void Main(void);
Expand All @@ -91,11 +97,9 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR pCmdLine, int nCmdSh
register_window_class();

// main inject
Main();
Main();

messages_loop();

return 0;
return messages_loop();
}

LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Expand All @@ -111,7 +115,7 @@ LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
delete callback_function_ptr;
}

if (result) {
if (result != 0xffff) {
return result;
}
}
Expand Down

0 comments on commit 87612b1

Please sign in to comment.