summaryrefslogtreecommitdiff
path: root/source/tests/win32/01-window/03_sub_menu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/tests/win32/01-window/03_sub_menu.cpp')
-rw-r--r--source/tests/win32/01-window/03_sub_menu.cpp96
1 files changed, 68 insertions, 28 deletions
diff --git a/source/tests/win32/01-window/03_sub_menu.cpp b/source/tests/win32/01-window/03_sub_menu.cpp
index 9467334..d34f4ed 100644
--- a/source/tests/win32/01-window/03_sub_menu.cpp
+++ b/source/tests/win32/01-window/03_sub_menu.cpp
@@ -26,6 +26,7 @@ void AddMenus(HWND);
#define IDM_ASSET 20
HWND wnd;
+HWND wnd2;
AEMath::Recti viewport;
@@ -61,12 +62,12 @@ void main()
Shader* shader;
VertexBuffer* vb;
-struct
+struct
{
- int pos;
- int tex;
- int m;
- int v;
+ int pos;
+ int tex;
+ int m;
+ int v;
int p;
int color;
} locs;
@@ -77,22 +78,61 @@ struct Vert
float s, t; // uv
};
-int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR lpCmdLine, int nCmdShow)
+int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR lpCmdLine, int nCmdShow)
{
AEIO::Filesystem::Get()->Init("D:\Asura\bin\win64");
MSG msg;
- WNDCLASSW wc = { 0 };
- wc.lpszClassName = L"Submenu";
- wc.hInstance = hInstance;
- wc.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
- wc.lpfnWndProc = WndProc;
- wc.hCursor = LoadCursor(0, IDC_ARROW);
- RegisterClassW(&wc);
-
- wnd = CreateWindowW(wc.lpszClassName, L"Asura",
- WS_OVERLAPPEDWINDOW | WS_VISIBLE,
- 200, 200, 550, 450, 0, 0, hInstance, 0);
+
+ WNDCLASSEXW wcex;
+ memset(&wcex, 0, sizeof(wcex));
+ wcex.cbSize = sizeof(wcex);
+ wcex.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
+ wcex.lpfnWndProc = WndProc;
+ wcex.cbClsExtra = 0;
+ wcex.cbWndExtra = 0;
+ wcex.hInstance = hInstance;
+ wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wcex.hbrBackground = NULL;
+ wcex.lpszMenuName = NULL;
+ wcex.lpszClassName = L"Submenu";
+
+ RegisterClassExW(&wcex);
+
+ //WNDCLASSW wc = { 0 };
+ //wc.lpszClassName = L"Submenu";
+ //wc.hInstance = hInstance;
+ //wc.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
+ //wc.lpfnWndProc = WndProc;
+ //wc.hCursor = LoadCursor(0, IDC_ARROW);
+ //RegisterClassW(&wc);
+
+ DWORD windowStyle = 0;
+ DWORD extendedStyle = 0;
+ windowStyle = WS_POPUP | WS_CLIPCHILDREN | WS_THICKFRAME | WS_VISIBLE;
+ extendedStyle = WS_EX_TOOLWINDOW;
+ //windowStyle = WS_OVERLAPPEDWINDOW | WS_VISIBLE;
+
+ RECT rect = { 100, 100, 500, 500 };
+ AdjustWindowRectEx(&rect, windowStyle, true, extendedStyle);
+
+ wnd = CreateWindowExW(extendedStyle, wcex.lpszClassName, L"", windowStyle,
+ rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top,
+ NULL, NULL, hInstance, NULL);
+
+ // child
+ windowStyle = WS_POPUP | WS_CLIPCHILDREN | WS_THICKFRAME | WS_VISIBLE;
+ extendedStyle = WS_EX_TOOLWINDOW;
+ rect = { 100, 100, 500, 500 };
+ AdjustWindowRectEx(&rect, windowStyle, false, extendedStyle);
+/*
+ wnd2 = CreateWindowExW(extendedStyle, wcex.lpszClassName, L"", windowStyle,
+ rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top,
+ NULL, NULL, hInstance, NULL);
+*/
+ //wnd = CreateWindowW(wcex.lpszClassName, L"Asura",
+ // WS_OVERLAPPEDWINDOW | WS_VISIBLE,
+ // 200, 200, 550, 450, 0, 0, hInstance, 0);
while (GetMessage(&msg, NULL, 0, 0)) {
@@ -126,7 +166,7 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg,
switch (msg) {
- case WM_SIZE:
+ case WM_SIZE:
{
if (gfx.Inited())
{
@@ -152,13 +192,13 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg,
tex = img->GetGLTexture();
glBindTexture(GL_TEXTURE_2D, tex); //
-
+
// Χ
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
// ˲
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
{
int imgLoc = shader->GetUniformLocation("img");
@@ -213,7 +253,7 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg,
file = new File("root/img.jpg");
file->Open(File::FILE_MODE_READ);
file->ReadAll(&db);
-
+
wglMakeCurrent(hdc, glc);
RECT rect;
@@ -231,14 +271,14 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg,
file2->Open(File::FILE_MODE_READ);
file2->ReadAll(&db);
imgdata->Decode(db);
- img->Load(imgdata, {50, 100});
+ img->Load(imgdata, { 50, 100 });
imgdata->Release();
// shader
shader = new Shader();
shader->Load(vert, frag);
{
- int w = img->GetWidth();
+ int w = img->GetWidth();
int h = img->GetHeight();
//Vert v[] = {
// { 0.5f, 0.5f, 0, 0 },
@@ -287,12 +327,12 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg,
break;
}
-
+
return DefWindowProcW(hwnd, msg, wParam, lParam);
}
void AddMenus(HWND hwnd) {
-
+ return;
HMENU hMenubar = CreateMenu();
HMENU hMenu = CreateMenu();
HMENU hSubMenu = CreatePopupMenu();