Skip to content

Commit

Permalink
ci stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan200101 committed Oct 6, 2024
1 parent de74a2b commit ca1e1c4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
3 changes: 3 additions & 0 deletions SGDBoop-VS.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,11 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<LibraryPath>C:\Users\mnsxx\source\repos\SGDBoop\lib;$(LibraryPath)</LibraryPath>
<EmbedManifest>false</EmbedManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>true</LinkIncremental>
<EmbedManifest>false</EmbedManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<CopyLocalProjectReference>false</CopyLocalProjectReference>
Expand All @@ -80,6 +82,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LibraryPath>$(SolutionDir)\lib\windows;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64)</LibraryPath>
<EmbedManifest>false</EmbedManifest>
</PropertyGroup>
<PropertyGroup Label="Vcpkg">
<VcpkgEnableManifest>true</VcpkgEnableManifest>
Expand Down
29 changes: 11 additions & 18 deletions gui-helper-win.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,27 @@ const char szClass[] = "winWindowClass";
#define IDC_BUTTON_OK 101
#define IDC_BUTTON_CANCEL 102

static HWND hWndListL;
static HWND hWndList;
static HWND hWndButtonOk;
static HWND hWndButtonCancel;
static int selected_index = -1;

static LRESULT CALLBACK WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
char buffer[50] = "";

switch (Msg)
{
case WM_CREATE:
{
HFONT hfFont = GetStockObject(DEFAULT_GUI_FONT);
hWndListL = CreateWindowExA(
hWndList = CreateWindowExA(
WS_EX_CLIENTEDGE | WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR,
WC_LISTBOX, NULL,
LBS_NOTIFY | WS_CHILD | WS_OVERLAPPED | WS_VISIBLE | WS_VSCROLL,
0, 0, 100, 100,
hWnd, NULL,
GetModuleHandle(NULL), NULL
);
SendMessage(hWndListL, WM_SETFONT, (WPARAM)hfFont, 0);
SendMessage(hWndList, WM_SETFONT, (WPARAM)hfFont, 0);

hWndButtonOk = CreateWindowExA(
WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR,
Expand Down Expand Up @@ -62,7 +60,7 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPara
RECT rcClient;

GetClientRect(hWnd, &rcClient);
SetWindowPos(hWndListL, NULL, rcClient.left + 10, rcClient.top + 10, rcClient.right - 20, rcClient.bottom - 60, SWP_NOZORDER);
SetWindowPos(hWndList, NULL, rcClient.left + 10, rcClient.top + 10, rcClient.right - 20, rcClient.bottom - 60, SWP_NOZORDER);
SetWindowPos(hWndButtonOk, NULL, rcClient.right - (80 * 2), rcClient.bottom - 45, 70, 30, SWP_NOZORDER);
SetWindowPos(hWndButtonCancel, NULL, rcClient.right - 80, rcClient.bottom - 45, 70, 30, SWP_NOZORDER);
}
Expand All @@ -78,7 +76,7 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPara
{
case IDC_BUTTON_OK:
{
LRESULT res = SendMessage(hWndListL, LB_GETCURSEL, (WPARAM)NULL, (LPARAM)NULL);
LRESULT res = SendMessage(hWndList, LB_GETCURSEL, (WPARAM)NULL, (LPARAM)NULL);
if (res != LB_ERR)
{
selected_index = res;
Expand Down Expand Up @@ -115,33 +113,32 @@ int SelectionDialog(const char* title, int count, const char** list, int selecti

HINSTANCE hInstance = GetModuleHandle(NULL);

//Settings All Window Class Variables
WNDCLASSEXA wc;
wc.cbSize = sizeof(WNDCLASSEX);
wc.cbSize = sizeof(WNDCLASSEXA);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hIcon = (HICON)LoadImageA(
hInstance,
MAKEINTRESOURCEA(IDI_ICON1), IMAGE_ICON,
0, 0, LR_DEFAULTSIZE | LR_DEFAULTCOLOR | LR_SHARED
0, 0,
LR_DEFAULTSIZE | LR_DEFAULTCOLOR | LR_SHARED
);
wc.hIconSm = (HICON)LoadImage(
hInstance,
MAKEINTRESOURCE(IDI_ICON1), IMAGE_ICON,
GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON),
LR_DEFAULTCOLOR | LR_SHARED);
LR_DEFAULTCOLOR | LR_SHARED
);
wc.hInstance = hInstance;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
wc.lpszMenuName = NULL;
wc.lpszClassName = szClass;

//Register Window Class
RegisterClassExA(&wc);

//Create Window
hWnd = CreateWindowExA(
WS_EX_CLIENTEDGE,
szClass,
Expand All @@ -153,22 +150,18 @@ int SelectionDialog(const char* title, int count, const char** list, int selecti
hInstance, NULL
);

// Add all games to the list
for (int i = 0; i < count; ++i)
{
SendMessage(hWndListL, LB_ADDSTRING, (WPARAM)NULL, (LPARAM)list[i]);
SendMessage(hWndList, LB_ADDSTRING, (WPARAM)NULL, (LPARAM)list[i]);
}

// Show the window
ShowWindow(hWnd, SW_SHOWNORMAL);

// Loop until completion
while (GetMessage(&Msg, NULL, 0, 0))
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}


return selected_index;
}

0 comments on commit ca1e1c4

Please sign in to comment.